diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2023-02-06 10:06:19 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2023-02-06 10:41:44 -0500 |
| commit | ff9b6d17bf00f00e4a784ac4d6d33ffcc9dcbd3d (patch) | |
| tree | 88afd197c4af2f0874f9765c80a475fce4804d2c | |
| parent | 3e9d47e0f631a92cc0251ac212a14cad9570f76b (diff) | |
| download | python-setuptools-git-ff9b6d17bf00f00e4a784ac4d6d33ffcc9dcbd3d.tar.gz | |
In _get_python_inc_posix, only return an extant path from the sysconfig. Fixes pypa/distutils#178.
| -rw-r--r-- | distutils/sysconfig.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py index 0ec69366..277f2ea8 100644 --- a/distutils/sysconfig.py +++ b/distutils/sysconfig.py @@ -130,12 +130,20 @@ def get_python_inc(plat_specific=0, prefix=None): return getter(resolved_prefix, prefix, plat_specific) +@pass_none +def _extant(path): + """ + Replace path with None if it doesn't exist. + """ + return path if os.path.exists(path) else None + + def _get_python_inc_posix(prefix, spec_prefix, plat_specific): if IS_PYPY and sys.version_info < (3, 8): return os.path.join(prefix, 'include') return ( _get_python_inc_posix_python(plat_specific) - or _get_python_inc_from_config(plat_specific, spec_prefix) + or _extant(_get_python_inc_from_config(plat_specific, spec_prefix)) or _get_python_inc_posix_prefix(prefix) ) |
