Skip to content

Commit 918388b

Browse files
webknjazjaraco
andauthored
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: * #70456 * pypa/setuptools#2230 * pypa/setuptools@bd110264 Co-Authored-By: Jason R. Coombs <[email protected]> * Add a change note for PR #70525 Co-authored-by: Jason R. Coombs <[email protected]>
1 parent 20209c5 commit 918388b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
bugfixes:
2+
- >
3+
Address the deprecation of the use of stdlib
4+
distutils in packaging. It's a short-term hotfix for the problem
5+
(https://github.com/ansible/ansible/issues/70456,
6+
https://github.com/pypa/setuptools/issues/2230,
7+
https://github.com/pypa/setuptools/commit/bd110264)

setup.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import warnings
1010

1111
from collections import defaultdict
12-
from distutils.command.build_scripts import build_scripts as BuildScripts
13-
from distutils.command.sdist import sdist as SDist
1412

1513
try:
1614
from setuptools import setup, find_packages
@@ -23,6 +21,15 @@
2321
" install setuptools).", file=sys.stderr)
2422
sys.exit(1)
2523

24+
# `distutils` must be imported after `setuptools` or it will cause explosions
25+
# with `setuptools >=48.0.0, <49.1`.
26+
# Refs:
27+
# * https://github.com/ansible/ansible/issues/70456
28+
# * https://github.com/pypa/setuptools/issues/2230
29+
# * https://github.com/pypa/setuptools/commit/bd110264
30+
from distutils.command.build_scripts import build_scripts as BuildScripts
31+
from distutils.command.sdist import sdist as SDist
32+
2633
sys.path.insert(0, os.path.abspath('lib'))
2734
from ansible.release import __version__, __author__
2835

0 commit comments

Comments
 (0)