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
Python: merge expressions of interpreters #53123
Conversation
889b1c8
to
7e13a16
Compare
e09dcd7
to
baf965e
Compare
5fa8ca8
to
4a8932b
Compare
I will have a look at cross-compiling once the conflict is resolved. |
@Mic92 not sure whether to trust this function:
|
92428dc
to
9aed1fb
Compare
@FRidh what's wrong with the output? Afaik we build with gcc for musl. |
pkgs/development/interpreters/python/build-python-package-setuptools.nix
Outdated
Show resolved
Hide resolved
yes, I mixed host and build up when I wrote that. |
pkgs/development/interpreters/python/build-python-package-setuptools.nix
Outdated
Show resolved
Hide resolved
Very glad this is happening! I started something like the once, but it appears I lost it haha. |
999bbb6
to
f82cc80
Compare
e4eca87
to
99faaf7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking really good!
@@ -10,7 +9,7 @@ | |||
, ... } @ attrs: | |||
|
|||
attrs // { | |||
buildInputs = buildInputs ++ [ bootstrapped-pip ]; | |||
buildInputs = buildInputs ++ [ python.pythonForBuild.pkgs.bootstrapped-pip ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bootstrapped pip is used at build time and so should be a nativeBuildInput
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, since you use it explicitly below, maybe it doesn't need to be any sort of imput.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I don't think we actually need it as a build input. We call it already from the store path, and Python packages should never call or import from pip. Doesn't mean they won't do it though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we do need it as *buildInput
. While it is indeed supposed to be nativeBuildInput
, putting it there breaks cross-compilation for me, likely because at the moment something wrong is happening yet it looks alright. I'll keep this issue for another day.
@@ -24,7 +23,7 @@ attrs // { | |||
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" | |||
|
|||
pushd dist | |||
${bootstrapped-pip}/bin/pip install *.whl --no-index --prefix=$out --no-cache ${toString installFlags} --build tmpbuild | |||
${python.pythonForBuild.pkgs.bootstrapped-pip}/bin/pip install *.whl --no-index --prefix=$out --no-cache ${toString installFlags} --build tmpbuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B. this is fine, but won't need it once bootstrapped-pip
is a nativeBuildInput
.
pushd $out | ||
ls -l . | ||
find {lib,lib_pypy*} -name "*.so" -exec patchelf --replace-needed "libbz2.so.1.0" "libbz2.so.1" {} \; | ||
find {lib,lib_pypy*} -name "*.so" -exec patchelf --set-rpath ${stdenv.lib.makeLibraryPath deps} {} \; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In future autoPatchelfHook
could make this process easier and less error-prone.
Each time a new major/minor version of CPython was released, a new expression would be written, typically copied from the previous release. Often fixes are only made in the current/latest release. By merging the expressions it's more likely that modifications end up in all versions, as is likely intended. This commit introduces one expression for Python 3, and another for 2.7. These two may also be merged, but it will result in a lot of extra conditionals making the expression harder to follow. A common passthru is introduced for CPython and PyPy. python 2.7: use common passthru
This commit merges the two expressions in a single one, using the passthru function that is shared with CPython.
This changeset allows for cross-compilation of Python packages. Packages built with buildPythonPackage are not allowed to refer to the build machine. Executables that have shebangs will refer to the host.
Drop `python.majorVersion`. For Python language version, use `python.pythonVersion`. For implementation version, use `python.sourceVersion`. Some expressions were broken. Those that were identified were fixed. fixup major
These interpreters are prebuilt by upstream and patched using patchelf. They are primarily added for testing purposes and development on the non-prebuilt PyPy interpreters as it can speed up translation significantly.
python.majorVersion
attributeThings done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)