diff --git a/pkgs/development/interpreters/python/pypy/default.nix b/pkgs/development/interpreters/python/pypy/default.nix index b7597a9925b65..79dec91f07300 100644 --- a/pkgs/development/interpreters/python/pypy/default.nix +++ b/pkgs/development/interpreters/python/pypy/default.nix @@ -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 '';