diff options
author | Sviatoslav Sydorenko <webknjaz@redhat.com> | 2020-07-13 23:16:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-13 17:16:26 -0400 |
commit | 918388b85f516116e2cd7dcf0c12eeb19ab561e9 (patch) | |
tree | 24ee763edc43be03a9fb32a8dc1e10edd62da6bc | |
parent | 20209c508f13b018b8f44f77749001979aa5f048 (diff) | |
download | ansible-918388b85f516116e2cd7dcf0c12eeb19ab561e9.tar.gz |
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>
-rw-r--r-- | changelogs/fragments/70525-setuptools-disutils-reorder.yml | 7 | ||||
-rw-r--r-- | setup.py | 11 |
2 files changed, 16 insertions, 2 deletions
diff --git a/changelogs/fragments/70525-setuptools-disutils-reorder.yml b/changelogs/fragments/70525-setuptools-disutils-reorder.yml new file mode 100644 index 0000000000..756cf13bc7 --- /dev/null +++ b/changelogs/fragments/70525-setuptools-disutils-reorder.yml @@ -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) @@ -9,8 +9,6 @@ import sys import warnings from collections import defaultdict -from distutils.command.build_scripts import build_scripts as BuildScripts -from distutils.command.sdist import sdist as SDist try: from setuptools import setup, find_packages @@ -23,6 +21,15 @@ except ImportError: " install setuptools).", file=sys.stderr) 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')) from ansible.release import __version__, __author__ |