linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / python-modules / virtualenv / 0001-Check-base_prefix-and-base_exec_prefix-for-Python-2.patch
blob2b34da289e2dbd4b0c1a8cec0cdffdda3099df13
1 From 21563405d6e2348ee457187f7fb61beb102bb367 Mon Sep 17 00:00:00 2001
2 From: Frederik Rietdijk <fridh@fridh.nl>
3 Date: Sun, 24 May 2020 09:33:13 +0200
4 Subject: [PATCH] Check base_prefix and base_exec_prefix for Python 2
6 This is a Nixpkgs-specific change so it can support virtualenvs from Nix envs.
7 ---
8 src/virtualenv/discovery/py_info.py | 8 ++++++--
9 1 file changed, 6 insertions(+), 2 deletions(-)
11 diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py
12 index 6f12128..74e9218 100644
13 --- a/src/virtualenv/discovery/py_info.py
14 +++ b/src/virtualenv/discovery/py_info.py
15 @@ -51,13 +51,17 @@ class PythonInfo(object):
16 self.version = u(sys.version)
17 self.os = u(os.name)
19 + config_vars = {} if sys.version_info.major is not 2 else sysconfig._CONFIG_VARS
20 + base_prefix = config_vars.get("prefix")
21 + base_exec_prefix = config_vars.get("exec_prefix")
23 # information about the prefix - determines python home
24 self.prefix = u(abs_path(getattr(sys, "prefix", None))) # prefix we think
25 - self.base_prefix = u(abs_path(getattr(sys, "base_prefix", None))) # venv
26 + self.base_prefix = u(abs_path(getattr(sys, "base_prefix", base_prefix))) # venv
27 self.real_prefix = u(abs_path(getattr(sys, "real_prefix", None))) # old virtualenv
29 # information about the exec prefix - dynamic stdlib modules
30 - self.base_exec_prefix = u(abs_path(getattr(sys, "base_exec_prefix", None)))
31 + self.base_exec_prefix = u(abs_path(getattr(sys, "base_exec_prefix", base_exec_prefix)))
32 self.exec_prefix = u(abs_path(getattr(sys, "exec_prefix", None)))
34 self.executable = u(abs_path(sys.executable)) # the executable we were invoked via
35 --
36 2.25.1