summaryrefslogtreecommitdiffstats
path: root/pkgs/development/interpreters/python/pypy/default.nix
diff options
context:
space:
mode:
authorColin Putney <colin.putney@vannevarlabs.com>2024-03-21 19:22:03 -0600
committerColin Putney <colin.putney@vannevarlabs.com>2024-03-21 19:26:57 -0600
commit234bb31f611f43f8b744b305ab82035de637aaca (patch)
treeb42bfbe7bbd4e1f1d605d729415890e8e0d86ce8 /pkgs/development/interpreters/python/pypy/default.nix
parentb727e4cb210367459e4299f8521d9c781fe70fc5 (diff)
Fix venv creation in Python environments
The way we build python environments is subtly broken. A python environment should be semantically identical to a vanilla Python installation in, say, /usr/local. The current implementation, however, differs in two important ways. The first is that it's impossible to use python packages from the environment in python virtual environments. The second is that the nix-generated environment appears to be a venv, but it's not. This commit changes the way python environments are built: * When generating wrappers for python executables, we inherit argv[0] from the wrapper. This causes python to initialize its configuration in the environment with all the correct paths. * We remove the sitecustomize.py file from the base python package. This file was used tweak the python configuration after it was incorrectly initialized. That's no longer necessary. The end result is that python environments no longer appear to be venvs, and behave more like a vanilla python installation. In addition it's possible to create a venv using an environment and use packages from both the environment and the venv.
Diffstat (limited to 'pkgs/development/interpreters/python/pypy/default.nix')
-rw-r--r--pkgs/development/interpreters/python/pypy/default.nix3
1 files changed, 0 insertions, 3 deletions
diff --git a/pkgs/development/interpreters/python/pypy/default.nix b/pkgs/development/interpreters/python/pypy/default.nix
index c64c65df350e..c11ca7330c2c 100644
--- a/pkgs/development/interpreters/python/pypy/default.nix
+++ b/pkgs/development/interpreters/python/pypy/default.nix
@@ -126,9 +126,6 @@ in with passthru; stdenv.mkDerivation rec {
ln -s $out/${executable}-c/include $out/include/${libPrefix}
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/${if isPy38OrNewer then sitePackages else "lib/${libPrefix}/${sitePackages}"}/sitecustomize.py
-
runHook postInstall
'';