diff options
| -rw-r--r-- | .bumpversion.cfg | 2 | ||||
| -rw-r--r-- | CHANGES.rst | 26 | ||||
| -rw-r--r-- | README.rst | 2 | ||||
| -rw-r--r-- | azure-pipelines.yml | 15 | ||||
| -rw-r--r-- | changelog.d/1698.doc.rst | 1 | ||||
| -rw-r--r-- | changelog.d/2040.change.rst | 1 | ||||
| -rw-r--r-- | changelog.d/2041.bugfix.rst | 1 | ||||
| -rw-r--r-- | changelog.d/2062.change.rst | 1 | ||||
| -rw-r--r-- | changelog.d/2082.misc.rst | 2 | ||||
| -rw-r--r-- | changelog.d/2086.change.rst | 1 | ||||
| -rw-r--r-- | docs/requirements.txt | 3 | ||||
| -rw-r--r-- | docs/setuptools.txt | 42 | ||||
| -rw-r--r-- | pkg_resources/__init__.py | 24 | ||||
| -rw-r--r-- | pkg_resources/tests/test_pkg_resources.py | 8 | ||||
| -rw-r--r-- | pkg_resources/tests/test_working_set.py | 4 | ||||
| -rw-r--r-- | setup.cfg | 3 | ||||
| -rw-r--r-- | setuptools/tests/__init__.py | 4 | ||||
| -rw-r--r-- | setuptools/tests/test_develop.py | 2 | ||||
| -rw-r--r-- | setuptools/tests/test_easy_install.py | 2 | ||||
| -rw-r--r-- | setuptools/tests/test_packageindex.py | 74 | ||||
| -rw-r--r-- | setuptools/tests/test_test.py | 4 | ||||
| -rw-r--r-- | setuptools/tests/test_virtualenv.py | 20 | ||||
| -rw-r--r-- | tools/finalize.py | 14 |
23 files changed, 156 insertions, 100 deletions
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 00cbdc7a..4ee92185 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 46.1.3 +current_version = 46.3.1 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index ac61c178..fd3c16ba 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,29 @@ +v46.3.1 +------- + +No significant changes. + + +v46.3.0 +------- + +* #2089: Package index functionality no longer attempts to remove an md5 fragment from the index URL. This functionality, added for distribute #163 is no longer relevant. +* #2041: Preserve file modes during pkg files copying, but clear read only flag for target afterwards. +* #2105: Filter ``2to3`` deprecation warnings from ``TestDevelop.test_2to3_user_mode``. + + +v46.2.0 +------- + +* #2040: Deprecated the ``bdist_wininst`` command. Binary packages should be built as wheels instead. +* #2062: Change 'Mac OS X' to 'macOS' in code. +* #2075: Stop recognizing files ending with ``.dist-info`` as distribution metadata. +* #2086: Deprecate 'use_2to3' functionality. Packagers are encouraged to use single-source solutions or build tool chains to manage conversions outside of setuptools. +* #1698: Added documentation for ``build_meta`` (a bare minimum, not completed). +* #2082: Filter ``lib2to3`` ``PendingDeprecationWarning`` and ``DeprecationWarning`` in tests, + because ``lib2to3`` is `deprecated in Python 3.9 <https://bugs.python.org/issue40360>`_. + + v46.1.3 ------- @@ -6,7 +6,7 @@ .. _PyPI link: https://pypi.org/project/setuptools -.. image:: https://dev.azure.com/jaraco/setuptools/_apis/build/status/jaraco.setuptools?branchName=master +.. image:: https://dev.azure.com/jaraco/setuptools/_apis/build/status/pypa.setuptools?branchName=master :target: https://dev.azure.com/jaraco/setuptools/_build/latest?definitionId=1&branchName=master .. image:: https://img.shields.io/travis/pypa/setuptools/master.svg?label=Linux%20CI&logo=travis&logoColor=white diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0253a770..ee772682 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,10 +11,12 @@ trigger: - '*' pool: - vmimage: 'Ubuntu-18.04' + vmImage: $(pool_vm_image) variables: - group: Azure secrets +- name: pool_vm_image + value: Ubuntu-18.04 stages: - stage: Test @@ -23,10 +25,17 @@ stages: - job: 'Test' strategy: matrix: - Python36: + Bionic Python 3.6: python.version: '3.6' - Python38: + Bionic Python 3.8: python.version: '3.8' + Windows: + python.version: '3.8' + pool_vm_image: vs2017-win2016 + MacOS: + python.version: '3.8' + pool_vm_image: macos-10.15 + maxParallel: 4 steps: diff --git a/changelog.d/1698.doc.rst b/changelog.d/1698.doc.rst deleted file mode 100644 index 90dc14c1..00000000 --- a/changelog.d/1698.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Added documentation for ``build_meta`` (a bare minimum, not completed). diff --git a/changelog.d/2040.change.rst b/changelog.d/2040.change.rst deleted file mode 100644 index b8f36f6f..00000000 --- a/changelog.d/2040.change.rst +++ /dev/null @@ -1 +0,0 @@ -Deprecated the ``bdist_wininst`` command. Binary packages should be built as wheels instead. diff --git a/changelog.d/2041.bugfix.rst b/changelog.d/2041.bugfix.rst deleted file mode 100644 index 8db757d8..00000000 --- a/changelog.d/2041.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Preserve file modes during pkg files copying, but clear read only flag for target afterwards. diff --git a/changelog.d/2062.change.rst b/changelog.d/2062.change.rst deleted file mode 100644 index 1f5fd812..00000000 --- a/changelog.d/2062.change.rst +++ /dev/null @@ -1 +0,0 @@ -Change 'Mac OS X' to 'macOS' in code. diff --git a/changelog.d/2082.misc.rst b/changelog.d/2082.misc.rst deleted file mode 100644 index 81ad5d58..00000000 --- a/changelog.d/2082.misc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Filter ``lib2to3`` ``PendingDeprecationWarning`` and ``DeprecationWarning`` in testes, -because ``lib2to3`` is `deprecated in Python 3.9 <https://bugs.python.org/issue40360>`_. diff --git a/changelog.d/2086.change.rst b/changelog.d/2086.change.rst deleted file mode 100644 index 9fa54e5a..00000000 --- a/changelog.d/2086.change.rst +++ /dev/null @@ -1 +0,0 @@ -Deprecate 'use_2to3' functionality. Packagers are encouraged to use single-source solutions or build tool chains to manage conversions outside of setuptools. diff --git a/docs/requirements.txt b/docs/requirements.txt index 6c35bf64..104d68fa 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,3 +2,6 @@ sphinx jaraco.packaging>=6.1 rst.linker>=1.9 +pygments-github-lexers==0.0.5 + +setuptools>=34 diff --git a/docs/setuptools.txt b/docs/setuptools.txt index 3500efbe..1000a0ce 100644 --- a/docs/setuptools.txt +++ b/docs/setuptools.txt @@ -123,6 +123,48 @@ Our apologies for the inconvenience, and thank you for your patience. +setup.cfg-only projects +======================= + +.. versionadded:: 40.9.0 + +If ``setup.py`` is missing from the project directory when a :pep:`517` +build is invoked, ``setuptools`` emulates a dummy ``setup.py`` file containing +only a ``setuptools.setup()`` call. + +.. note:: + + :pep:`517` doesn't support editable installs so this is currently + incompatible with ``pip install -e .``, as :pep:`517` does not support editable installs. + +This means that you can have a Python project with all build configuration +specified in ``setup.cfg``, without a ``setup.py`` file, if you **can rely +on** your project always being built by a :pep:`517`/:pep:`518` compatible +frontend. + +To use this feature: + +* Specify build requirements and :pep:`517` build backend in + ``pyproject.toml``. + For example: + + .. code-block:: toml + + [build-system] + requires = [ + "setuptools >= 40.9.0", + "wheel", + ] + build-backend = "setuptools.build_meta" + +* Use a :pep:`517` compatible build frontend, such as ``pip >= 19`` or ``pep517``. + + .. warning:: + + As :pep:`517` is new, support is not universal, and frontends that + do support it may still have bugs. For compatibility, you may want to + put a ``setup.py`` file containing only a ``setuptools.setup()`` + invocation. Configuration API diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index b0a49d86..edd3d2e8 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -55,7 +55,7 @@ except NameError: FileExistsError = OSError from pkg_resources.extern import six -from pkg_resources.extern.six.moves import urllib, map, filter +from pkg_resources.extern.six.moves import map, filter # capture these to bypass sandboxing from os import utime @@ -2069,11 +2069,14 @@ def find_on_path(importer, path_item, only=False): def dist_factory(path_item, entry, only): - """ - Return a dist_factory for a path_item and entry - """ + """Return a dist_factory for the given entry.""" lower = entry.lower() - is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info'))) + is_egg_info = lower.endswith('.egg-info') + is_dist_info = ( + lower.endswith('.dist-info') and + os.path.isdir(os.path.join(path_item, entry)) + ) + is_meta = is_egg_info or is_dist_info return ( distributions_from_metadata if is_meta else @@ -2543,15 +2546,6 @@ class EntryPoint: return maps -def _remove_md5_fragment(location): - if not location: - return '' - parsed = urllib.parse.urlparse(location) - if parsed[-1].startswith('md5='): - return urllib.parse.urlunparse(parsed[:-1] + ('',)) - return location - - def _version_from_file(lines): """ Given an iterable of lines from a Metadata file, return @@ -2608,7 +2602,7 @@ class Distribution: self.parsed_version, self.precedence, self.key, - _remove_md5_fragment(self.location), + self.location, self.py_version or '', self.platform or '', ) diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index 78281869..189a8668 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -330,6 +330,14 @@ def test_distribution_version_missing_undetected_path(): assert msg == expected +@pytest.mark.parametrize('only', [False, True]) +def test_dist_info_is_not_dir(tmp_path, only): + """Test path containing a file with dist-info extension.""" + dist_info = tmp_path / 'foobar.dist-info' + dist_info.touch() + assert not pkg_resources.dist_factory(str(tmp_path), str(dist_info), only) + + class TestDeepVersionLookupDistutils: @pytest.fixture def env(self, tmpdir): diff --git a/pkg_resources/tests/test_working_set.py b/pkg_resources/tests/test_working_set.py index b3ca4ea8..7a759bbb 100644 --- a/pkg_resources/tests/test_working_set.py +++ b/pkg_resources/tests/test_working_set.py @@ -14,8 +14,8 @@ __metaclass__ = type def strip_comments(s): return '\n'.join( - l for l in s.split('\n') - if l.strip() and not l.strip().startswith('#') + line for line in s.split('\n') + if line.strip() and not line.strip().startswith('#') ) @@ -16,7 +16,7 @@ formats = zip [metadata] name = setuptools -version = 46.1.3 +version = 46.3.1 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org @@ -78,3 +78,4 @@ docs = sphinx jaraco.packaging>=6.1 rst.linker>=1.9 + pygments-github-lexers==0.0.5 diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py index 9c77b51f..6377d785 100644 --- a/setuptools/tests/__init__.py +++ b/setuptools/tests/__init__.py @@ -6,7 +6,7 @@ from setuptools.extern.six import PY2, PY3 __all__ = [ - 'fail_on_ascii', 'py2_only', 'py3_only' + 'fail_on_ascii', 'py2_only', 'py3_only', 'ack_2to3' ] @@ -16,3 +16,5 @@ fail_on_ascii = pytest.mark.xfail(is_ascii, reason="Test fails in this locale") py2_only = pytest.mark.skipif(not PY2, reason="Test runs on Python 2 only") py3_only = pytest.mark.skipif(not PY3, reason="Test runs on Python 3 only") + +ack_2to3 = pytest.mark.filterwarnings('ignore:2to3 support is deprecated') diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 792975fd..bb89a865 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -17,6 +17,7 @@ import pytest from setuptools.command.develop import develop from setuptools.dist import Distribution +from setuptools.tests import ack_2to3 from . import contexts from . import namespaces @@ -65,6 +66,7 @@ class TestDevelop: @pytest.mark.skipif( in_virtualenv or in_venv, reason="Cannot run when invoked in a virtualenv or venv") + @ack_2to3 def test_2to3_user_mode(self, test_env): settings = dict( name='foo', diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 534392b9..3044cbd0 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -738,7 +738,7 @@ class TestSetupRequires: dep_2_0_url=dep_2_0_url, dep_2_0_sdist=dep_2_0_sdist, dep_2_0_python_requires=dep_2_0_python_requires, - ), 'utf-8') + ), 'utf-8') index_url = path_to_url(str(index)) with contexts.save_pkg_resources_state(): test_pkg = create_setup_requires_package( diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index 60d968fd..29aace13 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -3,15 +3,14 @@ from __future__ import absolute_import import sys import os import distutils.errors +import platform from setuptools.extern import six from setuptools.extern.six.moves import urllib, http_client import mock import pytest -import pkg_resources import setuptools.package_index -from setuptools.tests.server import IndexServer from .textwrap import DALS @@ -114,43 +113,6 @@ class TestPackageIndex: url = 'file:///tmp/test_package_index' assert index.url_ok(url, True) - def test_links_priority(self): - """ - Download links from the pypi simple index should be used before - external download links. - https://bitbucket.org/tarek/distribute/issue/163 - - Usecase : - - someone uploads a package on pypi, a md5 is generated - - someone manually copies this link (with the md5 in the url) onto an - external page accessible from the package page. - - someone reuploads the package (with a different md5) - - while easy_installing, an MD5 error occurs because the external link - is used - -> Setuptools should use the link from pypi, not the external one. - """ - if sys.platform.startswith('java'): - # Skip this test on jython because binding to :0 fails - return - - # start an index server - server = IndexServer() - server.start() - index_url = server.base_url() + 'test_links_priority/simple/' - - # scan a test index - pi = setuptools.package_index.PackageIndex(index_url) - requirement = pkg_resources.Requirement.parse('foobar') - pi.find_packages(requirement) - server.stop() - - # the distribution has been found - assert 'foobar' in pi - # we have only one link, because links are compared without md5 - assert len(pi['foobar']) == 1 - # the link should be from the index - assert 'correct_md5' in pi['foobar'][0].location - def test_parse_bdist_wininst(self): parse = setuptools.package_index.parse_bdist_wininst @@ -221,11 +183,11 @@ class TestPackageIndex: ('+ubuntu_0', '+ubuntu.0'), ] versions = [ - [''.join([e, r, p, l]) for l in ll] + [''.join([e, r, p, loc]) for loc in locs] for e in epoch for r in releases for p in sum([pre, post, dev], ['']) - for ll in local] + for locs in local] for v, vc in versions: dists = list(setuptools.package_index.distros_for_url( 'http://example.com/example.zip#egg=example-' + v)) @@ -322,17 +284,27 @@ class TestContentCheckers: assert rep == 'My message about md5' +@pytest.fixture +def temp_home(tmpdir, monkeypatch): + key = ( + 'USERPROFILE' + if platform.system() == 'Windows' and sys.version_info > (3, 8) else + 'HOME' + ) + + monkeypatch.setitem(os.environ, key, str(tmpdir)) + return tmpdir + + class TestPyPIConfig: - def test_percent_in_password(self, tmpdir, monkeypatch): - monkeypatch.setitem(os.environ, 'HOME', str(tmpdir)) - pypirc = tmpdir / '.pypirc' - with pypirc.open('w') as strm: - strm.write(DALS(""" - [pypi] - repository=https://pypi.org - username=jaraco - password=pity% - """)) + def test_percent_in_password(self, temp_home): + pypirc = temp_home / '.pypirc' + pypirc.write(DALS(""" + [pypi] + repository=https://pypi.org + username=jaraco + password=pity% + """)) cfg = setuptools.package_index.PyPIConfig() cred = cfg.creds_by_repository['https://pypi.org'] assert cred.username == 'jaraco' diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 0f77d8ff..892fd120 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -10,6 +10,7 @@ import pytest from setuptools.command.test import test from setuptools.dist import Distribution +from setuptools.tests import ack_2to3 from .textwrap import DALS @@ -73,9 +74,6 @@ def quiet_log(): log.set_verbosity(0) -ack_2to3 = pytest.mark.filterwarnings('ignore:2to3 support is deprecated') - - @pytest.mark.usefixtures('sample_test', 'quiet_log') @ack_2to3 def test_test(capfd): diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 6549a6c0..555273ae 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -57,10 +57,7 @@ def test_clean_env_install(bare_virtualenv): """ Check setuptools can be installed in a clean environment. """ - bare_virtualenv.run(' && '.join(( - 'cd {source}', - 'python setup.py install', - )).format(source=SOURCE_DIR)) + bare_virtualenv.run(['python', 'setup.py', 'install'], cd=SOURCE_DIR) def _get_pip_versions(): @@ -115,10 +112,9 @@ def test_pip_upgrade_from_source(pip_version, virtualenv): dist_dir = virtualenv.workspace # Generate source distribution / wheel. virtualenv.run(' && '.join(( - 'cd {source}', 'python setup.py -q sdist -d {dist}', 'python setup.py -q bdist_wheel -d {dist}', - )).format(source=SOURCE_DIR, dist=dist_dir)) + )).format(dist=dist_dir), cd=SOURCE_DIR) sdist = glob.glob(os.path.join(dist_dir, '*.zip'))[0] wheel = glob.glob(os.path.join(dist_dir, '*.whl'))[0] # Then update from wheel. @@ -183,10 +179,8 @@ def _check_test_command_install_requirements(virtualenv, tmpdir): open('success', 'w').close() ''')) # Run test command for test package. - virtualenv.run(' && '.join(( - 'cd {tmpdir}', - 'python setup.py test -s test', - )).format(tmpdir=tmpdir)) + virtualenv.run( + ['python', 'setup.py', 'test', '-s', 'test'], cd=str(tmpdir)) assert tmpdir.join('success').check() @@ -207,7 +201,5 @@ def test_no_missing_dependencies(bare_virtualenv): Quick and dirty test to ensure all external dependencies are vendored. """ for command in ('upload',): # sorted(distutils.command.__all__): - bare_virtualenv.run(' && '.join(( - 'cd {source}', - 'python setup.py {command} -h', - )).format(command=command, source=SOURCE_DIR)) + bare_virtualenv.run( + ['python', 'setup.py', command, '-h'], cd=SOURCE_DIR) diff --git a/tools/finalize.py b/tools/finalize.py index 5f284568..98b06c07 100644 --- a/tools/finalize.py +++ b/tools/finalize.py @@ -60,8 +60,22 @@ def ensure_config(): subprocess.check_output(['git', 'config', 'user.email']) +def check_changes(): + """ + Verify that all of the files in changelog.d have the appropriate + names. + """ + allowed = 'deprecation', 'breaking', 'change', 'doc', 'misc' + assert all( + any(key in file.name for key in allowed) + for file in pathlib.Path('changelog.d').iterdir() + if file.name != '.gitignore' + ) + + if __name__ == '__main__': print("Cutting release at", get_version()) ensure_config() + check_changes() update_changelog() bump_version() |
