From 0039de02e84a2256d6d4763fb76836dd4748f3e4 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 12 Jul 2020 11:42:24 +0300 Subject: Test Python 3.9-dev --- .github/workflows/python-tests.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 5a598084..f2188d38 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -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 -- cgit v1.2.3 From 36df1d74933ef18a4099f4e82dbe55c00e45709e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 12 Jul 2020 11:39:51 -0400 Subject: Warn the user when distutils is present to discourage this usage and direct users to the recommended usage. Closes #2230. --- changelog.d/2230.change.rst | 1 + setuptools/distutils_patch.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 changelog.d/2230.change.rst diff --git a/changelog.d/2230.change.rst b/changelog.d/2230.change.rst new file mode 100644 index 00000000..1719f497 --- /dev/null +++ b/changelog.d/2230.change.rst @@ -0,0 +1 @@ +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. diff --git a/setuptools/distutils_patch.py b/setuptools/distutils_patch.py index c5f273dd..33f1e7f9 100644 --- a/setuptools/distutils_patch.py +++ b/setuptools/distutils_patch.py @@ -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() -- cgit v1.2.3 From 9f47efe757762351ec12b4303e747ac0774db991 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 3 Jul 2020 02:54:32 -0400 Subject: Programmatically disable coverage when running on PyPy. --- conftest.py | 18 ++++++++++++++++++ tox.ini | 4 ---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/conftest.py b/conftest.py index 1746bfb5..0bc8d320 100644 --- a/conftest.py +++ b/conftest.py @@ -17,6 +17,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') diff --git a/tox.ini b/tox.ini index 59213e88..9ce5cb5c 100644 --- a/tox.ini +++ b/tox.ini @@ -29,10 +29,6 @@ extras = tests -[testenv:pypy{,3}] -commands = pytest --no-cov {posargs} - - [testenv:coverage] description=Combine coverage data and create report deps=coverage -- cgit v1.2.3 From 37d81f4ce8f08c4baf44b6ff0f3f1bd3f6b2a127 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 12 Jul 2020 12:09:11 -0400 Subject: =?UTF-8?q?Bump=20version:=2049.1.3=20=E2=86=92=2049.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 6 ++++++ changelog.d/2230.change.rst | 1 - setup.cfg | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/2230.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 5e4d74b0..9b3e4085 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 49.1.3 +current_version = 49.2.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index b23bc394..82e6ef66 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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 ------- diff --git a/changelog.d/2230.change.rst b/changelog.d/2230.change.rst deleted file mode 100644 index 1719f497..00000000 --- a/changelog.d/2230.change.rst +++ /dev/null @@ -1 +0,0 @@ -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. diff --git a/setup.cfg b/setup.cfg index bad15f93..fa0e5656 100644 --- 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 -- cgit v1.2.3 From eb2ab6bc6e32ef48d4a286c0453c10d10d0f129b Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Mon, 13 Jul 2020 09:41:01 -0400 Subject: Remove issue templates The "setuptools warns about incompatibility" template has generated no useful reports and should be removed. --- .github/ISSUE_TEMPLATE/blank.md | 4 -- ...uptools-warns-about-python-2-incompatibility.md | 59 ---------------------- 2 files changed, 63 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/blank.md delete mode 100644 .github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md diff --git a/.github/ISSUE_TEMPLATE/blank.md b/.github/ISSUE_TEMPLATE/blank.md deleted file mode 100644 index e41fc749..00000000 --- a/.github/ISSUE_TEMPLATE/blank.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -name: Bug Report or Feature Request -about: Report a bug or request a feature ---- diff --git a/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md b/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md deleted file mode 100644 index 1a4f58f2..00000000 --- a/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -name: Setuptools warns about Python 2 incompatibility -about: Report the issue where setuptools 45 or later stops working on Python 2 -title: Incompatible install in (summarize your environment) -labels: Python 2 -assignees: '' - ---- - - - -## Prerequisites - - - -- [ ] Read [Python 2 Sunset docs](https://setuptools.readthedocs.io/en/latest/python%202%20sunset.html). -- [ ] Python 2 is required for this application. -- [ ] I maintain the software that installs Setuptools (if not, please contact that project). -- [ ] Setuptools installed with pip 9 or later. -- [ ] Pinning Setuptools to `setuptools<45` in the environment was unsuccessful. - -## Environment Details - -- Operating System and version: -- Python version: -- Python installed how: -- Virtualenv version (if using virtualenv): n/a - -Command(s) that triggered the warning/error (and output): - -``` -``` - -Command(s) used to install setuptools (and output): - -``` -``` - -Output of `pip --version` when installing setuptools: - -``` -``` - -## Other notes -- cgit v1.2.3 From 28e1b5ab2f4d573a91705cdbb025e57023d264b1 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Mon, 13 Jul 2020 11:15:26 -0400 Subject: Use .pth file to import distutils from setuptools --- MANIFEST.in | 1 + _distutils_importer/__init__.py | 6 ++++ .../distutils-shim-package/distutils/__init__.py | 3 ++ distutils_precedence.pth | 1 + setup.py | 32 ++++++++++++++++++++++ 5 files changed, 43 insertions(+) create mode 100644 _distutils_importer/__init__.py create mode 100644 _distutils_importer/distutils-shim-package/distutils/__init__.py create mode 100644 distutils_precedence.pth diff --git a/MANIFEST.in b/MANIFEST.in index 128ae280..be83a7f3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -13,4 +13,5 @@ include launcher.c include msvc-build-launcher.cmd include pytest.ini include tox.ini +include distutils_precedence.pth exclude pyproject.toml # Temporary workaround for #1644. diff --git a/_distutils_importer/__init__.py b/_distutils_importer/__init__.py new file mode 100644 index 00000000..54a825fe --- /dev/null +++ b/_distutils_importer/__init__.py @@ -0,0 +1,6 @@ +import sys + +here = os.path.dirname(__file__) +NEW_DISTUTILS_LOCATION = os.path.join(here, 'distutils-shim-package') + +sys.path.insert(0, NEW_DISTUTILS_LOCATION) diff --git a/_distutils_importer/distutils-shim-package/distutils/__init__.py b/_distutils_importer/distutils-shim-package/distutils/__init__.py new file mode 100644 index 00000000..de098c72 --- /dev/null +++ b/_distutils_importer/distutils-shim-package/distutils/__init__.py @@ -0,0 +1,3 @@ +import setuptools.distutils_patch + +from distutils import * diff --git a/distutils_precedence.pth b/distutils_precedence.pth new file mode 100644 index 00000000..2d9b996a --- /dev/null +++ b/distutils_precedence.pth @@ -0,0 +1 @@ +import os; (os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') == 'local' and __import__('_distutils_importer')) diff --git a/setup.py b/setup.py index 1fe18bd1..daab3e87 100755 --- a/setup.py +++ b/setup.py @@ -7,6 +7,7 @@ import os import sys import setuptools +from setuptools.command.install import install here = os.path.dirname(__file__) @@ -49,6 +50,7 @@ def _gen_console_scripts(): package_data = dict( setuptools=['script (dev).tmpl', 'script.tmpl', 'site-patch.py'], + _distutils_importer=['distutils-shim-package/distutils/__init__.py'], ) force_windows_specific_files = ( @@ -81,8 +83,38 @@ def pypi_link(pkg_filename): return '/'.join(parts) +class install_with_pth(install): + """ + Custom install command to install a .pth file for distutils patching. + + This is necessary because there's no standard way to install a `.pth` file + alongside your package (and there probably shouldn't be one), but we need + to do this in order to give precedence higher precedence to our version of + `distutils` than the standard library. + """ + + def initialize_options(self): + install.initialize_options(self) + + name = 'distutils_precedence' + with open(os.path.join(here, name + '.pth'), 'rt') as f: + contents = f.read() + + self.extra_path = (name, contents) + + def finalize_options(self): + install.finalize_options(self) + + install_suffix = os.path.relpath(self.install_lib, + self.install_libbase) + + if install_suffix == self.extra_path[1]: + self.install_lib = self.install_libbase + + setup_params = dict( src_root=None, + cmdclass={'install': install_with_pth}, package_data=package_data, entry_points={ "distutils.commands": [ -- cgit v1.2.3 From 03b36b5dc594bbe239d0ad66dc43ea7d1832072c Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Mon, 13 Jul 2020 12:02:41 -0400 Subject: Remove warnings With the new `.pth` file, these warnings are no longer necessary. --- setuptools/distutils_patch.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/setuptools/distutils_patch.py b/setuptools/distutils_patch.py index 33f1e7f9..d01a1a1b 100644 --- a/setuptools/distutils_patch.py +++ b/setuptools/distutils_patch.py @@ -12,26 +12,10 @@ 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.") + mods = [name for name in sys.modules if re.match(r'distutils\b', name)] for name in mods: del sys.modules[name] @@ -56,6 +40,5 @@ def ensure_local_distutils(): assert '_distutils' in core.__file__, core.__file__ -warn_distutils_present() if enabled(): ensure_local_distutils() -- cgit v1.2.3 From 89e9d3c8910c3f419eb9f1c2758a748c6938655b Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Mon, 13 Jul 2020 14:43:23 -0400 Subject: Adjust distutils shim when removing _distutils_importer --- _distutils_importer/__init__.py | 17 ++++++++++++++--- setuptools/sandbox.py | 19 ++++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/_distutils_importer/__init__.py b/_distutils_importer/__init__.py index 54a825fe..498c4ac1 100644 --- a/_distutils_importer/__init__.py +++ b/_distutils_importer/__init__.py @@ -1,6 +1,17 @@ import sys -here = os.path.dirname(__file__) -NEW_DISTUTILS_LOCATION = os.path.join(here, 'distutils-shim-package') +_HERE = os.path.dirname(__file__) +NEW_DISTUTILS_LOCATION = os.path.join(_HERE, 'distutils-shim-package') -sys.path.insert(0, NEW_DISTUTILS_LOCATION) +def add_shim(): + if NEW_DISTUTILS_LOCATION not in sys.path: + sys.path.insert(0, NEW_DISTUTILS_LOCATION) + +def remove_shim(): + try: + sys.path.remove(NEW_DISTUTILS_LOCATION) + except ValueError: + pass + + +add_shim() diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 93ae8eb4..342a713f 100644 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -185,8 +185,8 @@ def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): - hide_setuptools() with save_path(): + hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): @@ -195,6 +195,15 @@ def setup_context(setup_dir): yield +_MODULES_TO_HIDE = { + 'setuptools', + 'distutils', + 'pkg_resources', + 'Cython', + '_distutils_importer', +} + + def _needs_hiding(mod_name): """ >>> _needs_hiding('setuptools') @@ -212,8 +221,8 @@ def _needs_hiding(mod_name): >>> _needs_hiding('Cython') True """ - pattern = re.compile(r'(setuptools|pkg_resources|distutils|Cython)(\.|$)') - return bool(pattern.match(mod_name)) + base_module = mod_name.split('.', 1)[0] + return base_module in _MODULES_TO_HIDE def hide_setuptools(): @@ -223,6 +232,10 @@ def hide_setuptools(): necessary to avoid issues such as #315 where setuptools upgrading itself would fail to find a function declared in the metadata. """ + _distutils_importer = sys.modules.get('_distutils_importer', None) + if _distutils_importer is not None: + _distutils_importer.remove_shim() + modules = filter(_needs_hiding, sys.modules) _clear_modules(modules) -- cgit v1.2.3 From 642604f82c01175f2ad285800d969ff521495af0 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Mon, 13 Jul 2020 14:44:12 -0400 Subject: Clean up setuptools/__init__.py imports This puts non-distutils imports first and removes one unused import. --- setuptools/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 83882511..d9740403 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -1,17 +1,16 @@ """Extensions to the 'distutils' for large or complex distributions""" -import os +from fnmatch import fnmatchcase import functools +import os +import re # Disabled for now due to: #2228, #2230 import setuptools.distutils_patch # noqa: F401 import distutils.core -import distutils.filelist -import re from distutils.errors import DistutilsOptionError from distutils.util import convert_path -from fnmatch import fnmatchcase from ._deprecation_warning import SetuptoolsDeprecationWarning -- cgit v1.2.3 From 370839b417f6bafe783fa040646d80bdf673fac4 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Mon, 13 Jul 2020 15:25:32 -0400 Subject: Use import hook instead of sys.path manipulation --- _distutils_importer/__init__.py | 32 ++++++++++++++++++---- .../distutils-shim-package/distutils/__init__.py | 3 -- setup.py | 1 - 3 files changed, 27 insertions(+), 9 deletions(-) delete mode 100644 _distutils_importer/distutils-shim-package/distutils/__init__.py diff --git a/_distutils_importer/__init__.py b/_distutils_importer/__init__.py index 498c4ac1..323ae203 100644 --- a/_distutils_importer/__init__.py +++ b/_distutils_importer/__init__.py @@ -1,15 +1,37 @@ import sys -_HERE = os.path.dirname(__file__) -NEW_DISTUTILS_LOCATION = os.path.join(_HERE, 'distutils-shim-package') + +class DistutilsMetaFinder: + def find_spec(self, fullname, path, target=None): + if path is not None or fullname != "distutils": + return None + + return self.get_distutils_spec() + + def get_distutils_spec(self): + import importlib + + class DistutilsLoader(importlib.util.abc.Loader): + + def create_module(self, spec): + return importlib.import_module('._distutils', 'setuptools') + + def exec_module(self, module): + pass + + return importlib.util.spec_from_loader('distutils', DistutilsLoader()) + + +DISTUTILS_FINDER = DistutilsMetaFinder() + def add_shim(): - if NEW_DISTUTILS_LOCATION not in sys.path: - sys.path.insert(0, NEW_DISTUTILS_LOCATION) + sys.meta_path.insert(0, DISTUTILS_FINDER) + def remove_shim(): try: - sys.path.remove(NEW_DISTUTILS_LOCATION) + sys.path.remove(DISTUTILS_FINDER) except ValueError: pass diff --git a/_distutils_importer/distutils-shim-package/distutils/__init__.py b/_distutils_importer/distutils-shim-package/distutils/__init__.py deleted file mode 100644 index de098c72..00000000 --- a/_distutils_importer/distutils-shim-package/distutils/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -import setuptools.distutils_patch - -from distutils import * diff --git a/setup.py b/setup.py index daab3e87..cba37d3e 100755 --- a/setup.py +++ b/setup.py @@ -50,7 +50,6 @@ def _gen_console_scripts(): package_data = dict( setuptools=['script (dev).tmpl', 'script.tmpl', 'site-patch.py'], - _distutils_importer=['distutils-shim-package/distutils/__init__.py'], ) force_windows_specific_files = ( -- cgit v1.2.3 From 85a0a9026d1b40448d1757ca6cd75e5cc2c50fc6 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Mon, 13 Jul 2020 15:36:39 -0400 Subject: Revert "Remove warnings" This reverts commit 30b883f0b8071a3b1472c884574f38ce0128e457. --- setuptools/distutils_patch.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/setuptools/distutils_patch.py b/setuptools/distutils_patch.py index d01a1a1b..33f1e7f9 100644 --- a/setuptools/distutils_patch.py +++ b/setuptools/distutils_patch.py @@ -12,10 +12,26 @@ import importlib import warnings -def clear_distutils(): +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.") 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() -- cgit v1.2.3 From 48cc75e005b18549b424e4a794785c363cb1810a Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 18 Jul 2020 11:54:57 +0200 Subject: Set up GHA to test on Python 3.9-beta and 3.8-dev --- .github/workflows/python-tests.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index f2188d38..5e16ab30 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -25,14 +25,20 @@ jobs: - 3.6 - 3.5 os: - - ubuntu-latest + - ubuntu-18.04 - ubuntu-16.04 - macOS-latest # - windows-2019 # - windows-2016 include: - # Dev versions - - { python-version: 3.9-dev, os: ubuntu-20.04 } + # Pre-release versions (GH-shipped) + - os: ubuntu-20.04 + python-version: 3.9.0-beta.4 - 3.9.0 + # Dev versions (deadsnakes) + - os: ubuntu-20.04 + python-version: 3.9-dev + - os: ubuntu-20.04 + python-version: 3.8-dev env: NETWORK_REQUIRED: 1 @@ -47,7 +53,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1.1.1 + uses: actions/setup-python@v2 if: "!endsWith(matrix.python-version, '-dev')" with: python-version: ${{ matrix.python-version }} -- cgit v1.2.3 From bec11f03ab81da8af69909697925166793893e07 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 18 Jul 2020 13:46:01 -0400 Subject: Add docs on porting from distutils. --- docs/distutils-legacy.txt | 25 +++++++++++++++++++++++++ docs/index.txt | 1 + 2 files changed, 26 insertions(+) create mode 100644 docs/distutils-legacy.txt diff --git a/docs/distutils-legacy.txt b/docs/distutils-legacy.txt new file mode 100644 index 00000000..a5d96260 --- /dev/null +++ b/docs/distutils-legacy.txt @@ -0,0 +1,25 @@ +Porting from Distutils +====================== + +Setuptools and the PyPA have a `stated goal `_ to make Setuptools the reference API for distutils. + +Since the 49.1.2 release, Setuptools includes a local, vendored copy of distutils (from late copies of CPython) that is disabled by default. To enable the use of this copy of distutils when invoking setuptools, set the enviroment variable: + + SETUPTOOLS_USE_DISTUTILS=local + +This behavior is planned to become the default. + +Prefer Setuptools +----------------- + +As Distutils is deprecated, any usage of functions or objects from distutils is similarly discouraged, and Setuptools aims to replace or deprecate all such uses. This section describes the recommended replacements. + +``distutils.core.setup`` → ``setuptools.setup`` + +``distutils.cmd.Command`` → ``setuptools.Command`` + +``distutils.log`` → (no replacement yet) + +``distutils.version.*`` → ``packaging.version.*`` + +If a project relies on uses of ``distutils`` that do not have a suitable replacement above, please search the `Setuptools issue tracker `_ and file a request, describing the use-case so that Setuptools' maintainers can investigate. Please provide enough detail to help the maintainers understand how distutils is used, what value it provides, and why that behavior should be supported. diff --git a/docs/index.txt b/docs/index.txt index 228f97c8..0dd5fd94 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -18,4 +18,5 @@ Documentation content: development roadmap Deprecated: Easy Install + distutils-legacy history -- cgit v1.2.3 From 47e5198e09060c8ff59f659ae56c6e64dcb3607e Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 19 Jul 2020 11:37:34 +0200 Subject: Make tox show tests output in parallel mode @ GHA --- .github/workflows/python-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 5e16ab30..28ef36f7 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -106,6 +106,7 @@ jobs: python -m tox --parallel auto + --parallel-live --notest --skip-missing-interpreters false - name: Test with tox @@ -113,3 +114,4 @@ jobs: python -m tox --parallel auto + --parallel-live -- cgit v1.2.3 From f976af5fbcca95cef61b8e228ca3653a094f8a7a Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 19 Jul 2020 12:41:52 +0200 Subject: debug! make pytest extremely verbose --- .github/workflows/python-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 28ef36f7..a9bc859a 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -115,3 +115,5 @@ jobs: tox --parallel auto --parallel-live + -- + -vvvvv -- cgit v1.2.3 From 2b8b730db204d9d9a279802296de670b8a523fc0 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 19 Jul 2020 15:24:33 +0200 Subject: Add Python 3.9 beta from deadsnakes --- .github/workflows/python-tests.yml | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index a9bc859a..ed82aebb 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -34,6 +34,9 @@ jobs: # Pre-release versions (GH-shipped) - os: ubuntu-20.04 python-version: 3.9.0-beta.4 - 3.9.0 + # Pre-release versions (deadsnakes) + - os: ubuntu-20.04 + python-version: 3.9-beta # Dev versions (deadsnakes) - os: ubuntu-20.04 python-version: 3.9-dev @@ -42,21 +45,34 @@ jobs: env: NETWORK_REQUIRED: 1 + PYTHON_VERSION: ${{ matrix.python-version }} TOX_PARALLEL_NO_SPINNER: 1 TOXENV: python + USE_DEADSNAKES: false steps: - uses: actions/checkout@master - - name: Set up Python ${{ matrix.python-version }} (deadsnakes) + - name: Set flag to use deadsnakes + if: >- + endsWith(env.PYTHON_VERSION, '-beta') || + endsWith(env.PYTHON_VERSION, '-dev') + run: | + from __future__ import print_function + python_version = '${{ env.PYTHON_VERSION }}'.replace('-beta', '') + print('::set-env name=PYTHON_VERSION::{ver}'.format(ver=python_version)) + print('::set-env name=USE_DEADSNAKES::true') + shell: python + - name: Set up Python ${{ env.PYTHON_VERSION }} (deadsnakes) uses: deadsnakes/action@v1.0.0 - if: endsWith(matrix.python-version, '-dev') + if: fromJSON(env.USE_DEADSNAKES) && true || false with: - python-version: ${{ matrix.python-version }} - - name: Set up Python ${{ matrix.python-version }} + python-version: ${{ env.PYTHON_VERSION }} + - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v2 - if: "!endsWith(matrix.python-version, '-dev')" + if: >- + !fromJSON(env.USE_DEADSNAKES) && true || false with: - python-version: ${{ matrix.python-version }} + python-version: ${{ env.PYTHON_VERSION }} - name: Log Python version run: >- python --version @@ -88,9 +104,9 @@ jobs: run: >- python -m pip freeze --all - name: Adjust TOXENV for PyPy - if: startsWith(matrix.python-version, 'pypy') + if: startsWith(env.PYTHON_VERSION, 'pypy') run: >- - echo "::set-env name=TOXENV::${{ matrix.python-version }}" + echo "::set-env name=TOXENV::${{ env.PYTHON_VERSION }}" - name: Log env vars run: >- env -- cgit v1.2.3 From e371422476f51a83d27d70dc45bbfba1544aad55 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 19 Jul 2020 21:36:33 -0400 Subject: Consolidate distutils importing hacks into _distutils_importer package. Generate distutils-precedence.pth inline. --- MANIFEST.in | 1 - _distutils_importer/__init__.py | 19 +++++++++++-- _distutils_importer/install.py | 5 ++++ _distutils_importer/override.py | 47 +++++++++++++++++++++++++++++++ conftest.py | 2 +- distutils_precedence.pth | 1 - setup.py | 8 ++---- setuptools/__init__.py | 3 +- setuptools/distutils_patch.py | 61 ----------------------------------------- 9 files changed, 72 insertions(+), 75 deletions(-) create mode 100644 _distutils_importer/install.py create mode 100644 _distutils_importer/override.py delete mode 100644 distutils_precedence.pth delete mode 100644 setuptools/distutils_patch.py diff --git a/MANIFEST.in b/MANIFEST.in index be83a7f3..128ae280 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -13,5 +13,4 @@ include launcher.c include msvc-build-launcher.cmd include pytest.ini include tox.ini -include distutils_precedence.pth exclude pyproject.toml # Temporary workaround for #1644. diff --git a/_distutils_importer/__init__.py b/_distutils_importer/__init__.py index 323ae203..ffa4caea 100644 --- a/_distutils_importer/__init__.py +++ b/_distutils_importer/__init__.py @@ -1,4 +1,20 @@ +""" +Ensure that the local copy of distutils is preferred over stdlib. + +See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 +for more motivation. +""" + import sys +import os + + +def enabled(): + """ + Allow selection of distutils by environment variable. + """ + which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') + return which == 'local' class DistutilsMetaFinder: @@ -34,6 +50,3 @@ def remove_shim(): sys.path.remove(DISTUTILS_FINDER) except ValueError: pass - - -add_shim() diff --git a/_distutils_importer/install.py b/_distutils_importer/install.py new file mode 100644 index 00000000..73f13b29 --- /dev/null +++ b/_distutils_importer/install.py @@ -0,0 +1,5 @@ +from . import enabled, add_shim + + +if enabled(): + add_shim() diff --git a/_distutils_importer/override.py b/_distutils_importer/override.py new file mode 100644 index 00000000..91738485 --- /dev/null +++ b/_distutils_importer/override.py @@ -0,0 +1,47 @@ +import sys +import re +import importlib +import warnings + +from . import enabled + + +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.") + mods = [name for name in sys.modules if re.match(r'distutils\b', name)] + for name in mods: + del sys.modules[name] + + +def ensure_local_distutils(): + clear_distutils() + distutils = importlib.import_module('setuptools._distutils') + distutils.__name__ = 'distutils' + sys.modules['distutils'] = distutils + + # sanity check that submodules load as expected + core = importlib.import_module('distutils.core') + assert '_distutils' in core.__file__, core.__file__ + + +warn_distutils_present() +if enabled(): + ensure_local_distutils() diff --git a/conftest.py b/conftest.py index 6013e187..868bf5be 100644 --- a/conftest.py +++ b/conftest.py @@ -15,7 +15,7 @@ collect_ignore = [ 'tests/manual_test.py', 'setuptools/tests/mod_with_constant.py', 'setuptools/_distutils', - 'setuptools/distutils_patch.py', + '_distutils_importer', ] diff --git a/distutils_precedence.pth b/distutils_precedence.pth deleted file mode 100644 index 2d9b996a..00000000 --- a/distutils_precedence.pth +++ /dev/null @@ -1 +0,0 @@ -import os; (os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') == 'local' and __import__('_distutils_importer')) diff --git a/setup.py b/setup.py index cba37d3e..a6e1abc4 100755 --- a/setup.py +++ b/setup.py @@ -94,12 +94,8 @@ class install_with_pth(install): def initialize_options(self): install.initialize_options(self) - - name = 'distutils_precedence' - with open(os.path.join(here, name + '.pth'), 'rt') as f: - contents = f.read() - - self.extra_path = (name, contents) + self.extra_path = ( + 'distutils-precedence', 'import _distutils_importer.install') def finalize_options(self): install.finalize_options(self) diff --git a/setuptools/__init__.py b/setuptools/__init__.py index d9740403..80b287b4 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -5,8 +5,7 @@ import functools import os import re -# Disabled for now due to: #2228, #2230 -import setuptools.distutils_patch # noqa: F401 +import _distutils_importer.override # noqa: F401 import distutils.core from distutils.errors import DistutilsOptionError diff --git a/setuptools/distutils_patch.py b/setuptools/distutils_patch.py deleted file mode 100644 index 33f1e7f9..00000000 --- a/setuptools/distutils_patch.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Ensure that the local copy of distutils is preferred over stdlib. - -See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 -for more motivation. -""" - -import sys -import re -import os -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.") - mods = [name for name in sys.modules if re.match(r'distutils\b', name)] - for name in mods: - del sys.modules[name] - - -def enabled(): - """ - Allow selection of distutils by environment variable. - """ - which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') - return which == 'local' - - -def ensure_local_distutils(): - clear_distutils() - distutils = importlib.import_module('setuptools._distutils') - distutils.__name__ = 'distutils' - sys.modules['distutils'] = distutils - - # sanity check that submodules load as expected - core = importlib.import_module('distutils.core') - assert '_distutils' in core.__file__, core.__file__ - - -warn_distutils_present() -if enabled(): - ensure_local_distutils() -- cgit v1.2.3 From 2986be4e55d6c8113344d5e184d40c6c3945a2bb Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 19 Jul 2020 21:49:24 -0400 Subject: Fix AttributeError when `importlib.util` was not otherwise imported. --- _distutils_importer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_distutils_importer/__init__.py b/_distutils_importer/__init__.py index ffa4caea..06674eb8 100644 --- a/_distutils_importer/__init__.py +++ b/_distutils_importer/__init__.py @@ -25,7 +25,7 @@ class DistutilsMetaFinder: return self.get_distutils_spec() def get_distutils_spec(self): - import importlib + import importlib.util class DistutilsLoader(importlib.util.abc.Loader): -- cgit v1.2.3 From 1e53a2c14e7e0f788c9df2a542ac10f6b2f511d7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 19 Jul 2020 21:53:39 -0400 Subject: Move docstring closer to relevant context --- _distutils_importer/__init__.py | 7 ------- _distutils_importer/override.py | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_distutils_importer/__init__.py b/_distutils_importer/__init__.py index 06674eb8..3ad70100 100644 --- a/_distutils_importer/__init__.py +++ b/_distutils_importer/__init__.py @@ -1,10 +1,3 @@ -""" -Ensure that the local copy of distutils is preferred over stdlib. - -See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 -for more motivation. -""" - import sys import os diff --git a/_distutils_importer/override.py b/_distutils_importer/override.py index 91738485..523139bb 100644 --- a/_distutils_importer/override.py +++ b/_distutils_importer/override.py @@ -1,3 +1,10 @@ +""" +Ensure that the local copy of distutils is preferred over stdlib. + +See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 +for more motivation. +""" + import sys import re import importlib -- cgit v1.2.3 From dec637b12e1eee6f884405c56a4d01c505c00dfe Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Tue, 21 Jul 2020 15:05:28 +0200 Subject: Try out actions/setup-python@v2.1.1 --- .github/workflows/python-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index ed82aebb..93ec79d4 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -68,7 +68,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.1.1 if: >- !fromJSON(env.USE_DEADSNAKES) && true || false with: -- cgit v1.2.3 From a1686b39e311c38e1c32e0fdfe06597611300861 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 24 Jul 2020 21:08:34 -0400 Subject: Revert "Render logo in the readme." This reverts commit 4056435460b770c3ab7a8ea1637f05de690e7e01. --- README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.rst b/README.rst index dc2bf98b..9cbf7b86 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,3 @@ -.. image:: https://raw.githubusercontent.com/pypa/setuptools/master/docs/logo/banner%201%20line%20color.svg - - .. image:: https://img.shields.io/pypi/v/setuptools.svg :target: `PyPI link`_ @@ -27,7 +24,6 @@ .. image:: https://tidelift.com/badges/github/pypa/setuptools?style=flat :target: https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=readme - See the `Installation Instructions `_ in the Python Packaging User's Guide for instructions on installing, upgrading, and uninstalling -- cgit v1.2.3 From 2bf12c542af74c6e8b76ffd864c95c2efd94d372 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 24 Jul 2020 21:08:56 -0400 Subject: Revert "Rename logo assets to remove project name and 'logo', which are implied by the context." This reverts commit fd94cd038d644ff27866301f6f365a3ef0901898. --- docs/logo/banner 1 line color.png | Bin 24183 -> 0 bytes docs/logo/banner 1 line color.svg | 223 -------------------- docs/logo/banner 2 lines color.png | Bin 38105 -> 0 bytes docs/logo/banner 2 lines color.svg | 224 -------------------- docs/logo/full color 1000px.png | Bin 31520 -> 0 bytes docs/logo/full color.svg | 227 --------------------- docs/logo/setup_tools_logo_colour.svg | 227 +++++++++++++++++++++ docs/logo/setup_tools_logo_colour_1000px.png | Bin 0 -> 31520 bytes docs/logo/setup_tools_logo_colour_banner_1line.svg | 223 ++++++++++++++++++++ ...setup_tools_logo_colour_banner_1line_1000px.png | Bin 0 -> 24183 bytes .../logo/setup_tools_logo_colour_banner_2lines.svg | 224 ++++++++++++++++++++ ...etup_tools_logo_colour_banner_2lines_1000px.png | Bin 0 -> 38105 bytes docs/logo/setup_tools_logo_symbol_colour.svg | 203 ++++++++++++++++++ .../logo/setup_tools_logo_symbol_colour_1000px.png | Bin 0 -> 44239 bytes docs/logo/setup_tools_logotype_1line.svg | 169 +++++++++++++++ docs/logo/symbol color 1000px.png | Bin 44239 -> 0 bytes docs/logo/symbol color.svg | 203 ------------------ docs/logo/type.svg | 169 --------------- 18 files changed, 1046 insertions(+), 1046 deletions(-) delete mode 100644 docs/logo/banner 1 line color.png delete mode 100644 docs/logo/banner 1 line color.svg delete mode 100644 docs/logo/banner 2 lines color.png delete mode 100644 docs/logo/banner 2 lines color.svg delete mode 100644 docs/logo/full color 1000px.png delete mode 100644 docs/logo/full color.svg create mode 100644 docs/logo/setup_tools_logo_colour.svg create mode 100644 docs/logo/setup_tools_logo_colour_1000px.png create mode 100644 docs/logo/setup_tools_logo_colour_banner_1line.svg create mode 100644 docs/logo/setup_tools_logo_colour_banner_1line_1000px.png create mode 100644 docs/logo/setup_tools_logo_colour_banner_2lines.svg create mode 100644 docs/logo/setup_tools_logo_colour_banner_2lines_1000px.png create mode 100644 docs/logo/setup_tools_logo_symbol_colour.svg create mode 100644 docs/logo/setup_tools_logo_symbol_colour_1000px.png create mode 100644 docs/logo/setup_tools_logotype_1line.svg delete mode 100644 docs/logo/symbol color 1000px.png delete mode 100644 docs/logo/symbol color.svg delete mode 100644 docs/logo/type.svg diff --git a/docs/logo/banner 1 line color.png b/docs/logo/banner 1 line color.png deleted file mode 100644 index d1604289..00000000 Binary files a/docs/logo/banner 1 line color.png and /dev/null differ diff --git a/docs/logo/banner 1 line color.svg b/docs/logo/banner 1 line color.svg deleted file mode 100644 index d6dc9aac..00000000 --- a/docs/logo/banner 1 line color.svg +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff --git a/docs/logo/banner 2 lines color.png b/docs/logo/banner 2 lines color.png deleted file mode 100644 index 89370a9d..00000000 Binary files a/docs/logo/banner 2 lines color.png and /dev/null differ diff --git a/docs/logo/banner 2 lines color.svg b/docs/logo/banner 2 lines color.svg deleted file mode 100644 index 991577fb..00000000 --- a/docs/logo/banner 2 lines color.svg +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff --git a/docs/logo/full color 1000px.png b/docs/logo/full color 1000px.png deleted file mode 100644 index c25a23b9..00000000 Binary files a/docs/logo/full color 1000px.png and /dev/null differ diff --git a/docs/logo/full color.svg b/docs/logo/full color.svg deleted file mode 100644 index 7eae8fc3..00000000 --- a/docs/logo/full color.svg +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff --git a/docs/logo/setup_tools_logo_colour.svg b/docs/logo/setup_tools_logo_colour.svg new file mode 100644 index 00000000..7eae8fc3 --- /dev/null +++ b/docs/logo/setup_tools_logo_colour.svg @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/docs/logo/setup_tools_logo_colour_1000px.png b/docs/logo/setup_tools_logo_colour_1000px.png new file mode 100644 index 00000000..c25a23b9 Binary files /dev/null and b/docs/logo/setup_tools_logo_colour_1000px.png differ diff --git a/docs/logo/setup_tools_logo_colour_banner_1line.svg b/docs/logo/setup_tools_logo_colour_banner_1line.svg new file mode 100644 index 00000000..d6dc9aac --- /dev/null +++ b/docs/logo/setup_tools_logo_colour_banner_1line.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/docs/logo/setup_tools_logo_colour_banner_1line_1000px.png b/docs/logo/setup_tools_logo_colour_banner_1line_1000px.png new file mode 100644 index 00000000..d1604289 Binary files /dev/null and b/docs/logo/setup_tools_logo_colour_banner_1line_1000px.png differ diff --git a/docs/logo/setup_tools_logo_colour_banner_2lines.svg b/docs/logo/setup_tools_logo_colour_banner_2lines.svg new file mode 100644 index 00000000..991577fb --- /dev/null +++ b/docs/logo/setup_tools_logo_colour_banner_2lines.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/docs/logo/setup_tools_logo_colour_banner_2lines_1000px.png b/docs/logo/setup_tools_logo_colour_banner_2lines_1000px.png new file mode 100644 index 00000000..89370a9d Binary files /dev/null and b/docs/logo/setup_tools_logo_colour_banner_2lines_1000px.png differ diff --git a/docs/logo/setup_tools_logo_symbol_colour.svg b/docs/logo/setup_tools_logo_symbol_colour.svg new file mode 100644 index 00000000..2936cbb5 --- /dev/null +++ b/docs/logo/setup_tools_logo_symbol_colour.svg @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/docs/logo/setup_tools_logo_symbol_colour_1000px.png b/docs/logo/setup_tools_logo_symbol_colour_1000px.png new file mode 100644 index 00000000..e0c36fc1 Binary files /dev/null and b/docs/logo/setup_tools_logo_symbol_colour_1000px.png differ diff --git a/docs/logo/setup_tools_logotype_1line.svg b/docs/logo/setup_tools_logotype_1line.svg new file mode 100644 index 00000000..dbb9c1de --- /dev/null +++ b/docs/logo/setup_tools_logotype_1line.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/docs/logo/symbol color 1000px.png b/docs/logo/symbol color 1000px.png deleted file mode 100644 index e0c36fc1..00000000 Binary files a/docs/logo/symbol color 1000px.png and /dev/null differ diff --git a/docs/logo/symbol color.svg b/docs/logo/symbol color.svg deleted file mode 100644 index 2936cbb5..00000000 --- a/docs/logo/symbol color.svg +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - diff --git a/docs/logo/type.svg b/docs/logo/type.svg deleted file mode 100644 index dbb9c1de..00000000 --- a/docs/logo/type.svg +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 9dd762c61bdea4491f62c2b812b5cd5672821154 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 24 Jul 2020 21:11:16 -0400 Subject: Revert "Merge pull request #2229 from cajhne/logo001" This reverts commit 402880a7aed5dea1cf3a84af2b8291e451fb3d9f, reversing changes made to bd1102648109c85c782286787e4d5290ae280abe. --- docs/logo/README.md | 10 - docs/logo/josefinsans/.uuid | 1 - docs/logo/josefinsans/DESCRIPTION.en_us.html | 9 - docs/logo/josefinsans/JosefinSans-Bold.ttf | Bin 86300 -> 0 bytes docs/logo/josefinsans/JosefinSans-BoldItalic.ttf | Bin 83100 -> 0 bytes docs/logo/josefinsans/JosefinSans-Italic.ttf | Bin 84916 -> 0 bytes docs/logo/josefinsans/JosefinSans-Light.ttf | Bin 87320 -> 0 bytes docs/logo/josefinsans/JosefinSans-LightItalic.ttf | Bin 85684 -> 0 bytes docs/logo/josefinsans/JosefinSans-Regular.ttf | Bin 87260 -> 0 bytes docs/logo/josefinsans/JosefinSans-SemiBold.ttf | Bin 87880 -> 0 bytes .../josefinsans/JosefinSans-SemiBoldItalic.ttf | Bin 84824 -> 0 bytes docs/logo/josefinsans/JosefinSans-Thin.ttf | Bin 88088 -> 0 bytes docs/logo/josefinsans/JosefinSans-ThinItalic.ttf | Bin 85420 -> 0 bytes docs/logo/josefinsans/METADATA.pb | 99 --------- docs/logo/josefinsans/OFL.txt | 93 --------- docs/logo/setup_tools_logo_colour.svg | 227 --------------------- docs/logo/setup_tools_logo_colour_1000px.png | Bin 31520 -> 0 bytes docs/logo/setup_tools_logo_colour_banner_1line.svg | 223 -------------------- ...setup_tools_logo_colour_banner_1line_1000px.png | Bin 24183 -> 0 bytes .../logo/setup_tools_logo_colour_banner_2lines.svg | 224 -------------------- ...etup_tools_logo_colour_banner_2lines_1000px.png | Bin 38105 -> 0 bytes docs/logo/setup_tools_logo_symbol_colour.svg | 203 ------------------ .../logo/setup_tools_logo_symbol_colour_1000px.png | Bin 44239 -> 0 bytes docs/logo/setup_tools_logotype_1line.svg | 169 --------------- 24 files changed, 1258 deletions(-) delete mode 100644 docs/logo/README.md delete mode 100644 docs/logo/josefinsans/.uuid delete mode 100644 docs/logo/josefinsans/DESCRIPTION.en_us.html delete mode 100644 docs/logo/josefinsans/JosefinSans-Bold.ttf delete mode 100644 docs/logo/josefinsans/JosefinSans-BoldItalic.ttf delete mode 100644 docs/logo/josefinsans/JosefinSans-Italic.ttf delete mode 100644 docs/logo/josefinsans/JosefinSans-Light.ttf delete mode 100644 docs/logo/josefinsans/JosefinSans-LightItalic.ttf delete mode 100644 docs/logo/josefinsans/JosefinSans-Regular.ttf delete mode 100644 docs/logo/josefinsans/JosefinSans-SemiBold.ttf delete mode 100644 docs/logo/josefinsans/JosefinSans-SemiBoldItalic.ttf delete mode 100644 docs/logo/josefinsans/JosefinSans-Thin.ttf delete mode 100644 docs/logo/josefinsans/JosefinSans-ThinItalic.ttf delete mode 100644 docs/logo/josefinsans/METADATA.pb delete mode 100644 docs/logo/josefinsans/OFL.txt delete mode 100644 docs/logo/setup_tools_logo_colour.svg delete mode 100644 docs/logo/setup_tools_logo_colour_1000px.png delete mode 100644 docs/logo/setup_tools_logo_colour_banner_1line.svg delete mode 100644 docs/logo/setup_tools_logo_colour_banner_1line_1000px.png delete mode 100644 docs/logo/setup_tools_logo_colour_banner_2lines.svg delete mode 100644 docs/logo/setup_tools_logo_colour_banner_2lines_1000px.png delete mode 100644 docs/logo/setup_tools_logo_symbol_colour.svg delete mode 100644 docs/logo/setup_tools_logo_symbol_colour_1000px.png delete mode 100644 docs/logo/setup_tools_logotype_1line.svg diff --git a/docs/logo/README.md b/docs/logo/README.md deleted file mode 100644 index 74fadbf0..00000000 --- a/docs/logo/README.md +++ /dev/null @@ -1,10 +0,0 @@ -![](setup_tools_logo_colour.svg) -### Design: - -Setuptools logo designed in 2020 by [C.Rogers](crogersmedia.com) for the Setuptools project using the Free Open Source graphics editor [Inkscape](inkscape.org). - -### Copyright: -Logo is (c) the Setuptools developers. - -### Font: -The font used is the Open Font "Josefin Sans", which is available for free under the Open Font License (OFL). diff --git a/docs/logo/josefinsans/.uuid b/docs/logo/josefinsans/.uuid deleted file mode 100644 index d7e92c77..00000000 --- a/docs/logo/josefinsans/.uuid +++ /dev/null @@ -1 +0,0 @@ -922c129c-9f4c-4831-b632-c7f43be6feb0 \ No newline at end of file diff --git a/docs/logo/josefinsans/DESCRIPTION.en_us.html b/docs/logo/josefinsans/DESCRIPTION.en_us.html deleted file mode 100644 index 9364b249..00000000 --- a/docs/logo/josefinsans/DESCRIPTION.en_us.html +++ /dev/null @@ -1,9 +0,0 @@ -

-The idea of this typeface is to be geometric, elegant, with a vintage feeling, for use at larger sizes. -It is inspired by geometric sans serif designs from the 1920s. -The x-height is half way from baseline to cap height, an unusual proportion. -

-

-There is a sister family, Josefin Slab -

- diff --git a/docs/logo/josefinsans/JosefinSans-Bold.ttf b/docs/logo/josefinsans/JosefinSans-Bold.ttf deleted file mode 100644 index 12a7ad08..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-Bold.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/JosefinSans-BoldItalic.ttf b/docs/logo/josefinsans/JosefinSans-BoldItalic.ttf deleted file mode 100644 index 4a0fc91d..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-BoldItalic.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/JosefinSans-Italic.ttf b/docs/logo/josefinsans/JosefinSans-Italic.ttf deleted file mode 100644 index 1cbe036e..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-Italic.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/JosefinSans-Light.ttf b/docs/logo/josefinsans/JosefinSans-Light.ttf deleted file mode 100644 index 7fe3f7be..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-Light.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/JosefinSans-LightItalic.ttf b/docs/logo/josefinsans/JosefinSans-LightItalic.ttf deleted file mode 100644 index 8dc35383..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-LightItalic.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/JosefinSans-Regular.ttf b/docs/logo/josefinsans/JosefinSans-Regular.ttf deleted file mode 100644 index ed119008..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-Regular.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/JosefinSans-SemiBold.ttf b/docs/logo/josefinsans/JosefinSans-SemiBold.ttf deleted file mode 100644 index b67504a6..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-SemiBold.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/JosefinSans-SemiBoldItalic.ttf b/docs/logo/josefinsans/JosefinSans-SemiBoldItalic.ttf deleted file mode 100644 index 24a27d15..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-SemiBoldItalic.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/JosefinSans-Thin.ttf b/docs/logo/josefinsans/JosefinSans-Thin.ttf deleted file mode 100644 index c54ca7f1..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-Thin.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/JosefinSans-ThinItalic.ttf b/docs/logo/josefinsans/JosefinSans-ThinItalic.ttf deleted file mode 100644 index 6840b7c2..00000000 Binary files a/docs/logo/josefinsans/JosefinSans-ThinItalic.ttf and /dev/null differ diff --git a/docs/logo/josefinsans/METADATA.pb b/docs/logo/josefinsans/METADATA.pb deleted file mode 100644 index 8b67716c..00000000 --- a/docs/logo/josefinsans/METADATA.pb +++ /dev/null @@ -1,99 +0,0 @@ -name: "Josefin Sans" -designer: "Santiago Orozco" -license: "OFL" -category: "SANS_SERIF" -date_added: "2010-11-17" -fonts { - name: "Josefin Sans" - style: "normal" - weight: 100 - filename: "JosefinSans-Thin.ttf" - post_script_name: "JosefinSans-Thin" - full_name: "Josefin Sans Thin" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -fonts { - name: "Josefin Sans" - style: "italic" - weight: 100 - filename: "JosefinSans-ThinItalic.ttf" - post_script_name: "JosefinSans-ThinItalic" - full_name: "Josefin Sans Thin Italic" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -fonts { - name: "Josefin Sans" - style: "normal" - weight: 300 - filename: "JosefinSans-Light.ttf" - post_script_name: "JosefinSans-Light" - full_name: "Josefin Sans Light" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -fonts { - name: "Josefin Sans" - style: "italic" - weight: 300 - filename: "JosefinSans-LightItalic.ttf" - post_script_name: "JosefinSans-LightItalic" - full_name: "Josefin Sans Light Italic" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -fonts { - name: "Josefin Sans" - style: "normal" - weight: 400 - filename: "JosefinSans-Regular.ttf" - post_script_name: "JosefinSans-Regular" - full_name: "Josefin Sans Regular" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -fonts { - name: "Josefin Sans" - style: "italic" - weight: 400 - filename: "JosefinSans-Italic.ttf" - post_script_name: "JosefinSans-Italic" - full_name: "Josefin Sans Italic" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -fonts { - name: "Josefin Sans" - style: "normal" - weight: 600 - filename: "JosefinSans-SemiBold.ttf" - post_script_name: "JosefinSans-SemiBold" - full_name: "Josefin Sans SemiBold" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -fonts { - name: "Josefin Sans" - style: "italic" - weight: 600 - filename: "JosefinSans-SemiBoldItalic.ttf" - post_script_name: "JosefinSans-SemiBoldItalic" - full_name: "Josefin Sans SemiBold Italic" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -fonts { - name: "Josefin Sans" - style: "normal" - weight: 700 - filename: "JosefinSans-Bold.ttf" - post_script_name: "JosefinSans-Bold" - full_name: "Josefin Sans Bold" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -fonts { - name: "Josefin Sans" - style: "italic" - weight: 700 - filename: "JosefinSans-BoldItalic.ttf" - post_script_name: "JosefinSans-BoldItalic" - full_name: "Josefin Sans Bold Italic" - copyright: "Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name \"Josefin Sans\"." -} -subsets: "latin" -subsets: "latin-ext" -subsets: "menu" -subsets: "vietnamese" diff --git a/docs/logo/josefinsans/OFL.txt b/docs/logo/josefinsans/OFL.txt deleted file mode 100644 index 6586a7e3..00000000 --- a/docs/logo/josefinsans/OFL.txt +++ /dev/null @@ -1,93 +0,0 @@ -Copyright (c) 2010, Santiago Orozco (hi@typemade.mx) - -This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/docs/logo/setup_tools_logo_colour.svg b/docs/logo/setup_tools_logo_colour.svg deleted file mode 100644 index 7eae8fc3..00000000 --- a/docs/logo/setup_tools_logo_colour.svg +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff --git a/docs/logo/setup_tools_logo_colour_1000px.png b/docs/logo/setup_tools_logo_colour_1000px.png deleted file mode 100644 index c25a23b9..00000000 Binary files a/docs/logo/setup_tools_logo_colour_1000px.png and /dev/null differ diff --git a/docs/logo/setup_tools_logo_colour_banner_1line.svg b/docs/logo/setup_tools_logo_colour_banner_1line.svg deleted file mode 100644 index d6dc9aac..00000000 --- a/docs/logo/setup_tools_logo_colour_banner_1line.svg +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff --git a/docs/logo/setup_tools_logo_colour_banner_1line_1000px.png b/docs/logo/setup_tools_logo_colour_banner_1line_1000px.png deleted file mode 100644 index d1604289..00000000 Binary files a/docs/logo/setup_tools_logo_colour_banner_1line_1000px.png and /dev/null differ diff --git a/docs/logo/setup_tools_logo_colour_banner_2lines.svg b/docs/logo/setup_tools_logo_colour_banner_2lines.svg deleted file mode 100644 index 991577fb..00000000 --- a/docs/logo/setup_tools_logo_colour_banner_2lines.svg +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff --git a/docs/logo/setup_tools_logo_colour_banner_2lines_1000px.png b/docs/logo/setup_tools_logo_colour_banner_2lines_1000px.png deleted file mode 100644 index 89370a9d..00000000 Binary files a/docs/logo/setup_tools_logo_colour_banner_2lines_1000px.png and /dev/null differ diff --git a/docs/logo/setup_tools_logo_symbol_colour.svg b/docs/logo/setup_tools_logo_symbol_colour.svg deleted file mode 100644 index 2936cbb5..00000000 --- a/docs/logo/setup_tools_logo_symbol_colour.svg +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - diff --git a/docs/logo/setup_tools_logo_symbol_colour_1000px.png b/docs/logo/setup_tools_logo_symbol_colour_1000px.png deleted file mode 100644 index e0c36fc1..00000000 Binary files a/docs/logo/setup_tools_logo_symbol_colour_1000px.png and /dev/null differ diff --git a/docs/logo/setup_tools_logotype_1line.svg b/docs/logo/setup_tools_logotype_1line.svg deleted file mode 100644 index dbb9c1de..00000000 --- a/docs/logo/setup_tools_logotype_1line.svg +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 1b22ebc1cea9da7f377a260821e6cb1781df527c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 24 Jul 2020 21:24:06 -0400 Subject: Revert "Add banner to main docs page" This reverts commit 0f491dc2b4141a17475eec12b02d8f237d7f7918. --- docs/index.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/index.txt b/docs/index.txt index 228f97c8..fc111a99 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -1,6 +1,3 @@ -.. image:: https://raw.githubusercontent.com/pypa/setuptools/master/docs/logo/banner%201%20line%20color.svg - - Documentation ============= -- cgit v1.2.3 From dcc71f773576c19a3658735879893515b056ece5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Jul 2020 10:35:02 -0400 Subject: Rename _distutils_importer to _distutils_hack, as it supplies more than just an importer. --- _distutils_hack/__init__.py | 45 ++++++++++++++++++++++++++++++++++ _distutils_hack/install.py | 5 ++++ _distutils_hack/override.py | 54 +++++++++++++++++++++++++++++++++++++++++ _distutils_importer/__init__.py | 45 ---------------------------------- _distutils_importer/install.py | 5 ---- _distutils_importer/override.py | 54 ----------------------------------------- conftest.py | 2 +- setup.py | 2 +- setuptools/__init__.py | 2 +- setuptools/sandbox.py | 8 +++--- 10 files changed, 111 insertions(+), 111 deletions(-) create mode 100644 _distutils_hack/__init__.py create mode 100644 _distutils_hack/install.py create mode 100644 _distutils_hack/override.py delete mode 100644 _distutils_importer/__init__.py delete mode 100644 _distutils_importer/install.py delete mode 100644 _distutils_importer/override.py diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py new file mode 100644 index 00000000..3ad70100 --- /dev/null +++ b/_distutils_hack/__init__.py @@ -0,0 +1,45 @@ +import sys +import os + + +def enabled(): + """ + Allow selection of distutils by environment variable. + """ + which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') + return which == 'local' + + +class DistutilsMetaFinder: + def find_spec(self, fullname, path, target=None): + if path is not None or fullname != "distutils": + return None + + return self.get_distutils_spec() + + def get_distutils_spec(self): + import importlib.util + + class DistutilsLoader(importlib.util.abc.Loader): + + def create_module(self, spec): + return importlib.import_module('._distutils', 'setuptools') + + def exec_module(self, module): + pass + + return importlib.util.spec_from_loader('distutils', DistutilsLoader()) + + +DISTUTILS_FINDER = DistutilsMetaFinder() + + +def add_shim(): + sys.meta_path.insert(0, DISTUTILS_FINDER) + + +def remove_shim(): + try: + sys.path.remove(DISTUTILS_FINDER) + except ValueError: + pass diff --git a/_distutils_hack/install.py b/_distutils_hack/install.py new file mode 100644 index 00000000..73f13b29 --- /dev/null +++ b/_distutils_hack/install.py @@ -0,0 +1,5 @@ +from . import enabled, add_shim + + +if enabled(): + add_shim() diff --git a/_distutils_hack/override.py b/_distutils_hack/override.py new file mode 100644 index 00000000..523139bb --- /dev/null +++ b/_distutils_hack/override.py @@ -0,0 +1,54 @@ +""" +Ensure that the local copy of distutils is preferred over stdlib. + +See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 +for more motivation. +""" + +import sys +import re +import importlib +import warnings + +from . import enabled + + +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.") + mods = [name for name in sys.modules if re.match(r'distutils\b', name)] + for name in mods: + del sys.modules[name] + + +def ensure_local_distutils(): + clear_distutils() + distutils = importlib.import_module('setuptools._distutils') + distutils.__name__ = 'distutils' + sys.modules['distutils'] = distutils + + # sanity check that submodules load as expected + core = importlib.import_module('distutils.core') + assert '_distutils' in core.__file__, core.__file__ + + +warn_distutils_present() +if enabled(): + ensure_local_distutils() diff --git a/_distutils_importer/__init__.py b/_distutils_importer/__init__.py deleted file mode 100644 index 3ad70100..00000000 --- a/_distutils_importer/__init__.py +++ /dev/null @@ -1,45 +0,0 @@ -import sys -import os - - -def enabled(): - """ - Allow selection of distutils by environment variable. - """ - which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') - return which == 'local' - - -class DistutilsMetaFinder: - def find_spec(self, fullname, path, target=None): - if path is not None or fullname != "distutils": - return None - - return self.get_distutils_spec() - - def get_distutils_spec(self): - import importlib.util - - class DistutilsLoader(importlib.util.abc.Loader): - - def create_module(self, spec): - return importlib.import_module('._distutils', 'setuptools') - - def exec_module(self, module): - pass - - return importlib.util.spec_from_loader('distutils', DistutilsLoader()) - - -DISTUTILS_FINDER = DistutilsMetaFinder() - - -def add_shim(): - sys.meta_path.insert(0, DISTUTILS_FINDER) - - -def remove_shim(): - try: - sys.path.remove(DISTUTILS_FINDER) - except ValueError: - pass diff --git a/_distutils_importer/install.py b/_distutils_importer/install.py deleted file mode 100644 index 73f13b29..00000000 --- a/_distutils_importer/install.py +++ /dev/null @@ -1,5 +0,0 @@ -from . import enabled, add_shim - - -if enabled(): - add_shim() diff --git a/_distutils_importer/override.py b/_distutils_importer/override.py deleted file mode 100644 index 523139bb..00000000 --- a/_distutils_importer/override.py +++ /dev/null @@ -1,54 +0,0 @@ -""" -Ensure that the local copy of distutils is preferred over stdlib. - -See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 -for more motivation. -""" - -import sys -import re -import importlib -import warnings - -from . import enabled - - -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.") - mods = [name for name in sys.modules if re.match(r'distutils\b', name)] - for name in mods: - del sys.modules[name] - - -def ensure_local_distutils(): - clear_distutils() - distutils = importlib.import_module('setuptools._distutils') - distutils.__name__ = 'distutils' - sys.modules['distutils'] = distutils - - # sanity check that submodules load as expected - core = importlib.import_module('distutils.core') - assert '_distutils' in core.__file__, core.__file__ - - -warn_distutils_present() -if enabled(): - ensure_local_distutils() diff --git a/conftest.py b/conftest.py index 868bf5be..25537f56 100644 --- a/conftest.py +++ b/conftest.py @@ -15,7 +15,7 @@ collect_ignore = [ 'tests/manual_test.py', 'setuptools/tests/mod_with_constant.py', 'setuptools/_distutils', - '_distutils_importer', + '_distutils_hack', ] diff --git a/setup.py b/setup.py index a6e1abc4..2d8bdf85 100755 --- a/setup.py +++ b/setup.py @@ -95,7 +95,7 @@ class install_with_pth(install): def initialize_options(self): install.initialize_options(self) self.extra_path = ( - 'distutils-precedence', 'import _distutils_importer.install') + 'distutils-precedence', 'import _distutils_hack.install') def finalize_options(self): install.finalize_options(self) diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 80b287b4..99094230 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -5,7 +5,7 @@ import functools import os import re -import _distutils_importer.override # noqa: F401 +import _distutils_hack.override # noqa: F401 import distutils.core from distutils.errors import DistutilsOptionError diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 342a713f..24a36080 100644 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -200,7 +200,7 @@ _MODULES_TO_HIDE = { 'distutils', 'pkg_resources', 'Cython', - '_distutils_importer', + '_distutils_hack', } @@ -232,9 +232,9 @@ def hide_setuptools(): necessary to avoid issues such as #315 where setuptools upgrading itself would fail to find a function declared in the metadata. """ - _distutils_importer = sys.modules.get('_distutils_importer', None) - if _distutils_importer is not None: - _distutils_importer.remove_shim() + _distutils_hack = sys.modules.get('_distutils_hack', None) + if _distutils_hack is not None: + _distutils_hack.remove_shim() modules = filter(_needs_hiding, sys.modules) _clear_modules(modules) -- cgit v1.2.3 From 384a51657c94271d29c437415080f25f7df4103b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Jul 2020 10:38:13 -0400 Subject: Extract pth name and contents into class variables. --- setup.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 2d8bdf85..edb2bbcf 100755 --- a/setup.py +++ b/setup.py @@ -92,18 +92,21 @@ class install_with_pth(install): `distutils` than the standard library. """ + _pth_name = 'distutils-precedence' + _pth_contents = 'import _distutils_hack.install' + def initialize_options(self): install.initialize_options(self) - self.extra_path = ( - 'distutils-precedence', 'import _distutils_hack.install') + self.extra_path = self._pth_name, self._pth_contents def finalize_options(self): install.finalize_options(self) + # undo secondary effect of `extra_path` adding to `install_lib` install_suffix = os.path.relpath(self.install_lib, self.install_libbase) - if install_suffix == self.extra_path[1]: + if install_suffix == self._pth_contents: self.install_lib = self.install_libbase -- cgit v1.2.3 From f3b177e9c2b77104ddebaec7b581e2aee73a1184 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Jul 2020 10:42:15 -0400 Subject: Update docstring to use imperative voice, provide a bit more context, and advise against copying of the behavior. --- setup.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index edb2bbcf..45ddb149 100755 --- a/setup.py +++ b/setup.py @@ -86,10 +86,13 @@ class install_with_pth(install): """ Custom install command to install a .pth file for distutils patching. - This is necessary because there's no standard way to install a `.pth` file - alongside your package (and there probably shouldn't be one), but we need - to do this in order to give precedence higher precedence to our version of - `distutils` than the standard library. + This hack is necessary because there's no standard way to install behavior + on startup (and it's debatable if there should be one). This hack (ab)uses + the `extra_path` behavior in Setuptools to install a `.pth` file with + implicit behavior on startup to give higher precedence to the local version + of `distutils` over the version from the standard library. + + Please do not replicate this behavior. """ _pth_name = 'distutils-precedence' -- cgit v1.2.3 From 268ef5f553f29977f708c256ee398c9e29cb4da7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Jul 2020 10:43:08 -0400 Subject: Remove hanging indent --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 45ddb149..6290a746 100755 --- a/setup.py +++ b/setup.py @@ -106,8 +106,10 @@ class install_with_pth(install): install.finalize_options(self) # undo secondary effect of `extra_path` adding to `install_lib` - install_suffix = os.path.relpath(self.install_lib, - self.install_libbase) + install_suffix = os.path.relpath( + self.install_lib, + self.install_libbase, + ) if install_suffix == self._pth_contents: self.install_lib = self.install_libbase -- cgit v1.2.3 From 5642e413fb6c75434f109be943bdb09ea9e7ade2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Jul 2020 10:44:51 -0400 Subject: Extract function for restoring install lib to encapsulate behavior. --- setup.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 6290a746..6f6601fe 100755 --- a/setup.py +++ b/setup.py @@ -104,14 +104,15 @@ class install_with_pth(install): def finalize_options(self): install.finalize_options(self) + self._restore_install_lib() - # undo secondary effect of `extra_path` adding to `install_lib` - install_suffix = os.path.relpath( - self.install_lib, - self.install_libbase, - ) + def _restore_install_lib(self): + """ + Undo secondary effect of `extra_path` adding to `install_lib` + """ + suffix = os.path.relpath(self.install_lib, self.install_libbase) - if install_suffix == self._pth_contents: + if suffix == self._pth_contents: self.install_lib = self.install_libbase -- cgit v1.2.3 From 83a85a71cd779b1b1b3a44e21cc198264650da46 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Jul 2020 10:51:40 -0400 Subject: Restore early opt-in/opt-out for pth behavior. --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6f6601fe..2e44225e 100755 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ Distutils setup file, used to install or test 'setuptools' import os import sys +import textwrap import setuptools from setuptools.command.install import install @@ -96,7 +97,11 @@ class install_with_pth(install): """ _pth_name = 'distutils-precedence' - _pth_contents = 'import _distutils_hack.install' + _pth_contents = textwrap.dedent(""" + import os + enabled = os.environ.get('SETUPTOOLS_USE_DISTUTILS') == 'local' + enabled and __import__('_distutils_hack.install') + """).lstrip().replace('\n', '; ') def initialize_options(self): install.initialize_options(self) -- cgit v1.2.3 From 1251a231ad75fa649da700645690eb3c0a348f08 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Jul 2020 10:53:31 -0400 Subject: Replace install behavior on import with direct invocation (now that 'enabled' logic is duplicated in pth file). --- _distutils_hack/install.py | 5 ----- setup.py | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 _distutils_hack/install.py diff --git a/_distutils_hack/install.py b/_distutils_hack/install.py deleted file mode 100644 index 73f13b29..00000000 --- a/_distutils_hack/install.py +++ /dev/null @@ -1,5 +0,0 @@ -from . import enabled, add_shim - - -if enabled(): - add_shim() diff --git a/setup.py b/setup.py index 2e44225e..37953051 100755 --- a/setup.py +++ b/setup.py @@ -100,7 +100,7 @@ class install_with_pth(install): _pth_contents = textwrap.dedent(""" import os enabled = os.environ.get('SETUPTOOLS_USE_DISTUTILS') == 'local' - enabled and __import__('_distutils_hack.install') + enabled and __import__('_distutils_hack').add_shim() """).lstrip().replace('\n', '; ') def initialize_options(self): -- cgit v1.2.3 From 6c6d69e0213c4012caa36f0087f1fe54bac62c89 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Jul 2020 10:59:11 -0400 Subject: Move all but a small shim in override into _distutils_hack --- _distutils_hack/__init__.py | 51 +++++++++++++++++++++++++++++++++++++++++ _distutils_hack/override.py | 55 +-------------------------------------------- 2 files changed, 52 insertions(+), 54 deletions(-) diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index 3ad70100..a8638344 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -1,5 +1,11 @@ import sys import os +import re +import importlib +import warnings + + +is_pypy = '__pypy__' in sys.builtin_module_names def enabled(): @@ -10,6 +16,51 @@ def enabled(): return which == 'local' +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.") + mods = [name for name in sys.modules if re.match(r'distutils\b', name)] + for name in mods: + del sys.modules[name] + + +def ensure_local_distutils(): + clear_distutils() + distutils = importlib.import_module('setuptools._distutils') + distutils.__name__ = 'distutils' + sys.modules['distutils'] = distutils + + # sanity check that submodules load as expected + core = importlib.import_module('distutils.core') + assert '_distutils' in core.__file__, core.__file__ + + +def do_override(): + """ + Ensure that the local copy of distutils is preferred over stdlib. + + See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 + for more motivation. + """ + warn_distutils_present() + if enabled(): + ensure_local_distutils() + + class DistutilsMetaFinder: def find_spec(self, fullname, path, target=None): if path is not None or fullname != "distutils": diff --git a/_distutils_hack/override.py b/_distutils_hack/override.py index 523139bb..2cc433a4 100644 --- a/_distutils_hack/override.py +++ b/_distutils_hack/override.py @@ -1,54 +1 @@ -""" -Ensure that the local copy of distutils is preferred over stdlib. - -See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 -for more motivation. -""" - -import sys -import re -import importlib -import warnings - -from . import enabled - - -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.") - mods = [name for name in sys.modules if re.match(r'distutils\b', name)] - for name in mods: - del sys.modules[name] - - -def ensure_local_distutils(): - clear_distutils() - distutils = importlib.import_module('setuptools._distutils') - distutils.__name__ = 'distutils' - sys.modules['distutils'] = distutils - - # sanity check that submodules load as expected - core = importlib.import_module('distutils.core') - assert '_distutils' in core.__file__, core.__file__ - - -warn_distutils_present() -if enabled(): - ensure_local_distutils() +__import__('_distutils_hack').do_override() -- cgit v1.2.3 From 95b359c84ae05cb2fd37da194b67ee83c4eb9595 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 29 Jul 2020 22:08:30 +0300 Subject: The PyPA has adopted the PSF code of conduct For details, see: * https://discuss.python.org/t/implementing-pep-609-pypa-governance/4745 --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 9cbf7b86..824a033f 100644 --- a/README.rst +++ b/README.rst @@ -54,4 +54,4 @@ Code of Conduct Everyone interacting in the setuptools project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the -`PyPA Code of Conduct `_. +`PSF Code of Conduct `_. -- cgit v1.2.3 From 6af765910c71ead64b0093ac51db7592d1ad238c Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Sat, 1 Aug 2020 12:20:35 +1000 Subject: Fixed typo --- setuptools/monkey.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/monkey.py b/setuptools/monkey.py index 3c77f8cf..e5f1377b 100644 --- a/setuptools/monkey.py +++ b/setuptools/monkey.py @@ -138,7 +138,7 @@ def patch_for_msvc_specialized_compiler(): msvc = import_module('setuptools.msvc') if platform.system() != 'Windows': - # Compilers only availables on Microsoft Windows + # Compilers only available on Microsoft Windows return def patch_params(mod_name, func_name): -- cgit v1.2.3 From 1215561b96389403cbbd55889e54b67db873ddcb Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 2 Aug 2020 09:32:13 -0400 Subject: Suppress ImportError for winreg as the module is only available on some platforms. Allows unit testing of module on non-Windows platforms. --- distutils/_msvccompiler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/distutils/_msvccompiler.py b/distutils/_msvccompiler.py index 0e98692e..ef0f0b56 100644 --- a/distutils/_msvccompiler.py +++ b/distutils/_msvccompiler.py @@ -15,7 +15,9 @@ for older versions in distutils.msvc9compiler and distutils.msvccompiler. import os import subprocess -import winreg +import contextlib +with contextlib.suppress(ImportError): + import winreg from distutils.errors import DistutilsExecError, DistutilsPlatformError, \ CompileError, LibError, LinkError -- cgit v1.2.3 From 7f233974b0e3dc3692c820a2c8c3439c4d15fc70 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 2 Aug 2020 09:32:51 -0400 Subject: Add a unit test for testing spawn. Ref pypa/distutils#5. --- distutils/tests/test_msvccompiler.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/distutils/tests/test_msvccompiler.py b/distutils/tests/test_msvccompiler.py index b518d6a7..f4bb5162 100644 --- a/distutils/tests/test_msvccompiler.py +++ b/distutils/tests/test_msvccompiler.py @@ -2,6 +2,7 @@ import sys import unittest import os +import threading from distutils.errors import DistutilsPlatformError from distutils.tests import support @@ -74,6 +75,28 @@ class msvccompilerTestCase(support.TempdirManager, else: raise unittest.SkipTest("VS 2015 is not installed") + +class TestSpawn(unittest.TestCase): + def test_concurrent_safe(self): + """ + Concurrent calls to spawn should have consistent results. + """ + import distutils._msvccompiler as _msvccompiler + compiler = _msvccompiler.MSVCCompiler() + compiler._paths = "expected" + inner_cmd = 'import os; assert os.environ["PATH"] == "expected"' + command = ['python', '-c', inner_cmd] + + threads = [ + threading.Thread(target=compiler.spawn, args=[command]) + for n in range(100) + ] + for thread in threads: + thread.start() + for thread in threads: + thread.join() + + def test_suite(): return unittest.makeSuite(msvccompilerTestCase) -- cgit v1.2.3 From 39b30e15365756ae685e02b5af38799a677858af Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 2 Aug 2020 09:35:12 -0400 Subject: In TestSpawn.test_concurrent_safe, use CheckThread to ensure that the spawn call does not simply fail to execute. Ref pypa/setuptools#2257. --- distutils/tests/test_msvccompiler.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/distutils/tests/test_msvccompiler.py b/distutils/tests/test_msvccompiler.py index f4bb5162..88d912b1 100644 --- a/distutils/tests/test_msvccompiler.py +++ b/distutils/tests/test_msvccompiler.py @@ -76,6 +76,19 @@ class msvccompilerTestCase(support.TempdirManager, raise unittest.SkipTest("VS 2015 is not installed") +class CheckThread(threading.Thread): + exc_info = None + + def run(self): + try: + super().run() + except Exception: + self.exc_info = sys.exc_info() + + def __bool__(self): + return not self.exc_info + + class TestSpawn(unittest.TestCase): def test_concurrent_safe(self): """ @@ -88,13 +101,14 @@ class TestSpawn(unittest.TestCase): command = ['python', '-c', inner_cmd] threads = [ - threading.Thread(target=compiler.spawn, args=[command]) + CheckThread(target=compiler.spawn, args=[command]) for n in range(100) ] for thread in threads: thread.start() for thread in threads: thread.join() + assert all(threads) def test_suite(): -- cgit v1.2.3 From 0bb6c6bc47823764649430fca34fc6475c0a42d7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 2 Aug 2020 09:39:57 -0400 Subject: In CCompiler, allow keyword arguments to be passed to spawn calls. Ref pypa/setuptools#2257 and pypa/distutils#5. --- distutils/ccompiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py index b5ef143e..57bb94e8 100644 --- a/distutils/ccompiler.py +++ b/distutils/ccompiler.py @@ -906,8 +906,8 @@ int main (int argc, char **argv) { def execute(self, func, args, msg=None, level=1): execute(func, args, msg, self.dry_run) - def spawn(self, cmd): - spawn(cmd, dry_run=self.dry_run) + def spawn(self, cmd, **kwargs): + spawn(cmd, dry_run=self.dry_run, **kwargs) def move_file(self, src, dst): return move_file(src, dst, dry_run=self.dry_run) -- cgit v1.2.3 From 616e129944d87e578fe02146f07f72603a4c0124 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 2 Aug 2020 09:41:08 -0400 Subject: In _msvccompiler.MSVCCompiler.spawn, use correct capitalization for PATH environment variable. Fixes failing test and fixes pypa/setuptools#2257. --- distutils/_msvccompiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distutils/_msvccompiler.py b/distutils/_msvccompiler.py index ef0f0b56..2d56ee0a 100644 --- a/distutils/_msvccompiler.py +++ b/distutils/_msvccompiler.py @@ -503,7 +503,7 @@ class MSVCCompiler(CCompiler) : log.debug("skipping %s (up-to-date)", output_filename) def spawn(self, cmd): - env = dict(os.environ, path=self._paths) + env = dict(os.environ, PATH=self._paths) return super().spawn(cmd, env=env) # -- Miscellaneous methods ----------------------------------------- -- cgit v1.2.3 From a83d96eca1ea6d85a366351457dd25beb1663ad4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 2 Aug 2020 09:55:24 -0400 Subject: Add changelog. Ref #2257. --- changelog.d/2257.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2257.misc.rst diff --git a/changelog.d/2257.misc.rst b/changelog.d/2257.misc.rst new file mode 100644 index 00000000..509b372e --- /dev/null +++ b/changelog.d/2257.misc.rst @@ -0,0 +1 @@ +Fixed two flaws in distutils._msvccompiler.MSVCCompiler.spawn. -- cgit v1.2.3 From d3e754feba46b69bf948009d895303a74d2a41bd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 2 Aug 2020 09:57:20 -0400 Subject: =?UTF-8?q?Bump=20version:=2049.2.0=20=E2=86=92=2049.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 6 ++++++ changelog.d/2257.misc.rst | 1 - setup.cfg | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/2257.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 9b3e4085..b534af1b 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 49.2.0 +current_version = 49.2.1 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 82e6ef66..519330eb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v49.2.1 +------- + +* #2257: Fixed two flaws in distutils._msvccompiler.MSVCCompiler.spawn. + + v49.2.0 ------- diff --git a/changelog.d/2257.misc.rst b/changelog.d/2257.misc.rst deleted file mode 100644 index 509b372e..00000000 --- a/changelog.d/2257.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed two flaws in distutils._msvccompiler.MSVCCompiler.spawn. diff --git a/setup.cfg b/setup.cfg index fa0e5656..485714a3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ formats = zip [metadata] name = setuptools -version = 49.2.0 +version = 49.2.1 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org -- cgit v1.2.3 From 8db806d30d7591828528ac937e8f3b334e957ed3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Jul 2020 20:19:45 -0400 Subject: remove shim should by symmetric to add_shim --- _distutils_hack/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index a8638344..a10af2cc 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -91,6 +91,6 @@ def add_shim(): def remove_shim(): try: - sys.path.remove(DISTUTILS_FINDER) + sys.meta_path.remove(DISTUTILS_FINDER) except ValueError: pass -- cgit v1.2.3 From ebfe95fcbb12c22f58b045c6f10bd899a21a53d8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 5 Aug 2020 21:49:08 -0400 Subject: Update changelog. --- changelog.d/2259.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2259.change.rst diff --git a/changelog.d/2259.change.rst b/changelog.d/2259.change.rst new file mode 100644 index 00000000..43701ec2 --- /dev/null +++ b/changelog.d/2259.change.rst @@ -0,0 +1 @@ +Setuptools now provides a .pth file (except for editable installs of setuptools) to the target environment to ensure that when enabled, the setuptools-provided distutils is preferred before setuptools has been imported (and even if setuptools is never imported). Honors the SETUPTOOLS_USE_DISTUTILS environment variable. -- cgit v1.2.3 From 7c3a3817923de67956656ea058e80669b77bed1f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Aug 2020 11:44:12 -0400 Subject: Add tests capturing expected distutils behavior. Ref #417. --- setuptools/tests/test_distutils_adoption.py | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 setuptools/tests/test_distutils_adoption.py diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py new file mode 100644 index 00000000..f4c7072d --- /dev/null +++ b/setuptools/tests/test_distutils_adoption.py @@ -0,0 +1,37 @@ +import os +import pytest + + +@pytest.fixture +def env(virtualenv): + virtualenv.run(['pip', 'uninstall', '-y', 'setuptools']) + virtualenv.run(['pip', 'install', os.getcwd()]) + return virtualenv + + +def find_distutils(env, imports='distutils'): + py_cmd = 'import {imports}; print(distutils.__file__)'.format(**locals()) + cmd = ['python', '-c', py_cmd] + return env.run(cmd, capture=True, text=True) + + +def test_distutils_stdlib(env): + """ + Ensure stdlib distutils is used when appropriate. + """ + assert '.env' not in find_distutils(env).split(os.sep) + + +def test_distutils_local_with_setuptools(env): + """ + Ensure local distutils is used when appropriate. + """ + env.env.update(SETUPTOOLS_USE_DISTUTILS='local') + loc = find_distutils(env, imports='setuptools, distutils') + assert '.env' in loc.split(os.sep) + + +@pytest.mark.xfail(reason="#2259") +def test_distutils_local(env): + env.env.update(SETUPTOOLS_USE_DISTUTILS='local') + assert '.env' in find_distutils(env).split(os.sep) -- cgit v1.2.3 From 6281bd0917882b930d5923d76cc72ff4ee5a7695 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Aug 2020 12:15:13 -0400 Subject: Support Python 3.5 and 3.6 in the tests. --- setuptools/tests/test_distutils_adoption.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py index f4c7072d..a945a69f 100644 --- a/setuptools/tests/test_distutils_adoption.py +++ b/setuptools/tests/test_distutils_adoption.py @@ -1,7 +1,18 @@ import os +import sys +import functools + import pytest +def popen_text(call): + """ + Augment the Popen call with the parameters to ensure unicode text. + """ + return functools.partial(call, universal_newlines=True) \ + if sys.version_info < (3, 7) else functools.partial(call, text=True) + + @pytest.fixture def env(virtualenv): virtualenv.run(['pip', 'uninstall', '-y', 'setuptools']) @@ -12,7 +23,7 @@ def env(virtualenv): def find_distutils(env, imports='distutils'): py_cmd = 'import {imports}; print(distutils.__file__)'.format(**locals()) cmd = ['python', '-c', py_cmd] - return env.run(cmd, capture=True, text=True) + return popen_text(env.run)(cmd, capture=True) def test_distutils_stdlib(env): -- cgit v1.2.3 From 41deeb76fc88382f27b3d37cce75eda2c54cbc2a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Aug 2020 15:53:41 -0400 Subject: Bypass pytest-virtualenv due to bugs in 'run' command. Instead, use jaraco.envs.VirtualEnv and build a bespoke fixture with a run command. --- setup.cfg | 1 + setuptools/tests/requirements.txt | 1 + setuptools/tests/test_distutils_adoption.py | 48 ++++++++++++++++++----------- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/setup.cfg b/setup.cfg index 485714a3..87fa6bf2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -72,6 +72,7 @@ tests = paver; python_version>="3.6" futures; python_version=="2.7" pip>=19.1 # For proper file:// URLs support. + jaraco.envs docs = # Keep these in sync with docs/requirements.txt diff --git a/setuptools/tests/requirements.txt b/setuptools/tests/requirements.txt index 19bf5aef..d0d07f70 100644 --- a/setuptools/tests/requirements.txt +++ b/setuptools/tests/requirements.txt @@ -10,3 +10,4 @@ pytest-cov>=2.5.1 paver; python_version>="3.6" futures; python_version=="2.7" pip>=19.1 # For proper file:// URLs support. +jaraco.envs diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py index a945a69f..476b0a9e 100644 --- a/setuptools/tests/test_distutils_adoption.py +++ b/setuptools/tests/test_distutils_adoption.py @@ -1,8 +1,27 @@ import os import sys import functools +import subprocess import pytest +import jaraco.envs +import path + + +class VirtualEnv(jaraco.envs.VirtualEnv): + name = '.env' + + def run(self, cmd, *args, **kwargs): + cmd = [self.exe(cmd[0])] + cmd[1:] + return subprocess.check_output(cmd, *args, cwd=self.root, **kwargs) + + +@pytest.fixture +def venv(tmpdir): + env = VirtualEnv() + env.root = path.Path(tmpdir) + env.req = os.getcwd() + return env.create() def popen_text(call): @@ -13,36 +32,29 @@ def popen_text(call): if sys.version_info < (3, 7) else functools.partial(call, text=True) -@pytest.fixture -def env(virtualenv): - virtualenv.run(['pip', 'uninstall', '-y', 'setuptools']) - virtualenv.run(['pip', 'install', os.getcwd()]) - return virtualenv - - -def find_distutils(env, imports='distutils'): +def find_distutils(venv, imports='distutils', **kwargs): py_cmd = 'import {imports}; print(distutils.__file__)'.format(**locals()) cmd = ['python', '-c', py_cmd] - return popen_text(env.run)(cmd, capture=True) + return popen_text(venv.run)(cmd, **kwargs) -def test_distutils_stdlib(env): +def test_distutils_stdlib(venv): """ Ensure stdlib distutils is used when appropriate. """ - assert '.env' not in find_distutils(env).split(os.sep) + assert venv.name not in find_distutils(venv, env=dict()).split(os.sep) -def test_distutils_local_with_setuptools(env): +def test_distutils_local_with_setuptools(venv): """ Ensure local distutils is used when appropriate. """ - env.env.update(SETUPTOOLS_USE_DISTUTILS='local') - loc = find_distutils(env, imports='setuptools, distutils') - assert '.env' in loc.split(os.sep) + env = dict(SETUPTOOLS_USE_DISTUTILS='local') + loc = find_distutils(venv, imports='setuptools, distutils', env=env) + assert venv.name in loc.split(os.sep) @pytest.mark.xfail(reason="#2259") -def test_distutils_local(env): - env.env.update(SETUPTOOLS_USE_DISTUTILS='local') - assert '.env' in find_distutils(env).split(os.sep) +def test_distutils_local(venv): + env = dict(SETUPTOOLS_USE_DISTUTILS='local') + assert venv.name in find_distutils(venv, env=env).split(os.sep) -- cgit v1.2.3 From 47ae38fd6f233e6423404bfebfd24d3b98fb897c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Aug 2020 17:01:41 -0400 Subject: On Windows, SYSTEMROOT must be supplied. --- setuptools/tests/test_distutils_adoption.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py index 476b0a9e..7f28a217 100644 --- a/setuptools/tests/test_distutils_adoption.py +++ b/setuptools/tests/test_distutils_adoption.py @@ -2,6 +2,7 @@ import os import sys import functools import subprocess +import platform import pytest import jaraco.envs @@ -32,10 +33,12 @@ def popen_text(call): if sys.version_info < (3, 7) else functools.partial(call, text=True) -def find_distutils(venv, imports='distutils', **kwargs): +def find_distutils(venv, imports='distutils', env=None, **kwargs): py_cmd = 'import {imports}; print(distutils.__file__)'.format(**locals()) cmd = ['python', '-c', py_cmd] - return popen_text(venv.run)(cmd, **kwargs) + if platform.system() == 'Windows': + env['SYSTEMROOT'] = os.environ['SYSTEMROOT'] + return popen_text(venv.run)(cmd, env=env, **kwargs) def test_distutils_stdlib(venv): -- cgit v1.2.3 From 48a17a56ecfc77fb60780e3cfa75390f6bb10b15 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Aug 2020 12:22:05 -0400 Subject: As discovered in bpo-41509, relpath can strip spaces, so match that expectation. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 37953051..5d98c029 100755 --- a/setup.py +++ b/setup.py @@ -117,7 +117,7 @@ class install_with_pth(install): """ suffix = os.path.relpath(self.install_lib, self.install_libbase) - if suffix == self._pth_contents: + if suffix.strip() == self._pth_contents.strip(): self.install_lib = self.install_libbase -- cgit v1.2.3 From 6b70fb201d6a81448de6ca6f71d7091b9a26096c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Aug 2020 13:38:56 -0400 Subject: Restore location of 'enabled' --- _distutils_hack/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index a10af2cc..71fa7ce1 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -8,14 +8,6 @@ import warnings is_pypy = '__pypy__' in sys.builtin_module_names -def enabled(): - """ - Allow selection of distutils by environment variable. - """ - which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') - return which == 'local' - - def warn_distutils_present(): if 'distutils' not in sys.modules: return @@ -38,6 +30,14 @@ def clear_distutils(): del sys.modules[name] +def enabled(): + """ + Allow selection of distutils by environment variable. + """ + which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') + return which == 'local' + + def ensure_local_distutils(): clear_distutils() distutils = importlib.import_module('setuptools._distutils') -- cgit v1.2.3 From 521987da809e63ee51a63aa45dbe372d40deb8f7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Aug 2020 19:50:24 -0400 Subject: Remove expected fail. --- setuptools/tests/test_distutils_adoption.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py index 7f28a217..bb8e34d5 100644 --- a/setuptools/tests/test_distutils_adoption.py +++ b/setuptools/tests/test_distutils_adoption.py @@ -57,7 +57,10 @@ def test_distutils_local_with_setuptools(venv): assert venv.name in loc.split(os.sep) -@pytest.mark.xfail(reason="#2259") def test_distutils_local(venv): + """ + Even without importing, the setuptools-local copy of distutils is + preferred. + """ env = dict(SETUPTOOLS_USE_DISTUTILS='local') assert venv.name in find_distutils(venv, env=env).split(os.sep) -- cgit v1.2.3 From 7cf009a7e39270e1e1d13d913e0c352fb00534c0 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Aug 2020 20:58:57 -0400 Subject: Expect test to fail on PyPy due to implicit import during startup. --- setuptools/tests/test_distutils_adoption.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py index bb8e34d5..daccc473 100644 --- a/setuptools/tests/test_distutils_adoption.py +++ b/setuptools/tests/test_distutils_adoption.py @@ -9,6 +9,9 @@ import jaraco.envs import path +IS_PYPY = '__pypy__' in sys.builtin_module_names + + class VirtualEnv(jaraco.envs.VirtualEnv): name = '.env' @@ -57,6 +60,7 @@ def test_distutils_local_with_setuptools(venv): assert venv.name in loc.split(os.sep) +@pytest.mark.xfail('IS_PYPY', reason='pypy imports distutils on startup') def test_distutils_local(venv): """ Even without importing, the setuptools-local copy of distutils is -- cgit v1.2.3 From 9d7b246c0f40fabb25741a023849bf14919e408d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 9 Aug 2020 14:50:22 -0400 Subject: =?UTF-8?q?Bump=20version:=2049.2.1=20=E2=86=92=2049.3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 6 ++++++ changelog.d/2259.change.rst | 1 - setup.cfg | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/2259.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b534af1b..99e5def8 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 49.2.1 +current_version = 49.3.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 519330eb..da0eada3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v49.3.0 +------- + +* #2259: Setuptools now provides a .pth file (except for editable installs of setuptools) to the target environment to ensure that when enabled, the setuptools-provided distutils is preferred before setuptools has been imported (and even if setuptools is never imported). Honors the SETUPTOOLS_USE_DISTUTILS environment variable. + + v49.2.1 ------- diff --git a/changelog.d/2259.change.rst b/changelog.d/2259.change.rst deleted file mode 100644 index 43701ec2..00000000 --- a/changelog.d/2259.change.rst +++ /dev/null @@ -1 +0,0 @@ -Setuptools now provides a .pth file (except for editable installs of setuptools) to the target environment to ensure that when enabled, the setuptools-provided distutils is preferred before setuptools has been imported (and even if setuptools is never imported). Honors the SETUPTOOLS_USE_DISTUTILS environment variable. diff --git a/setup.cfg b/setup.cfg index 87fa6bf2..fd3b11e6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ formats = zip [metadata] name = setuptools -version = 49.2.1 +version = 49.3.0 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org -- cgit v1.2.3