summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2021-06-29 23:01:15 +0200
committerGitHub <noreply@github.com>2021-06-29 23:01:15 +0200
commit1c5a86776c6e1865783e35cefc57fbd9a7b7bc06 (patch)
treec26d0a3cc860fb5fe4920e12c442c76d385d20e7
parentfc76765e6eeb3e56e14ae54b003ce64f422f7b84 (diff)
parent4fa69858d951409426c5b080fbdaf342fe790877 (diff)
downloadnixpkgs-1c5a86776c6e1865783e35cefc57fbd9a7b7bc06.tar
nixpkgs-1c5a86776c6e1865783e35cefc57fbd9a7b7bc06.tar.gz
nixpkgs-1c5a86776c6e1865783e35cefc57fbd9a7b7bc06.tar.bz2
nixpkgs-1c5a86776c6e1865783e35cefc57fbd9a7b7bc06.tar.lz
nixpkgs-1c5a86776c6e1865783e35cefc57fbd9a7b7bc06.tar.xz
nixpkgs-1c5a86776c6e1865783e35cefc57fbd9a7b7bc06.tar.zst
nixpkgs-1c5a86776c6e1865783e35cefc57fbd9a7b7bc06.zip
Merge pull request #128471 from mweinelt/cpython-venv-permissions
cpython: fix permissions on venv activation scripts
-rw-r--r--pkgs/development/interpreters/python/cpython/default.nix4
-rw-r--r--pkgs/development/interpreters/python/cpython/virtualenv-permissions.patch13
2 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix
index b8132cea4fc..6abdd3f2cc8 100644
--- a/pkgs/development/interpreters/python/cpython/default.nix
+++ b/pkgs/development/interpreters/python/cpython/default.nix
@@ -190,6 +190,10 @@ in with passthru; stdenv.mkDerivation {
     # (since it will do a futile invocation of gcc (!) to find
     # libuuid, slowing down program startup a lot).
     (./. + "/${sourceVersion.major}.${sourceVersion.minor}/no-ldconfig.patch")
+    # Make sure that the virtualenv activation scripts are
+    # owner-writable, so venvs can be recreated without permission
+    # errors.
+    ./virtualenv-permissions.patch
   ] ++ optionals mimetypesSupport [
     # Make the mimetypes module refer to the right file
     ./mimetypes.patch
diff --git a/pkgs/development/interpreters/python/cpython/virtualenv-permissions.patch b/pkgs/development/interpreters/python/cpython/virtualenv-permissions.patch
new file mode 100644
index 00000000000..c686f21bfbb
--- /dev/null
+++ b/pkgs/development/interpreters/python/cpython/virtualenv-permissions.patch
@@ -0,0 +1,13 @@
+diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
+index caa7285..ad666ac 100644
+--- a/Lib/venv/__init__.py
++++ b/Lib/venv/__init__.py
+@@ -379,7 +379,7 @@ class EnvBuilder:
+                 if data is not None:
+                     with open(dstfile, 'wb') as f:
+                         f.write(data)
+-                    shutil.copymode(srcfile, dstfile)
++                    os.chmod(dstfile, 0o644)
+ 
+ 
+ def create(env_dir, system_site_packages=False, clear=False,