pypy3{8,9}: fix sitePackages
When PyPy introduced Python 3.8 support with version 7.3.6, they also
migrated to using CPython's directory layout [0]:
> The 3.8 package now uses the same layout as CPython, and many of the
PyPy-specific changes to `sysconfig`, `distutils.sysconfig`, and
`distutils.commands.install.py` have been removed. The stdlib now is
located in `<base>/lib/pypy3.8` on `posix` systems...
When we upgraded past this version and added Python 3.8 support [1], the
`sitePackages` value was never updated, leading `bootstrapped-pip` to fail
to build, because wheel was trying to be located in `$out/site-packages`,
when it was actually installed to `$out/lib/pypy3.8/site-packages`.
[0]: https://www.pypy.org/posts/2021/10/pypy-v736-release.html
[1]: eec28b8cfd
This commit is contained in:
@@ -21,13 +21,14 @@ assert zlibSupport -> zlib != null;
|
||||
|
||||
let
|
||||
isPy3k = (lib.versions.major pythonVersion) == "3";
|
||||
isPy38OrNewer = lib.versionAtLeast pythonVersion "3.8";
|
||||
isPy39OrNewer = lib.versionAtLeast pythonVersion "3.9";
|
||||
passthru = passthruFun {
|
||||
passthru = passthruFun rec {
|
||||
inherit self sourceVersion pythonVersion packageOverrides;
|
||||
implementation = "pypy";
|
||||
libPrefix = "pypy${pythonVersion}";
|
||||
executable = "pypy${if isPy39OrNewer then lib.versions.majorMinor pythonVersion else lib.optionalString isPy3k "3"}";
|
||||
sitePackages = "site-packages";
|
||||
sitePackages = "${lib.optionalString isPy38OrNewer "lib/${libPrefix}/"}site-packages";
|
||||
hasDistutilsCxxPatch = false;
|
||||
inherit pythonAttr;
|
||||
|
||||
@@ -122,7 +123,7 @@ in with passthru; stdenv.mkDerivation rec {
|
||||
ln -s $out/${executable}-c/lib-python/${if isPy3k then "3" else pythonVersion} $out/lib/${libPrefix}
|
||||
|
||||
# Include a sitecustomize.py file
|
||||
cp ${../sitecustomize.py} $out/lib/${libPrefix}/${sitePackages}/sitecustomize.py
|
||||
cp ${../sitecustomize.py} $out/${if isPy38OrNewer then sitePackages else "lib/${libPrefix}/${sitePackages}"}/sitecustomize.py
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user