summary refs log tree commit diff
path: root/pkgs/development/python-modules/virtualenv-change-prefix.patch
diff options
context:
space:
mode:
authorCillian de Roiste <cillian.deroiste@gmail.com>2012-05-19 23:15:50 +0000
committerCillian de Roiste <cillian.deroiste@gmail.com>2012-05-19 23:15:50 +0000
commit531b63a3899de58473baf4656453876f10073e2d (patch)
tree02248d6106bf51037de1a8a6e410fa6f41059c17 /pkgs/development/python-modules/virtualenv-change-prefix.patch
parentee5b3c893c7a54deb0d2262475e0cf1e96ba8279 (diff)
downloadnixlib-531b63a3899de58473baf4656453876f10073e2d.tar
nixlib-531b63a3899de58473baf4656453876f10073e2d.tar.gz
nixlib-531b63a3899de58473baf4656453876f10073e2d.tar.bz2
nixlib-531b63a3899de58473baf4656453876f10073e2d.tar.lz
nixlib-531b63a3899de58473baf4656453876f10073e2d.tar.xz
nixlib-531b63a3899de58473baf4656453876f10073e2d.tar.zst
nixlib-531b63a3899de58473baf4656453876f10073e2d.zip
Patching python-virtualenv so that it doesn't fail if the python version is specified, e.g. --python=python2.7, and now iff the python version is specified it successfully also installs additional libs such as readline into the virtualenv
svn path=/nixpkgs/trunk/; revision=34184
Diffstat (limited to 'pkgs/development/python-modules/virtualenv-change-prefix.patch')
-rw-r--r--pkgs/development/python-modules/virtualenv-change-prefix.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/virtualenv-change-prefix.patch b/pkgs/development/python-modules/virtualenv-change-prefix.patch
new file mode 100644
index 000000000000..5093fdbead94
--- /dev/null
+++ b/pkgs/development/python-modules/virtualenv-change-prefix.patch
@@ -0,0 +1,29 @@
+Without this patch `virtualenv --python=python2.7 .` fails with an error because it notices that the python readline.so is not in the same path as python2.7. I assume this is to avoid copying the wrong file on systems where it is possible to find incompatible libraries by accident. Adding "/nix/store" to the prefix fixes this problem. Unfortunately readline is still not available if you just run `virtualenv .`.
+
+
+--- virtualenv-1.6.4/virtualenv.py	2012-05-20 00:40:38.070649647 +0200
++++ virtualenv-1.6.4/virtualenv.py	2012-05-20 00:45:10.596242604 +0200
+@@ -951,13 +951,7 @@
+ 
+ 
+ def change_prefix(filename, dst_prefix):
+-    prefixes = [sys.prefix]
+-
+-    if sys.platform == "darwin":
+-        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")))
++    prefixes = ["/nix/store", sys.prefix]
+ 
+     if hasattr(sys, 'real_prefix'):
+         prefixes.append(sys.real_prefix)
+@@ -968,6 +962,8 @@
+             _, relpath = filename.split(src_prefix, 1)
+             assert relpath[0] == os.sep
+             relpath = relpath[1:]
++            if src_prefix == "/nix/store":
++                relpath = "/".join(relpath.split("/")[1:])
+             return join(dst_prefix, relpath)
+     assert False, "Filename %s does not start with any of these prefixes: %s" % \
+         (filename, prefixes)