summaryrefslogtreecommitdiff
path: root/setuptools/_distutils/command/py37compat.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-09-01 21:44:54 -0400
committerJason R. Coombs <jaraco@jaraco.com>2020-09-01 21:44:54 -0400
commit99fb821deed4592ad34897530a5a666a249aa583 (patch)
treee76c977e78cbc97530396be5c1b95b43473b7e21 /setuptools/_distutils/command/py37compat.py
parent608988196d608f913398fc8853cfb797d2a1b63d (diff)
parent526b7fe0cf4e6c96176ffd6eaf286b758239ed45 (diff)
downloadpython-setuptools-git-99fb821deed4592ad34897530a5a666a249aa583.tar.gz
Merge https://github.com/pypa/distutils into master
Diffstat (limited to 'setuptools/_distutils/command/py37compat.py')
-rw-r--r--setuptools/_distutils/command/py37compat.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/setuptools/_distutils/command/py37compat.py b/setuptools/_distutils/command/py37compat.py
new file mode 100644
index 00000000..754715a5
--- /dev/null
+++ b/setuptools/_distutils/command/py37compat.py
@@ -0,0 +1,30 @@
+import sys
+
+
+def _pythonlib_compat():
+ """
+ On Python 3.7 and earlier, distutils would include the Python
+ library. See pypa/distutils#9.
+ """
+ from distutils import sysconfig
+ if not sysconfig.get_config_var('Py_ENABLED_SHARED'):
+ return
+
+ yield 'python{}.{}{}'.format(
+ sys.hexversion >> 24,
+ (sys.hexversion >> 16) & 0xff,
+ sysconfig.get_config_var('ABIFLAGS'),
+ )
+
+
+def compose(f1, f2):
+ return lambda *args, **kwargs: f1(f2(*args, **kwargs))
+
+
+pythonlib = (
+ compose(list, _pythonlib_compat)
+ if sys.version_info < (3, 8)
+ and sys.platform != 'darwin'
+ and sys.platform[:3] != 'aix'
+ else list
+)