Imported Upstream version 49.2.0 upstream/49.2.0
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 29 Dec 2020 22:07:27 +0000 (07:07 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 29 Dec 2020 22:07:27 +0000 (07:07 +0900)
.bumpversion.cfg
.github/workflows/python-tests.yml
CHANGES.rst
conftest.py
setup.cfg
setuptools/distutils_patch.py
tox.ini

index 5e4d74b0509faa584e855628443696b24468738a..9b3e408589736dfe22fbd066f23f14b401ccfa07 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 49.1.3
+current_version = 49.2.0
 commit = True
 tag = True
 
index 5a5980842cf7de487659fe4f8285292a4752e6fe..f2188d38da1637d5318d4ea9df57e99fe591771f 100644 (file)
@@ -30,6 +30,9 @@ jobs:
         - macOS-latest
         # - windows-2019
         # - windows-2016
+        include:
+        # Dev versions
+        - { python-version: 3.9-dev, os: ubuntu-20.04 }
 
     env:
       NETWORK_REQUIRED: 1
@@ -38,8 +41,14 @@ jobs:
 
     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
index b23bc3948f47da1a48ef4f84afdf731440cccfd0..82e6ef66d37130c105c600ed62e94444e9c2fb35 100644 (file)
@@ -1,3 +1,9 @@
+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
 -------
 
index 50cc650957e91dc840a928ea1ca68d9a7e804a83..6013e1870f665e7a0b49868c91c0decfb8d0c770 100644 (file)
@@ -19,6 +19,24 @@ collect_ignore = [
 ]
 
 
+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')
index bad15f93e6e28bdd428d040bf4645d4212b8a4d4..fa0e565646016166d522020ce007f3117e2b4718 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -16,7 +16,7 @@ formats = zip
 
 [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
index c5f273dd4d5c4ab80aeb7704820e7b2abb69623d..33f1e7f961485586e3605a90d2dabcb173f6f8c6 100644 (file)
@@ -12,10 +12,26 @@ import importlib
 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]
@@ -40,5 +56,6 @@ def ensure_local_distutils():
     assert '_distutils' in core.__file__, core.__file__
 
 
+warn_distutils_present()
 if enabled():
     ensure_local_distutils()
diff --git a/tox.ini b/tox.ini
index 5ae7b660aa210ba328f005aa22f8bc103e719ff1..557c8d5acdb6c2339a8e5110bd8d0f92831af39f 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -27,10 +27,6 @@ extras =
        tests
 
 
-[testenv:pypy{,3}]
-commands = pytest --no-cov {posargs}
-
-
 [testenv:coverage]
 description=Combine coverage data and create report
 deps=coverage