Skip to content

Commit

Permalink
Use distutils provided by setuptools
Browse files Browse the repository at this point in the history
The distutils module provided by the stdlib has been deprecated in
Python 3.10. This PR sets an env var that is read by setuptools which
will shim its vendored copy of distutils if present avoiding a failure
once distutils is removed from the stdlib.

Signed-off-by: Jordan Borean <jborean93@gmail.com>
  • Loading branch information
jborean93 committed Oct 5, 2021
1 parent 2bde020 commit fb1f1ac
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function

from setuptools import setup
from setuptools import Distribution
from setuptools.command.sdist import sdist
from setuptools.extension import Extension
import subprocess
import platform
import re
Expand All @@ -13,6 +9,17 @@
import shutil
import shlex

# Enables the vendored distutils in setuptools over the stdlib one to avoid
# the deprecation warning. Must be done before importing setuptools,
# setuptools also must be imported before distutils.
# https://github.com/pypa/setuptools/blob/main/docs/deprecated/distutils-legacy.rst
os.environ['SETUPTOOLS_USE_DISTUTILS'] = 'local'

from setuptools import setup # noqa: E402
from setuptools import Distribution # noqa: E402
from setuptools.command.sdist import sdist # noqa: E402
from setuptools.extension import Extension # noqa: E402


SKIP_CYTHON_FILE = '__dont_use_cython__.txt'

Expand Down

0 comments on commit fb1f1ac

Please sign in to comment.