diff options
author | Nate Coraor <nate@bx.psu.edu> | 2015-09-03 23:35:53 -0400 |
---|---|---|
committer | Nate Coraor <nate@bx.psu.edu> | 2015-09-03 23:35:53 -0400 |
commit | d2f72cfbf8a89ff9df1ae65aa52c8cb868280a9d (patch) | |
tree | 584a27c83afd48933b70bc6bcd9418b4e7f8bca8 | |
parent | d3d2ce04d6fec750836cb545db173e288a79d052 (diff) | |
download | wheel-d2f72cfbf8a89ff9df1ae65aa52c8cb868280a9d.tar.gz |
Use the WITH_PYMALLOC and Py_DEBUG config vars for setting the `m` and `d` ABI
flags.
Also, catch potential exceptions with sysconfig.get_config_var as is done in
pip's copy of pep425tags.
-rw-r--r-- | wheel/pep425tags.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/wheel/pep425tags.py b/wheel/pep425tags.py index 002d7ca..5bf7c0f 100644 --- a/wheel/pep425tags.py +++ b/wheel/pep425tags.py @@ -10,6 +10,14 @@ except ImportError: # pragma nocover import distutils.util +def get_config_var(var): + try: + return sysconfig.get_config_var(var) + except IOError as e: # pip Issue #1074 + warnings.warn("{0}".format(e), RuntimeWarning) + return None + + def get_abbr_impl(): """Return abbreviated implementation name.""" if hasattr(sys, 'pypy_version_info'): @@ -25,7 +33,7 @@ def get_abbr_impl(): def get_impl_ver(): """Return implementation version.""" - impl_ver = sysconfig.get_config_var("py_version_nodot") + impl_ver = get_config_var("py_version_nodot") if not impl_ver or get_abbr_impl() == 'pp': impl_ver = ''.join(map(str, get_impl_version_info())) return impl_ver @@ -45,11 +53,11 @@ def get_impl_version_info(): def get_abi_tag(): """Return the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).""" - soabi = sysconfig.get_config_var('SOABI') + soabi = get_config_var('SOABI') impl = get_abbr_impl() if not soabi and impl in ('cp', 'pp'): - d = 'd' if hasattr(sys, 'pydebug') and sys.pydebug else '' - m = 'm' if impl == 'cp' else '' + d = 'd' if get_config_var('Py_DEBUG') else '' + m = 'm' if get_config_var('WITH_PYMALLOC') else '' u = 'u' if sys.maxunicode == 0x10ffff else '' abi = '%s%s%s%s%s' % (impl, get_impl_ver(), d, m, u) elif soabi and soabi.startswith('cpython-'): |