-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Replace not predictable build path prefix with hardcode string in the generated output file #7162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
… 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/
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
A related PR is #6489 which I closed previously as #6341 merged but I think this is still a problem. With python3-build doing builds in If the maintainers are happy with just munging the path to be a static prefix, then great. Alternatively, do we need to re-open !6489 and talk about path-prefix-mapping (as done by gcc etc with Another related issue is #5949. |
|
This is actually even more annoying to solve than I thought. eg One way of helping this would be to let |
For context, here's why we use a temporary directory: when we run adding 'yarl/_quoting_c.cpython-312-x86_64-linux-gnu.so'
adding 'yarl/_quoting_c.cpython-313-x86_64-linux-gnu.so'
adding 'yarl/_quoting_c.cpython-314-x86_64-linux-gnu.so'So my way of dealing with this was to make sure that each build starts with a clean slate. Hence a tmp dir. Post aio-libs/yarl#1586, the builds are stripped in release mode and aio-libs/yarl#1590 explores exposing a toggle for forcing in-place builds. |
Cython only generates the .c/.cpp files. They are (practically) agnostic to the Python version that built them and thus do not get in the way in your scenario. Whether
If it builds in a temp directory, then why doesn't it either move the current directory there, or use some other means to advertise the (temporary) project root in the build directory? ISTM that the problem could be solved by a cleaner configuration here. |
|
It does feel like cibuildwheels is at fault here - if it's repeatedly building wheels it should have a clean slate for each iteration. This is exactly why pep517 needs first-class support for out-of-tree builds... |
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/