Repository navigation
fix: honor CC/AR and handle missing toolchain when building from sdist - #266
Merged
Merged
Conversation
setup.py took the compiler and archiver straight from Python's sysconfig. On a cross-compiled Python (e.g. SynoCommunity's) that is the build machine's toolchain, which doesn't exist where pip runs, and there was no way to override it (#263). Use the CC/AR environment variables first, skip a sysconfig tool that isn't runnable, and fail with a clear message if no toolchain is found. Also don't crash in the version lookup when git isn't installed.
- Resolve the compiler whenever a build command runs, not only when the C objects are missing, so a re-run with the objects already present still gets a working compiler exported for setuptools. - Only look up ar when libquickjs.a actually has to be created. - Don't raise IndexError on a whitespace-only CC/AR.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes the source-build half of #263.
Problem
build_c_objects()insrc/pymod/setup.pytook the compiler and archiver straight from Python'ssysconfig. On a cross-compiled Python (the reporter uses SynoCommunity'spython314), that is the build machine's toolchain, which doesn't exist where pip runs. The build died with a rawFileNotFoundErrorfor/github/workspace/toolchain/.../x86_64-pc-linux-gnu-gcc, and settingCCdidn't help because it was ignored.Changes
CC/ARfrom the environment are used first.sysconfigtool that isn't runnable is skipped in favour ofcc/ar. The fallback is exported to the environment so setuptools compiles and links the extension with the same tool.gitisn't installed (found while testing; it rangit rev-parseunguarded).Testing
Built an sdist and ran
pip wheelon it withsysconfigpatched (viasitecustomize) to the reporter's compiler path:FileNotFoundErroras #263ccon PATHcc; wheel imports andfind_proxyworksCC=gcc AR=arCC=/nonexistent/gccCC is set to '/nonexistent/gcc', but '/nonexistent/gcc' was not found.Building pacparser from source needs a C toolchain, but ... was not found.giton PATHNO_INTERNET=1 make -C src pymodandtests/test_sdist_metadata.pypass. Not tested on an actual Synology box.