Skip to content

Commit

Permalink
Fix building Ansible dist w/ setuptools>=48,<49.1 (ansible#70525)
Browse files Browse the repository at this point in the history
* 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:
* ansible#70456
* pypa/setuptools#2230
* pypa/setuptools@bd110264

Co-Authored-By: Jason R. Coombs <jaraco@jaraco.com>

* Add a change note for PR ansible#70525

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
  • Loading branch information
webknjaz and jaraco committed Jul 13, 2020
1 parent 20209c5 commit 918388b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions 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)
11 changes: 9 additions & 2 deletions setup.py
Expand Up @@ -9,8 +9,6 @@
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
Expand All @@ -23,6 +21,15 @@
" 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__

Expand Down

0 comments on commit 918388b

Please sign in to comment.