python.pkgs.virtualenv: rebase virtualenv-change-prefix.patch

This commit is contained in:
Robert Schütz 2018-11-04 17:15:39 +01:00 committed by Frederik Rietdijk
parent 399425b9ee
commit 4f8d1006b8

View File

@ -13,39 +13,42 @@ it will only add the path to the python used when building
available. available.
diff --git a/virtualenv.py b/virtualenv.py diff --git a/src/virtualenv.py b/src/virtualenv.py
index d3e76a7..cb307fa 100755 index 4b57cde..afda73f 100755
--- a/virtualenv.py --- a/src/virtualenv.py
+++ b/virtualenv.py +++ b/src/virtualenv.py
@@ -1051,17 +1051,7 @@ def path_locations(home_dir): @@ -1071,20 +1071,7 @@ def path_locations(home_dir, dry_run=False):
def change_prefix(filename, dst_prefix): def change_prefix(filename, dst_prefix):
- prefixes = [sys.prefix] - prefixes = [sys.prefix]
- -
- if is_darwin: - if is_darwin:
- prefixes.extend(( - prefixes.extend(
- os.path.join("/Library/Python", sys.version[:3], "site-packages"), - (
- os.path.join(sys.prefix, "Extras", "lib", "python"), - os.path.join("/Library/Python", sys.version[:3], "site-packages"),
- os.path.join("~", "Library", "Python", sys.version[:3], "site-packages"), - os.path.join(sys.prefix, "Extras", "lib", "python"),
- # Python 2.6 no-frameworks - os.path.join("~", "Library", "Python", sys.version[:3], "site-packages"),
- os.path.join("~", ".local", "lib","python", sys.version[:3], "site-packages"), - # Python 2.6 no-frameworks
- # System Python 2.7 on OSX Mountain Lion - os.path.join("~", ".local", "lib", "python", sys.version[:3], "site-packages"),
- os.path.join("~", "Library", "Python", sys.version[:3], "lib", "python", "site-packages"))) - # System Python 2.7 on OSX Mountain Lion
- os.path.join("~", "Library", "Python", sys.version[:3], "lib", "python", "site-packages"),
- )
- )
+ prefixes = ["/nix/store", sys.prefix] + prefixes = ["/nix/store", sys.prefix]
if hasattr(sys, 'real_prefix'): if hasattr(sys, "real_prefix"):
prefixes.append(sys.real_prefix) prefixes.append(sys.real_prefix)
@@ -1078,6 +1068,8 @@ def change_prefix(filename, dst_prefix): @@ -1107,6 +1094,8 @@ def change_prefix(filename, dst_prefix):
if src_prefix != os.sep: # sys.prefix == "/" if src_prefix != os.sep: # sys.prefix == "/"
assert relpath[0] == os.sep assert relpath[0] == os.sep
relpath = relpath[1:] relpath = relpath[1:]
+ if src_prefix == "/nix/store": + if src_prefix == "/nix/store":
+ relpath = "/".join(relpath.split("/")[1:]) + relpath = "/".join(relpath.split("/")[1:])
return join(dst_prefix, relpath) return join(dst_prefix, relpath)
assert False, "Filename %s does not start with any of these prefixes: %s" % \ assert False, "Filename {} does not start with any of these prefixes: {}".format(filename, prefixes)
(filename, prefixes)
@@ -1190,6 +1182,11 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy @@ -1233,6 +1222,11 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
site_filename_dst = change_prefix(site_filename, home_dir) site_filename_dst = change_prefix(site_filename, home_dir)
site_dir = os.path.dirname(site_filename_dst) site_dir = os.path.dirname(site_filename_dst)
writefile(site_filename_dst, SITE_PY) writefile(site_filename_dst, SITE_PY)
@ -54,6 +57,6 @@ index d3e76a7..cb307fa 100755
+ join(site_dir, 'sitecustomize.py',), + join(site_dir, 'sitecustomize.py',),
+ "import sys; sys.path.append('%s')" % wrapper_path + "import sys; sys.path.append('%s')" % wrapper_path
+ ) + )
writefile(join(site_dir, 'orig-prefix.txt'), prefix) writefile(join(site_dir, "orig-prefix.txt"), prefix)
site_packages_filename = join(site_dir, 'no-global-site-packages.txt') site_packages_filename = join(site_dir, "no-global-site-packages.txt")
if not site_packages: if not site_packages: