1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
From 1690c505f1387e1884565021991a162e2f88f2b9 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Wed, 17 Sep 2025 01:42:08 -0700
Subject: [PATCH] Replace not predictable build path prefix with hardcode
string in the generated output file
The build path may contain tmp dir which is not predictable, it caused
the generated output file is not stable at each build and made
the generated library is not reproducible [1] between builds
vim frozenlist/_frozenlist.cpp
...
/* BEGIN: Cython Metadata
{
"distutils": {
"depends": [],
"language": "c++",
"name": "frozenlist._frozenlist",
"sources": [
"/tmp/.tmp-frozenlist-pep517-cfdvygni/src/frozenlist/_frozenlist.pyx"
]
},
"module_name": "frozenlist._frozenlist"
}
END: Cython Metadata */
...
Replace build path prefix with hardcode `build_path', it is no harm to
tweak comments in source file, after applied this commit,
vim frozenlist/_frozenlist.cpp
...
/* BEGIN: Cython Metadata
{
"distutils": {
"depends": [],
"language": "c++",
"name": "frozenlist._frozenlist",
"sources": [
"build_path/frozenlist/_frozenlist.pyx"
]
},
"module_name": "frozenlist._frozenlist"
}
END: Cython Metadata */
...
[1] https://reproducible-builds.org/
Upstream-Status: Submitted [https://github.com/cython/cython/pull/7162]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
Cython/Compiler/ModuleNode.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 6672cb986..b1123515e 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -779,7 +779,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.put_generated_by()
if metadata:
code.putln("/* BEGIN: Cython Metadata")
- code.putln(json.dumps(metadata, indent=4, sort_keys=True))
+ _metadata = json.dumps(metadata, indent=4, sort_keys=True)
+ _metadata = _metadata.replace(os.getcwd(), 'build_path')
+ code.putln(_metadata)
code.putln("END: Cython Metadata */")
code.putln("")
--
2.49.0
|