nixpkgs/pkgs/development/interpreters/python-new/2.5/nix-find-sites-2.5.patch

34 lines
1.1 KiB
Diff
Raw Normal View History

--- a/site.py 2008-11-19 14:48:49.000000000 +0100
--- Python-2.5-orig/Lib/site.py 2008-05-10 19:36:24.000000000 +0200
+++ Python-2.5/Lib/site.py 2008-11-17 05:37:02.000000000 +0100
@@ -390,6 +390,20 @@
except ImportError:
pass
+def addnixsitepackages(known_paths):
+ """
+ used to add multiple site packages for /nix/store to sys.path also
+ evaluating the .pth files (http://docs.python.org/library/site.html#module-site)
+ """
+ env_nix_sites = os.environ.get("NIX_PYTHON_SITES", None)
+ if env_nix_sites:
+ for path in env_nix_sites.split(":"):
+ if os.path.isdir(path):
+ NIX_SITE = os.path.join(path, "lib",
+ "python" + sys.version[:3],
+ "site-packages")
+ addsitedir(NIX_SITE, known_paths)
+ return known_paths
def main():
abs__file__()
@@ -400,6 +414,7 @@
paths_in_sys = addsitepackages(paths_in_sys)
if sys.platform == 'os2emx':
setBEGINLIBPATH()
+ paths_in_sys = addnixsitepackages(paths_in_sys)
setquit()
setcopyright()
sethelper()