-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build.hooks.pyprojectHook: Revert to using pypa/installer for cross i…
…nstalls Uv's internal interpreter discovery doesn't work for cross compiled environments and detects the wrong arch glibc. We can work around this issue by using pypa/installer for cross compiled builds, but still use uv for native.
- Loading branch information
1 parent
a3d6336
commit a73f903
Showing
4 changed files
with
102 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
26 changes: 26 additions & 0 deletions
26
build/hooks/pypa-install-hook/pyproject-pypa-install-hook.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Setup hook for Pyproject installer. | ||
echo "Sourcing pyproject-pypa-install-hook" | ||
|
||
pyprojectPypaInstallPhase() { | ||
echo "Executing pyprojectPypaInstallPhase" | ||
runHook preInstall | ||
|
||
pushd dist >/dev/null | ||
|
||
for wheel in *.whl; do | ||
env PYTHONPATH=$PYTHONPATH:@installer@/@pythonSitePackages@ @pythonInterpreter@ @wrapper@ --prefix "$out" "$wheel" | ||
echo "Successfully installed $wheel" | ||
done | ||
|
||
rm -f "$out/.lock" | ||
|
||
popd >/dev/null | ||
|
||
runHook postInstall | ||
echo "Finished executing pyprojectPypaInstallPhase" | ||
} | ||
|
||
if [ -z "${dontUsePyprojectInstall-}" ] && [ -z "${installPhase-}" ]; then | ||
echo "Using pyprojectPypaInstallPhase" | ||
installPhase=pyprojectPypaInstallPhase | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import sys | ||
|
||
|
||
def main(): | ||
""" | ||
Provides compatibility with uv env vars when using pypa/installer. | ||
Ideally uv should also be used for cross installs, but for now it's not compatible. | ||
""" | ||
compile_bytecode = bool(os.environ.get("UV_COMPILE_BYTECODE", False)) | ||
|
||
args = sys.argv[1:] | ||
if compile_bytecode: | ||
args.insert(0, "1") | ||
args.insert(0, "--compile-bytecode") | ||
|
||
os.execv(sys.executable, [sys.executable, "-m", "installer", *args]) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |