[bumpversion]
-current_version = 49.1.3
+current_version = 49.2.0
commit = True
tag = True
- macOS-latest
# - windows-2019
# - windows-2016
+ include:
+ # Dev versions
+ - { python-version: 3.9-dev, os: ubuntu-20.04 }
env:
NETWORK_REQUIRED: 1
steps:
- uses: actions/checkout@master
+ - name: Set up Python ${{ matrix.python-version }} (deadsnakes)
+ uses: deadsnakes/action@v1.0.0
+ if: endsWith(matrix.python-version, '-dev')
+ with:
+ python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1.1.1
+ if: "!endsWith(matrix.python-version, '-dev')"
with:
python-version: ${{ matrix.python-version }}
- name: Log Python version
+v49.2.0
+-------
+
+* #2230: Now warn the user when setuptools is imported after distutils modules have been loaded (exempting PyPy for 3.6), directing the users of packages to import setuptools first.
+
+
v49.1.3
-------
]
+def pytest_configure(config):
+ disable_coverage_on_pypy(config)
+
+
+def disable_coverage_on_pypy(config):
+ """
+ Coverage makes tests on PyPy unbearably slow, so disable it.
+ """
+ if '__pypy__' not in sys.builtin_module_names:
+ return
+
+ # Recommended at pytest-dev/pytest-cov#418
+ cov = config.pluginmanager.get_plugin('_cov')
+ cov.options.no_cov = True
+ if cov.cov_controller:
+ cov.cov_controller.pause()
+
+
if sys.version_info < (3,):
collect_ignore.append('setuptools/lib2to3_ex.py')
collect_ignore.append('setuptools/_imp.py')
[metadata]
name = setuptools
-version = 49.1.3
+version = 49.2.0
description = Easily download, build, install, upgrade, and uninstall Python packages
author = Python Packaging Authority
author_email = distutils-sig@python.org
import warnings
+is_pypy = '__pypy__' in sys.builtin_module_names
+
+
+def warn_distutils_present():
+ if 'distutils' not in sys.modules:
+ return
+ if is_pypy and sys.version_info < (3, 7):
+ # PyPy for 3.6 unconditionally imports distutils, so bypass the warning
+ # https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250
+ return
+ warnings.warn(
+ "Distutils was imported before Setuptools. This usage is discouraged "
+ "and may exhibit undesirable behaviors or errors. Please use "
+ "Setuptools' objects directly or at least import Setuptools first.")
+
+
def clear_distutils():
if 'distutils' not in sys.modules:
return
- warnings.warn("Setuptools is replacing distutils")
+ warnings.warn("Setuptools is replacing distutils.")
mods = [name for name in sys.modules if re.match(r'distutils\b', name)]
for name in mods:
del sys.modules[name]
assert '_distutils' in core.__file__, core.__file__
+warn_distutils_present()
if enabled():
ensure_local_distutils()
tests
-[testenv:pypy{,3}]
-commands = pytest --no-cov {posargs}
-
-
[testenv:coverage]
description=Combine coverage data and create report
deps=coverage