Fix building Ansible dist w/ setuptools>=48,<49.1 (#70525)
* Fix building Ansible dist w/ setuptools>=48,<49.1 This change addresses the deprecation of the use of stdlib `distutils`. It's a short-term hotfix for the problem and we'll need to consider dropping the use of `distutils` from our `setup.py`. Refs: * https://github.com/ansible/ansible/issues/70456 * https://github.com/pypa/setuptools/issues/2230 * https://github.com/pypa/setuptools/commit/bd110264 Co-Authored-By: Jason R. Coombs <jaraco@jaraco.com> * Add a change note for PR #70525 Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
This commit is contained in:
parent
20209c508f
commit
918388b85f
2 changed files with 16 additions and 2 deletions
|
@ -0,0 +1,7 @@
|
||||||
|
bugfixes:
|
||||||
|
- >
|
||||||
|
Address the deprecation of the use of stdlib
|
||||||
|
distutils in packaging. It's a short-term hotfix for the problem
|
||||||
|
(https://github.com/ansible/ansible/issues/70456,
|
||||||
|
https://github.com/pypa/setuptools/issues/2230,
|
||||||
|
https://github.com/pypa/setuptools/commit/bd110264)
|
11
setup.py
11
setup.py
|
@ -9,8 +9,6 @@ import sys
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from distutils.command.build_scripts import build_scripts as BuildScripts
|
|
||||||
from distutils.command.sdist import sdist as SDist
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
@ -23,6 +21,15 @@ except ImportError:
|
||||||
" install setuptools).", file=sys.stderr)
|
" install setuptools).", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# `distutils` must be imported after `setuptools` or it will cause explosions
|
||||||
|
# with `setuptools >=48.0.0, <49.1`.
|
||||||
|
# Refs:
|
||||||
|
# * https://github.com/ansible/ansible/issues/70456
|
||||||
|
# * https://github.com/pypa/setuptools/issues/2230
|
||||||
|
# * https://github.com/pypa/setuptools/commit/bd110264
|
||||||
|
from distutils.command.build_scripts import build_scripts as BuildScripts
|
||||||
|
from distutils.command.sdist import sdist as SDist
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath('lib'))
|
sys.path.insert(0, os.path.abspath('lib'))
|
||||||
from ansible.release import __version__, __author__
|
from ansible.release import __version__, __author__
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue