Skip to content

Commit

Permalink
Fix building Ansible dist w/ setuptools>=48,<49.1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
webknjaz committed Jul 8, 2020
1 parent 7525503 commit ccee175
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
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 ccee175

Please sign in to comment.