Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use setuptools over setuptools._distutils.core #1843

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 8 additions & 16 deletions bindings/python/setup.py.in
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
from __future__ import print_function

# setuptools._distutils added in setuptools v48.0.0
# c.f. https://setuptools.pypa.io/en/latest/history.html#v48-0-0
try:
from setuptools._distutils.core import setup, Extension
# sysconfig v48.0.0+ is incompatible for Python 3.6 only, so fall back to distutils.
# Instead of checking setuptools.__version__ explicitly, use the knowledge that
# to get here in the 'try' block requires setuptools v48.0.0+.
# FIXME: When support for Python 3.6 is dropped simplify this
import sys

if sys.version_info < (3, 7):
from distutils import sysconfig
else:
import sysconfig
except ImportError:
from distutils.core import setup, Extension
from setuptools import setup, Extension
# sysconfig with setuptools v48.0.0+ is incompatible for Python 3.6 only, so fall back to distutils.
# FIXME: When support for Python 3.6 is dropped simplify this
import sys

if sys.version_info < (3, 7):
from distutils import sysconfig
else:
import sysconfig

from os import getenv, walk, path
import subprocess
Expand Down