From: JinWang An Date: Mon, 27 Mar 2023 08:02:58 +0000 (+0900) Subject: Imported Upstream version 65.7.0 X-Git-Tag: upstream/65.7.0^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b784504a8e4c8a36887fda05dae9ddcbf7927927;p=platform%2Fupstream%2Fpython-setuptools.git Imported Upstream version 65.7.0 --- diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 38dbe69..3428c6f 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 65.6.3 +current_version = 65.7.0 commit = True tag = True diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7413fa7..c1bebc4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,8 +14,10 @@ env: # Request colored output from CLI tools supporting it. Different tools # interpret the value differently. For some, just being set is sufficient. # For others, it must be a non-zero integer. For yet others, being set - # to a non-empty value is sufficient. - FORCE_COLOR: -106 + # to a non-empty value is sufficient. For tox, it must be one of + # , 0, 1, false, no, off, on, true, yes. The only enabling value + # in common is "1". + FORCE_COLOR: 1 # MyPy's color enforcement (must be a non-zero number) MYPY_FORCE_COLOR: -42 # Recognized by the `py` package, dependency of `pytest` (must be "1") @@ -43,13 +45,10 @@ jobs: test: strategy: matrix: - distutils: - - local python: - "3.7" - - "3.10" - # disabled due to #3365 - # - "3.11" + - "3.11" + - "3.12" # Workaround for actions/setup-python#508 dev: - -dev @@ -58,14 +57,22 @@ jobs: - macos-latest - windows-latest include: + - python: "3.8" + platform: ubuntu-latest + - python: "3.9" + platform: ubuntu-latest + - python: "3.10" + platform: ubuntu-latest - python: pypy3.9 platform: ubuntu-latest + distutils: stdlib - platform: ubuntu-latest python: "3.10" distutils: stdlib runs-on: ${{ matrix.platform }} + continue-on-error: ${{ matrix.python == '3.12' }} env: - SETUPTOOLS_USE_DISTUTILS: ${{ matrix.distutils }} + SETUPTOOLS_USE_DISTUTILS: ${{ matrix.distutils || 'local' }} timeout-minutes: 75 steps: - uses: actions/checkout@v3 @@ -104,12 +111,29 @@ jobs: VM-${{ matrix.platform }}, Py-${{ steps.python-install.outputs.python-version }} + docs: + runs-on: ubuntu-latest + env: + TOXENV: docs + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }}${{ matrix.dev }} + - name: Install tox + run: | + python -m pip install tox + - name: Run tests + run: tox + check: # This job does nothing and is only used for the branch protection if: always() needs: - integration-test - test + - docs - test_cygwin runs-on: ubuntu-latest diff --git a/CHANGES.rst b/CHANGES.rst index 4f4ede6..495d8aa 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,18 @@ +v65.7.0 +------- + + +Changes +^^^^^^^ +* #3594: Added ``htmlcov`` to FlatLayoutModuleFinder.DEFAULT_EXCLUDE -- by :user:`demianbrecht` +* #3667: Added a human-readable error description when ``.egg-info`` directory is not writeable -- by :user:`droodev` + +Misc +^^^^ +* #3713: Fixed incomplete ``getattr`` statement that caused problems when accessing + undefined attribute. + + v65.6.3 ------- diff --git a/README.rst b/README.rst index 86197e7..0bb27ab 100644 --- a/README.rst +++ b/README.rst @@ -14,7 +14,7 @@ .. image:: https://img.shields.io/readthedocs/setuptools/latest.svg :target: https://setuptools.pypa.io -.. image:: https://img.shields.io/badge/skeleton-2022-informational +.. image:: https://img.shields.io/badge/skeleton-2023-informational :target: https://blog.jaraco.com/skeleton .. image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white diff --git a/docs/build_meta.rst b/docs/build_meta.rst index 37738b8..08fd8a7 100644 --- a/docs/build_meta.rst +++ b/docs/build_meta.rst @@ -143,11 +143,11 @@ the ``_custom_build/backend.py`` file, as shown in the following example: build_sdist = _orig.build_sdist - def get_requires_for_build_wheel(self, config_settings=None): + def get_requires_for_build_wheel(config_settings=None): return _orig.get_requires_for_build_wheel(config_settings) + [...] - def get_requires_for_build_sdist(self, config_settings=None): + def get_requires_for_build_sdist(config_settings=None): return _orig.get_requires_for_build_sdist(config_settings) + [...] diff --git a/docs/conf.py b/docs/conf.py index 64c2625..831fcc8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 - extensions = [ 'sphinx.ext.autodoc', 'jaraco.packaging.sphinx', @@ -178,6 +176,7 @@ nitpick_ignore = [ ('envvar', 'DISTUTILS_DEBUG'), # undocumented ('envvar', 'HOME'), # undocumented ('envvar', 'PLAT'), # undocumented + ('envvar', 'DIST_EXTRA_CONFIG'), # undocumented ('py:attr', 'CCompiler.language_map'), # undocumented ('py:attr', 'CCompiler.language_order'), # undocumented ('py:class', 'distutils.dist.Distribution'), # undocumented diff --git a/docs/deprecated/distutils-legacy.rst b/docs/deprecated/distutils-legacy.rst index 63c8ff0..8112f12 100644 --- a/docs/deprecated/distutils-legacy.rst +++ b/docs/deprecated/distutils-legacy.rst @@ -13,7 +13,7 @@ Since the 60.0.0 release, Setuptools includes a local, vendored copy of distutil Unless ``SETUPTOOLS_USE_DISTUTILS=stdlib``, they will have no effect on the build process. You can still use a global user config file, ``~/.pydistutils.cfg`` (POSIX) or ``%USERPROFILE%/pydistutils.cfg`` (Windows), - or use the environment variable :doc:`DIST_EXTRA_CONFIG ` to point to another + or use the environment variable :ref:`DIST_EXTRA_CONFIG ` to point to another supplementary configuration file. @@ -24,7 +24,7 @@ As Distutils is deprecated, any usage of functions or objects from distutils is ``distutils.core.setup`` → ``setuptools.setup`` -``distutils.cmd.Command`` → ``setuptools.Command`` +``distutils.cmd.Command`` or ``distutils.core.Command`` → ``setuptools.Command`` ``distutils.command.{build_clib,build_ext,build_py,sdist}`` → ``setuptools.command.*`` diff --git a/docs/userguide/declarative_config.rst b/docs/userguide/declarative_config.rst index 3ef7b07..adedb0c 100644 --- a/docs/userguide/declarative_config.rst +++ b/docs/userguide/declarative_config.rst @@ -25,10 +25,13 @@ boilerplate code in some cases. [metadata] name = my_package version = attr: my_package.VERSION + author = Josiah Carberry + author_email = josiah_carberry@brown.edu description = My package description long_description = file: README.rst, CHANGELOG.rst, LICENSE.rst keywords = one, two - license = BSD 3-Clause License + python_requires = >=3.7 + license = BSD-3-Clause classifiers = Framework :: Django Programming Language :: Python :: 3 diff --git a/docs/userguide/pyproject_config.rst b/docs/userguide/pyproject_config.rst index cc811ed..633f4de 100644 --- a/docs/userguide/pyproject_config.rst +++ b/docs/userguide/pyproject_config.rst @@ -42,11 +42,14 @@ The ``project`` table contains metadata fields as described by [project] name = "my_package" + authors = [ + {name = "Josiah Carberry", email = "josiah_carberry@brown.edu"}, + ] description = "My package description" readme = "README.rst" requires-python = ">=3.7" keywords = ["one", "two"] - license = {text = "BSD 3-Clause License"} + license = {text = "BSD-3-Clause"} classifiers = [ "Framework :: Django", "Programming Language :: Python :: 3", @@ -187,13 +190,19 @@ of all given files and concatenate them in a single string. Key Directive Notes ========================== =================== ================================================================================================= ``version`` ``attr``, ``file`` -``readme`` ``file`` -``description`` ``file`` One-line text +``readme`` ``file`` Here you can also set ``"content-type"``: + + ``readme = {file = ["README", "USAGE"], content-type = "text/plain"}`` + + If ``content-type`` is not given, ``"text/x-rst"`` is used by default. +``description`` ``file`` One-line text (no line breaks) ``classifiers`` ``file`` Multi-line text with one classifier per line ``entry-points`` ``file`` INI format following :doc:`PyPUG:specifications/entry-points` (``console_scripts`` and ``gui_scripts`` can be included) -``dependencies`` ``file`` ``requirements.txt`` format (``#`` comments and blank lines excluded) **BETA** -``optional-dependencies`` ``file`` ``requirements.txt`` format per group (``#`` comments and blank lines excluded) **BETA** +``dependencies`` ``file`` *subset* of the ``requirements.txt`` format + (``#`` comments and blank lines excluded) **BETA** +``optional-dependencies`` ``file`` *subset* of the ``requirements.txt`` format per group + (``#`` comments and blank lines excluded) **BETA** ========================== =================== ================================================================================================= Supporting ``file`` for dependencies is meant for a convenience for packaging diff --git a/pytest.ini b/pytest.ini index 9d326e5..12007ad 100644 --- a/pytest.ini +++ b/pytest.ini @@ -10,6 +10,9 @@ filterwarnings= error ## upstream + # Ensure ResourceWarnings are emitted + default::ResourceWarning + # Suppress deprecation warning in flake8 ignore:SelectableGroups dict interface is deprecated::flake8 diff --git a/setup.cfg b/setup.cfg index 99c1bec..937b72c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = setuptools -version = 65.6.3 +version = 65.7.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages @@ -43,7 +43,9 @@ testing = # upstream pytest >= 6 pytest-checkdocs >= 2.4 - pytest-flake8 + pytest-flake8; \ + # workaround for tholo/pytest-flake8#87 + python_version < "3.12" # workaround for tholo/pytest-flake8#87 flake8 < 5 pytest-black >= 0.3.7; \ @@ -91,6 +93,9 @@ docs = jaraco.packaging >= 9 rst.linker >= 1.9 furo + sphinx-lint + + # tidelift jaraco.tidelift >= 1.4 # local diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 25888ed..95c8184 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -295,7 +295,11 @@ class egg_info(InfoCommon, Command): def run(self): self.mkpath(self.egg_info) - os.utime(self.egg_info, None) + try: + os.utime(self.egg_info, None) + except OSError as e: + msg = f"Cannot update time stamp of directory '{self.egg_info}'" + raise distutils.errors.DistutilsFileError(msg) from e for ep in metadata.entry_points(group='egg_info.writers'): writer = ep.load() writer(self, ep.name, os.path.join(self.egg_info, ep.name)) diff --git a/setuptools/config/pyprojecttoml.py b/setuptools/config/pyprojecttoml.py index d995f0b..fee6fac 100644 --- a/setuptools/config/pyprojecttoml.py +++ b/setuptools/config/pyprojecttoml.py @@ -112,7 +112,7 @@ def read_configuration( # `ini2toml` backfills include_package_data=False when nothing is explicitly given, # therefore setting a default here is backwards compatible. orig_setuptools_table = setuptools_table.copy() - if dist and getattr(dist, "include_package_data") is not None: + if dist and getattr(dist, "include_package_data", None) is not None: setuptools_table.setdefault("include-package-data", dist.include_package_data) else: setuptools_table.setdefault("include-package-data", True) diff --git a/setuptools/discovery.py b/setuptools/discovery.py index 98fc2a7..6244a18 100644 --- a/setuptools/discovery.py +++ b/setuptools/discovery.py @@ -273,6 +273,7 @@ class FlatLayoutModuleFinder(ModuleFinder): "benchmarks", "exercise", "exercises", + "htmlcov", # ---- Hidden files/Private modules ---- "[._]*", ) diff --git a/setuptools/tests/test_editable_install.py b/setuptools/tests/test_editable_install.py index c8ee747..4406eda 100644 --- a/setuptools/tests/test_editable_install.py +++ b/setuptools/tests/test_editable_install.py @@ -341,7 +341,7 @@ def test_editable_with_prefix(tmp_path, sample_project, editable_opts): site_packages.mkdir(parents=True) # install workaround - pip_run.launch.inject_sitecustomize(str(site_packages)) + pip_run.launch.inject_sitecustomize(site_packages) env = dict(os.environ, PYTHONPATH=str(site_packages)) cmd = [ diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 387773c..6a2a989 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -7,6 +7,7 @@ import stat import time from typing import List, Tuple from pathlib import Path +from unittest import mock import pytest from jaraco import path @@ -158,6 +159,21 @@ class TestEggInfo: ] assert sorted(actual) == expected + def test_handling_utime_error(self, tmpdir_cwd, env): + dist = Distribution() + ei = egg_info(dist) + utime_patch = mock.patch('os.utime', side_effect=OSError("TEST")) + mkpath_patch = mock.patch( + 'setuptools.command.egg_info.egg_info.mkpath', return_val=None + ) + + with utime_patch, mkpath_patch: + import distutils.errors + + msg = r"Cannot update time stamp of directory 'None'" + with pytest.raises(distutils.errors.DistutilsFileError, match=msg): + ei.run() + def test_license_is_a_string(self, tmpdir_cwd, env): setup_config = DALS(""" [metadata] diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 6535854..acfe04e 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -19,7 +19,7 @@ def pytest_virtualenv_works(venv): pytest_virtualenv may not work. if it doesn't, skip these tests. See #1284. """ - venv_prefix = venv.run(["python" , "-c", "import sys; print(sys.prefix)"]).strip() + venv_prefix = venv.run(["python", "-c", "import sys; print(sys.prefix)"]).strip() if venv_prefix == sys.prefix: pytest.skip("virtualenv is broken (see pypa/setuptools#1284)") @@ -55,18 +55,37 @@ def access_pypi(): 'pip_version', [ None, - pytest.param('pip<20', marks=pytest.mark.xfail(reason='pypa/pip#6599')), - 'pip<20.1', - 'pip<21', - 'pip<22', + pytest.param( + 'pip<20.1', + marks=pytest.mark.xfail( + 'sys.version_info > (3, 12)', + reason="pip 22 requried for Python 3.12 and later", + ), + ), + pytest.param( + 'pip<21', + marks=pytest.mark.xfail( + 'sys.version_info > (3, 12)', + reason="pip 22 requried for Python 3.12 and later", + ), + ), + pytest.param( + 'pip<22', + marks=pytest.mark.xfail( + 'sys.version_info > (3, 12)', + reason="pip 22 requried for Python 3.12 and later", + ), + ), + 'pip<23', pytest.param( 'https://github.com/pypa/pip/archive/main.zip', marks=pytest.mark.xfail(reason='#2975'), ), - ] + ], ) -def test_pip_upgrade_from_source(pip_version, venv_without_setuptools, - setuptools_wheel, setuptools_sdist): +def test_pip_upgrade_from_source( + pip_version, venv_without_setuptools, setuptools_wheel, setuptools_sdist +): """ Check pip can upgrade setuptools from source. """ @@ -90,10 +109,12 @@ def _check_test_command_install_requirements(venv, tmpdir): """ Check the test command will install all required dependencies. """ + def sdist(distname, version): dist_path = tmpdir.join('%s-%s.tar.gz' % (distname, version)) make_nspkg_sdist(str(dist_path), distname, version) return dist_path + dependency_links = [ pathlib.Path(str(dist_path)).as_uri() for dist_path in ( @@ -104,8 +125,9 @@ def _check_test_command_install_requirements(venv, tmpdir): ) ] with tmpdir.join('setup.py').open('w') as fp: - fp.write(DALS( - ''' + fp.write( + DALS( + ''' from setuptools import setup setup( @@ -127,17 +149,24 @@ def _check_test_command_install_requirements(venv, tmpdir): """, }} ) - '''.format(dependency_links=dependency_links))) + '''.format( + dependency_links=dependency_links + ) + ) + ) with tmpdir.join('test.py').open('w') as fp: - fp.write(DALS( - ''' + fp.write( + DALS( + ''' import foobar import bits import bobs import pieces open('success', 'w').close() - ''')) + ''' + ) + ) cmd = ["python", 'setup.py', 'test', '-s', 'test'] venv.run(cmd, cwd=str(tmpdir)) diff --git a/tox.ini b/tox.ini index e8d8efb..4a86329 100644 --- a/tox.ini +++ b/tox.ini @@ -40,6 +40,7 @@ extras = changedir = docs commands = python -m sphinx -W --keep-going . {toxinidir}/build/html + python -m sphinxlint [testenv:finalize] skip_install = True