diff options
| author | Bernát Gábor <bgabor8@bloomberg.net> | 2020-03-19 18:58:59 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-19 18:58:59 +0000 |
| commit | 496ed8ca4f24dc7ca17aff3a5f98f428e5b320bf (patch) | |
| tree | 8e11f044e3da9bf3e190e10f8c4e7c4abc9fadd9 /src/virtualenv/discovery | |
| parent | 18987da8ed504cf85deb3ab2cbe94fc73bb55f56 (diff) | |
| download | virtualenv-496ed8ca4f24dc7ca17aff3a5f98f428e5b320bf.tar.gz | |
Support as fallback distutils pattern for include over sysconfig (#1742)
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
Diffstat (limited to 'src/virtualenv/discovery')
| -rw-r--r-- | src/virtualenv/discovery/py_info.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py index 9a612fe..903ad7d 100644 --- a/src/virtualenv/discovery/py_info.py +++ b/src/virtualenv/discovery/py_info.py @@ -159,10 +159,16 @@ class PythonInfo(object): @property def system_include(self): - return self.sysconfig_path( + path = self.sysconfig_path( "include", {k: (self.system_prefix if v.startswith(self.prefix) else v) for k, v in self.sysconfig_vars.items()}, ) + if not os.path.exists(path): # some broken packaging don't respect the sysconfig, fallback to distutils path + # the pattern include the distribution name too at the end, remove that via the parent call + fallback = os.path.join(self.prefix, os.path.dirname(self.distutils_install["headers"])) + if os.path.exists(fallback): + path = fallback + return path @property def system_prefix(self): |
