From f423812ac13d67c2bda112bda6fab7dc7a3dab92 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Feb 2019 09:25:10 -0500 Subject: Move version to setup.cfg --- setup.cfg | 3 ++- setup.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index f0932e1c..14245edd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,6 +24,7 @@ universal = 1 [metadata] license_file = LICENSE +version = 40.8.0 -[bumpversion:file:setup.py] +[bumpversion:file:setup.cfg] diff --git a/setup.py b/setup.py index 8ec7ce06..78d7018c 100755 --- a/setup.py +++ b/setup.py @@ -89,7 +89,6 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="40.8.0", description=( "Easily download, build, install, upgrade, and uninstall " "Python packages" -- cgit v1.2.3 From fc61c27c1a96b371d9ffbafc2903aa045b4fab4e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Feb 2019 10:06:20 -0500 Subject: Move bumpversion config to .bumpversion.cfg as it seems not to be possible to handle setup.cfg. Ref c4urself/bump2version#62. --- .bumpversion.cfg | 6 ++++++ setup.cfg | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) create mode 100644 .bumpversion.cfg diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 00000000..f4e8b40b --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,6 @@ +[bumpversion] +current_version = 40.8.0 +commit = True +tag = True + +[bumpversion:file:setup.cfg] diff --git a/setup.cfg b/setup.cfg index 14245edd..7a0fac15 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,8 +1,3 @@ -[bumpversion] -current_version = 40.8.0 -commit = True -tag = True - [egg_info] tag_build = .post tag_date = 1 @@ -25,6 +20,3 @@ universal = 1 [metadata] license_file = LICENSE version = 40.8.0 - -[bumpversion:file:setup.cfg] - -- cgit v1.2.3 From 82db4c621974659513effae337d47a05e31fe7a5 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 28 Jan 2019 23:07:59 +0100 Subject: tests: improve `test_pip_upgrade_from_source` Parametrize the test to check different versions of pip (including master) are correctly supported. --- setuptools/tests/test_virtualenv.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 3d5c84b0..bd89fd64 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -52,10 +52,24 @@ def test_clean_env_install(bare_virtualenv): )).format(source=SOURCE_DIR)) -def test_pip_upgrade_from_source(virtualenv): +@pytest.mark.parametrize('pip_version', ( + 'pip==9.0.3', + 'pip==10.0.1', + 'pip==18.1', + 'pip==19.0.1', + 'https://github.com/pypa/pip/archive/master.zip', +)) +def test_pip_upgrade_from_source(virtualenv, pip_version): """ Check pip can upgrade setuptools from source. """ + # Install pip/wheel, and remove setuptools (as it + # should not be needed for bootstraping from source) + virtualenv.run(' && '.join(( + 'pip uninstall -y setuptools', + 'pip install -U wheel', + 'python -m pip install {pip_version}', + )).format(pip_version=pip_version)) dist_dir = virtualenv.workspace # Generate source distribution / wheel. virtualenv.run(' && '.join(( -- cgit v1.2.3 From b224605a8c16b2a713120bf0d484fa12ce781f02 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Thu, 7 Feb 2019 09:28:29 -0500 Subject: Automatically skip tests that require network --- setuptools/tests/test_virtualenv.py | 51 +++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index bd89fd64..d7b98c77 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -52,24 +52,55 @@ def test_clean_env_install(bare_virtualenv): )).format(source=SOURCE_DIR)) -@pytest.mark.parametrize('pip_version', ( - 'pip==9.0.3', - 'pip==10.0.1', - 'pip==18.1', - 'pip==19.0.1', - 'https://github.com/pypa/pip/archive/master.zip', -)) -def test_pip_upgrade_from_source(virtualenv, pip_version): +def _get_pip_versions(): + # This fixture will attempt to detect if tests are being run without + # network connectivity and if so skip some tests + + network = True + if not os.environ.get('NETWORK_REQUIRED', False): # pragma: nocover + try: + from urllib.request import urlopen + from urllib.error import URLError + except ImportError: + from urllib2 import urlopen, URLError # Python 2.7 compat + + try: + urlopen('https://pypi.org', timeout=1) + except URLError: + # No network, disable most of these tests + network = False + + network_versions = [ + 'pip==9.0.3', + 'pip==10.0.1', + 'pip==18.1', + 'pip==19.0.1', + 'https://github.com/pypa/pip/archive/master.zip', + ] + + versions = [None] + [ + pytest.param(v, **({} if network else {'marks': pytest.mark.skip})) + for v in network_versions + ] + + return versions + + +@pytest.mark.parametrize('pip_version', _get_pip_versions()) +def test_pip_upgrade_from_source(pip_version, virtualenv): """ Check pip can upgrade setuptools from source. """ # Install pip/wheel, and remove setuptools (as it # should not be needed for bootstraping from source) + if pip_version is None: + upgrade_pip = () + else: + upgrade_pip = ('python -m pip install -U {pip_version} --retries=1',) virtualenv.run(' && '.join(( 'pip uninstall -y setuptools', 'pip install -U wheel', - 'python -m pip install {pip_version}', - )).format(pip_version=pip_version)) + ) + upgrade_pip).format(pip_version=pip_version)) dist_dir = virtualenv.workspace # Generate source distribution / wheel. virtualenv.run(' && '.join(( -- cgit v1.2.3 From 675c690b4d8e55cd3c94a177d31b3a7937b2dd16 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Thu, 7 Feb 2019 09:28:29 -0500 Subject: Require network in CI builds --- .travis.yml | 1 + appveyor.yml | 1 + tox.ini | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d1febccb..09c3817e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,6 +63,7 @@ install: - "! grep pyc setuptools.egg-info/SOURCES.txt" script: + - export NETWORK_REQUIRED=1 - | ( # Run testsuite. if [ -z "$DISABLE_COVERAGE" ] diff --git a/appveyor.yml b/appveyor.yml index ef4a9f7e..7a3d174d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,7 @@ clone_depth: 50 environment: APPVEYOR: True + NETWORK_REQUIRED: True CODECOV_ENV: APPVEYOR_JOB_NAME matrix: diff --git a/tox.ini b/tox.ini index a31cb1c5..bb940ac0 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ list_dependencies_command={envbindir}/pip freeze setenv=COVERAGE_FILE={toxworkdir}/.coverage.{envname} # TODO: The passed environment variables came from copying other tox.ini files # These should probably be individually annotated to explain what needs them. -passenv=APPDATA HOMEDRIVE HOMEPATH windir APPVEYOR APPVEYOR_* CI CODECOV_* TRAVIS TRAVIS_* +passenv=APPDATA HOMEDRIVE HOMEPATH windir APPVEYOR APPVEYOR_* CI CODECOV_* TRAVIS TRAVIS_* NETWORK_REQUIRED commands=pytest --cov-config={toxinidir}/tox.ini --cov-report= {posargs} usedevelop=True -- cgit v1.2.3 From 0483cca44855280d25e7798680bb520da8923e16 Mon Sep 17 00:00:00 2001 From: Ratin_Kumar Date: Tue, 26 Feb 2019 20:55:00 +0530 Subject: Remove unwritten sections of the documentation (#1705) These sections of the documentation were never written, and refer to deprecated functionality anyway, so they can be removed. --- changelog.d/1705.doc.rst | 1 + docs/setuptools.txt | 36 ------------------------------------ 2 files changed, 1 insertion(+), 36 deletions(-) create mode 100644 changelog.d/1705.doc.rst diff --git a/changelog.d/1705.doc.rst b/changelog.d/1705.doc.rst new file mode 100644 index 00000000..a2ce9c2b --- /dev/null +++ b/changelog.d/1705.doc.rst @@ -0,0 +1 @@ +Removed some placeholder documentation sections referring to deprecated features. diff --git a/docs/setuptools.txt b/docs/setuptools.txt index a4e05d75..64b385cb 100644 --- a/docs/setuptools.txt +++ b/docs/setuptools.txt @@ -2679,42 +2679,6 @@ A few important points for writing revision control file finders: inform the user of the missing program(s). -Subclassing ``Command`` ------------------------ - -Sorry, this section isn't written yet, and neither is a lot of what's below -this point. - -XXX - - -Reusing ``setuptools`` Code -=========================== - -``ez_setup`` ------------- - -XXX - - -``setuptools.archive_util`` ---------------------------- - -XXX - - -``setuptools.sandbox`` ----------------------- - -XXX - - -``setuptools.package_index`` ----------------------------- - -XXX - - Mailing List and Bug Tracker ============================ -- cgit v1.2.3 From 5b2175ebd9f4a669097e8309a53e3b843dcbb218 Mon Sep 17 00:00:00 2001 From: robnagler Date: Tue, 26 Feb 2019 17:10:49 +0000 Subject: uniquify paths in PYTHONPATH When running in a complex environment with lots of installed packages, PYTHONPATH gets way too long. Instead, just make sure that paths_on_pythonpath doesn't contain duplicates --- setuptools/command/test.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/setuptools/command/test.py b/setuptools/command/test.py index dde0118c..997fd8b0 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -186,11 +186,12 @@ class test(Command): orig_pythonpath = os.environ.get('PYTHONPATH', nothing) current_pythonpath = os.environ.get('PYTHONPATH', '') try: - prefix = os.pathsep.join(paths) - to_join = filter(None, [prefix, current_pythonpath]) - new_path = os.pathsep.join(to_join) - if new_path: - os.environ['PYTHONPATH'] = new_path + to_join = [] + for x in list(paths) + current_pythonpath.split(os.pathsep): + if x not in to_join: + to_join.append(x) + if to_join: + os.environ['PYTHONPATH'] = os.pathsep.join(to_join) yield finally: if orig_pythonpath is nothing: -- cgit v1.2.3 From 16e452a42a3dbbb0ab3d3146ffa3b743cdca2539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 6 Mar 2019 15:22:28 +0100 Subject: Remove duplicate import io (#1713) Found by lgtm --- setuptools/dist.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index ddb1787a..6233d5dc 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -1103,7 +1103,6 @@ class Distribution(_Distribution): return _Distribution.handle_display_options(self, option_order) # Stdout may be StringIO (e.g. in tests) - import io if not isinstance(sys.stdout, io.TextIOWrapper): return _Distribution.handle_display_options(self, option_order) -- cgit v1.2.3 From 1aa781cd8ee638e7b403ebbd1caa82f8c7d4e6cd Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Sat, 16 Mar 2019 12:28:17 -0400 Subject: Add failing test for setup_requires Per GH #1682, with setuptools.build_meta we are not properly handling the situation where setup_requires is actually a newline-delimited string rather than a list, which is supported by setup.py interface. This adds several failing (and some passing) tests for how setup_requires is handled by setuptools.build_meta. --- setuptools/tests/test_build_meta.py | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 74969322..d9df8b2c 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -287,6 +287,52 @@ class TestBuildMetaBackend: with pytest.raises(ImportError): build_backend.build_sdist("temp") + @pytest.mark.parametrize('setup_literal, requirements', [ + pytest.param("'foo'", ['foo'], marks=pytest.mark.xfail), + ("['foo']", ['foo']), + pytest.param(r"'foo\n'", ['foo'], marks=pytest.mark.xfail), + pytest.param(r"'foo\n\n'", ['foo'], marks=pytest.mark.xfail), + ("['foo', 'bar']", ['foo', 'bar']), + pytest.param(r"'# Has a comment line\nfoo'", + ['foo'], marks=pytest.mark.xfail), + pytest.param(r"'foo # Has an inline comment'", + ['foo'], marks=pytest.mark.xfail), + pytest.param(r"'foo \\\n >=3.0'", + ['foo>=3.0'], marks=pytest.mark.xfail), + pytest.param(r"'foo\nbar'", ['foo', 'bar'], marks=pytest.mark.xfail), + pytest.param(r"'foo\nbar\n'", ['foo', 'bar'], marks=pytest.mark.xfail), + pytest.param(r"['foo\n', 'bar\n']", + ['foo', 'bar'], marks=pytest.mark.xfail), + ]) + def test_setup_requires(self, setup_literal, requirements, tmpdir_cwd): + + files = { + 'setup.py': DALS(""" + from setuptools import setup + + setup( + name="qux", + version="0.0.0", + py_modules=["hello.py"], + setup_requires={setup_literal}, + ) + """).format(setup_literal=setup_literal), + 'hello.py': DALS(""" + def run(): + print('hello') + """), + } + + build_files(files) + + build_backend = self.get_build_backend() + + # Ensure that the build requirements are properly parsed + expected = sorted(['wheel'] + requirements) + actual = build_backend.get_requires_for_build_wheel() + + assert expected == sorted(actual) + class TestBuildMetaLegacyBackend(TestBuildMetaBackend): backend_name = 'setuptools.build_meta:__legacy__' -- cgit v1.2.3 From 318f739d14a810042e6803fa3eb4c4e140f0ef88 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Sat, 16 Mar 2019 12:53:05 -0400 Subject: Add requirement parsing in setuptools.build_meta This fixes GH #1682 by porting the pkg_resources requirement parsing logic into setuptools.build_meta, so that all valid requirement specifiers passed to setup_requires will be added to the get_requires_for_build_* function outputs. Fixes GH #1682 --- setuptools/build_meta.py | 45 ++++++++++++++++++++++++++++++++++++- setuptools/tests/test_build_meta.py | 22 ++++++++---------- 2 files changed, 53 insertions(+), 14 deletions(-) diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index 047cc07b..fb37c02a 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -36,6 +36,8 @@ import contextlib import setuptools import distutils +from setuptools._vendor import six + __all__ = ['get_requires_for_build_sdist', 'get_requires_for_build_wheel', 'prepare_metadata_for_build_wheel', @@ -51,7 +53,9 @@ class SetupRequirementsError(BaseException): class Distribution(setuptools.dist.Distribution): def fetch_build_eggs(self, specifiers): - raise SetupRequirementsError(specifiers) + specifier_list = self._parse_requirements(specifiers) + + raise SetupRequirementsError(specifier_list) @classmethod @contextlib.contextmanager @@ -68,6 +72,45 @@ class Distribution(setuptools.dist.Distribution): finally: distutils.core.Distribution = orig + def _yield_lines(self, strs): + """Yield non-empty/non-comment lines of a string or sequence""" + if isinstance(strs, six.string_types): + for s in strs.splitlines(): + s = s.strip() + # skip blank lines/comments + if s and not s.startswith('#'): + yield s + else: + for ss in strs: + for s in self._yield_lines(ss): + yield s + + def _parse_requirements(self, strs): + """Parse requirement specifiers into a list of requirement strings + + This is forked from pkg_resources.parse_requirements. + + `strs` must be a string, or a (possibly-nested) iterable thereof. + """ + # create a steppable iterator, so we can handle \-continuations + lines = iter(self._yield_lines(strs)) + + requirements = [] + + for line in lines: + # Drop comments -- a hash without a space may be in a URL. + if ' #' in line: + line = line[:line.find(' #')] + # If there is a line continuation, drop it, and append the next line. + if line.endswith('\\'): + line = line[:-2].strip() + try: + line += next(lines) + except StopIteration: + return + requirements.append(line) + + return requirements def _to_str(s): """ diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index d9df8b2c..a14a3c7a 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -288,21 +288,17 @@ class TestBuildMetaBackend: build_backend.build_sdist("temp") @pytest.mark.parametrize('setup_literal, requirements', [ - pytest.param("'foo'", ['foo'], marks=pytest.mark.xfail), + ("'foo'", ['foo']), ("['foo']", ['foo']), - pytest.param(r"'foo\n'", ['foo'], marks=pytest.mark.xfail), - pytest.param(r"'foo\n\n'", ['foo'], marks=pytest.mark.xfail), + (r"'foo\n'", ['foo']), + (r"'foo\n\n'", ['foo']), ("['foo', 'bar']", ['foo', 'bar']), - pytest.param(r"'# Has a comment line\nfoo'", - ['foo'], marks=pytest.mark.xfail), - pytest.param(r"'foo # Has an inline comment'", - ['foo'], marks=pytest.mark.xfail), - pytest.param(r"'foo \\\n >=3.0'", - ['foo>=3.0'], marks=pytest.mark.xfail), - pytest.param(r"'foo\nbar'", ['foo', 'bar'], marks=pytest.mark.xfail), - pytest.param(r"'foo\nbar\n'", ['foo', 'bar'], marks=pytest.mark.xfail), - pytest.param(r"['foo\n', 'bar\n']", - ['foo', 'bar'], marks=pytest.mark.xfail), + (r"'# Has a comment line\nfoo'", ['foo']), + (r"'foo # Has an inline comment'", ['foo']), + (r"'foo \\\n >=3.0'", ['foo>=3.0']), + (r"'foo\nbar'", ['foo', 'bar']), + (r"'foo\nbar\n'", ['foo', 'bar']), + (r"['foo\n', 'bar\n']", ['foo', 'bar']), ]) def test_setup_requires(self, setup_literal, requirements, tmpdir_cwd): -- cgit v1.2.3 From b54d4c699fc4e1692dadd19bdd7cbcde1c844976 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Sat, 16 Mar 2019 12:57:57 -0400 Subject: Extend requirement parsing tests to sdists --- setuptools/tests/test_build_meta.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index a14a3c7a..0bdea2d6 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -300,7 +300,9 @@ class TestBuildMetaBackend: (r"'foo\nbar\n'", ['foo', 'bar']), (r"['foo\n', 'bar\n']", ['foo', 'bar']), ]) - def test_setup_requires(self, setup_literal, requirements, tmpdir_cwd): + @pytest.mark.parametrize('use_wheel', [True, False]) + def test_setup_requires(self, setup_literal, requirements, use_wheel, + tmpdir_cwd): files = { 'setup.py': DALS(""" @@ -323,9 +325,16 @@ class TestBuildMetaBackend: build_backend = self.get_build_backend() + if use_wheel: + base_requirements = ['wheel'] + get_requires = build_backend.get_requires_for_build_wheel + else: + base_requirements = [] + get_requires = build_backend.get_requires_for_build_sdist + # Ensure that the build requirements are properly parsed - expected = sorted(['wheel'] + requirements) - actual = build_backend.get_requires_for_build_wheel() + expected = sorted(base_requirements + requirements) + actual = get_requires() assert expected == sorted(actual) -- cgit v1.2.3 From e33a714f9a9342e7aa035b22eaf29433fd58ba86 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Sat, 16 Mar 2019 13:05:29 -0400 Subject: Add changelog for PR #1720 --- changelog.d/1720.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1720.change.rst diff --git a/changelog.d/1720.change.rst b/changelog.d/1720.change.rst new file mode 100644 index 00000000..a0d8fb35 --- /dev/null +++ b/changelog.d/1720.change.rst @@ -0,0 +1 @@ +Added support for ``pkg_resources.parse_requirements``-style requirements in ``setup_requires`` when ``setup.py`` is invoked from the ``setuptools.build_meta`` build backend. -- cgit v1.2.3 From c27c705f6a326e4820f1a34d6ce1db101dad3a30 Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Sat, 16 Mar 2019 10:06:53 -0700 Subject: Fix typo in docstring (#1718) --- setuptools/dist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index 6233d5dc..e6d08b92 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -885,7 +885,7 @@ class Distribution(_Distribution): def include(self, **attrs): """Add items to distribution that are named in keyword arguments - For example, 'dist.exclude(py_modules=["x"])' would add 'x' to + For example, 'dist.include(py_modules=["x"])' would add 'x' to the distribution's 'py_modules' attribute, if it was not already there. -- cgit v1.2.3 From 5efdf816fddcd8fbc9c3d1e6867a25848b1f9a06 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Sat, 16 Mar 2019 13:24:36 -0400 Subject: Use pkg_resources.parse_requirements in build_meta Since pkg_resources is imported elsewhere anyway, we don't get much value out of porting the requirement parser locally. --- setuptools/build_meta.py | 43 ++----------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index fb37c02a..47cbcbf6 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -36,7 +36,7 @@ import contextlib import setuptools import distutils -from setuptools._vendor import six +from pkg_resources import parse_requirements __all__ = ['get_requires_for_build_sdist', 'get_requires_for_build_wheel', @@ -53,7 +53,7 @@ class SetupRequirementsError(BaseException): class Distribution(setuptools.dist.Distribution): def fetch_build_eggs(self, specifiers): - specifier_list = self._parse_requirements(specifiers) + specifier_list = list(map(str, parse_requirements(specifiers))) raise SetupRequirementsError(specifier_list) @@ -72,45 +72,6 @@ class Distribution(setuptools.dist.Distribution): finally: distutils.core.Distribution = orig - def _yield_lines(self, strs): - """Yield non-empty/non-comment lines of a string or sequence""" - if isinstance(strs, six.string_types): - for s in strs.splitlines(): - s = s.strip() - # skip blank lines/comments - if s and not s.startswith('#'): - yield s - else: - for ss in strs: - for s in self._yield_lines(ss): - yield s - - def _parse_requirements(self, strs): - """Parse requirement specifiers into a list of requirement strings - - This is forked from pkg_resources.parse_requirements. - - `strs` must be a string, or a (possibly-nested) iterable thereof. - """ - # create a steppable iterator, so we can handle \-continuations - lines = iter(self._yield_lines(strs)) - - requirements = [] - - for line in lines: - # Drop comments -- a hash without a space may be in a URL. - if ' #' in line: - line = line[:line.find(' #')] - # If there is a line continuation, drop it, and append the next line. - if line.endswith('\\'): - line = line[:-2].strip() - try: - line += next(lines) - except StopIteration: - return - requirements.append(line) - - return requirements def _to_str(s): """ -- cgit v1.2.3 From d8b901bc15e2e365c7994cd65758f4181f3d9175 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 19 Mar 2019 08:52:44 -0400 Subject: Add section on reporting security vulnerabilities through Tidelift. --- README.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.rst b/README.rst index bfbaaad8..dac8a468 100644 --- a/README.rst +++ b/README.rst @@ -29,6 +29,10 @@ Bug reports and especially tested patches may be submitted directly to the `bug tracker `_. +To report a security vulnerability, please use the +`Tidelift security contact `_. +Tidelift will coordinate the fix and disclosure. + Code of Conduct --------------- -- cgit v1.2.3 From e01330a5f42e850e0ce6ec3710b8a08669ea4219 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Tue, 2 Apr 2019 16:52:38 -0400 Subject: Pin pypy2.7 version in Travis There is some issue with pypy2.7-5.8.0 in Travis. This probably does not solve the *root* issue, but updating the pypy version does seem to fix the build, so in the interest of unblocking the project, we will merge this change. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 09c3817e..a5b670e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,8 @@ jobs: python: 2.7 - <<: *latest_py2 env: LANG=C - - python: pypy + - python: pypy2.7-6.0.0 + dist: xenial env: DISABLE_COVERAGE=1 # Don't run coverage on pypy (too slow). - python: pypy3 env: DISABLE_COVERAGE=1 -- cgit v1.2.3 From 52939bcc8f549f6c8fef4bf76e09a20d0bf62e44 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Thu, 21 Feb 2019 15:58:59 -0800 Subject: Add Distribution._get_version() for DRY --- pkg_resources/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 5d66f6e0..e8921f95 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2661,7 +2661,7 @@ class Distribution: try: return self._version except AttributeError: - version = _version_from_file(self._get_metadata(self.PKG_INFO)) + version = self._get_version() if version is None: tmpl = "Missing 'Version:' header and/or %s file" raise ValueError(tmpl % self.PKG_INFO, self) @@ -2727,6 +2727,12 @@ class Distribution: for line in self.get_metadata_lines(name): yield line + def _get_version(self): + lines = self._get_metadata(self.PKG_INFO) + version = _version_from_file(lines) + + return version + def activate(self, path=None, replace=False): """Ensure distribution is importable on `path` (default=sys.path)""" if path is None: @@ -2945,7 +2951,7 @@ class EggInfoDistribution(Distribution): take an extra step and try to get the version number from the metadata file itself instead of the filename. """ - md_version = _version_from_file(self._get_metadata(self.PKG_INFO)) + md_version = self._get_version() if md_version: self._version = md_version return self -- cgit v1.2.3 From 80ec85c55b1470df6541473f674f41bdc6bc5268 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Fri, 22 Feb 2019 04:15:07 -0800 Subject: Include file path when Version: missing Related to pip's github issue pypa/pip#6194. This has come up in pip's issue tracker (github) multiple times: - pypa/pip#6177 - pypa/pip#6283 - pypa/pip#6194 --- changelog.d/1664.change.rst | 2 + pkg_resources/__init__.py | 37 ++++++++++++-- pkg_resources/tests/test_pkg_resources.py | 84 +++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 changelog.d/1664.change.rst diff --git a/changelog.d/1664.change.rst b/changelog.d/1664.change.rst new file mode 100644 index 00000000..85e40a39 --- /dev/null +++ b/changelog.d/1664.change.rst @@ -0,0 +1,2 @@ +Added the path to the ``PKG-INFO`` or ``METADATA`` file in the exception +text when the ``Version:`` header can't be found. diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index e8921f95..97e08d68 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -1403,8 +1403,15 @@ class NullProvider: def has_resource(self, resource_name): return self._has(self._fn(self.module_path, resource_name)) + def _get_metadata_path(self, name): + return self._fn(self.egg_info, name) + def has_metadata(self, name): - return self.egg_info and self._has(self._fn(self.egg_info, name)) + if not self.egg_info: + return self.egg_info + + path = self._get_metadata_path(name) + return self._has(path) def get_metadata(self, name): if not self.egg_info: @@ -1868,6 +1875,9 @@ class FileMetadata(EmptyProvider): def __init__(self, path): self.path = path + def _get_metadata_path(self, name): + return self.path + def has_metadata(self, name): return name == 'PKG-INFO' and os.path.isfile(self.path) @@ -2663,8 +2673,12 @@ class Distribution: except AttributeError: version = self._get_version() if version is None: - tmpl = "Missing 'Version:' header and/or %s file" - raise ValueError(tmpl % self.PKG_INFO, self) + path = self._get_metadata_path_for_display(self.PKG_INFO) + msg = ( + "Missing 'Version:' header and/or {} file at path: {}" + ).format(self.PKG_INFO, path) + raise ValueError(msg, self) + return version @property @@ -2722,6 +2736,23 @@ class Distribution: ) return deps + def _get_metadata_path_for_display(self, name): + """ + Return the path to the given metadata file, if available. + """ + try: + # We need to access _get_metadata_path() on the provider object + # directly rather than through this class's __getattr__() + # since _get_metadata_path() is marked private. + path = self._provider._get_metadata_path(name) + + # Handle exceptions e.g. in case the distribution's metadata + # provider doesn't support _get_metadata_path(). + except Exception: + return '[could not detect]' + + return path + def _get_metadata(self, name): if self.has_metadata(name): for line in self.get_metadata_lines(name): diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index 2c2c9c7f..fb77c685 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -17,6 +17,7 @@ try: except ImportError: import mock +from pkg_resources import DistInfoDistribution, Distribution, EggInfoDistribution from pkg_resources.extern.six.moves import map from pkg_resources.extern.six import text_type, string_types @@ -190,6 +191,89 @@ class TestResourceManager: subprocess.check_call(cmd) +# TODO: remove this in favor of Path.touch() when Python 2 is dropped. +def touch_file(path): + """ + Create an empty file. + """ + with open(path, 'w'): + pass + + +def make_distribution_no_version(tmpdir, basename): + """ + Create a distribution directory with no file containing the version. + """ + # Convert the LocalPath object to a string before joining. + dist_dir = os.path.join(str(tmpdir), basename) + os.mkdir(dist_dir) + # Make the directory non-empty so distributions_from_metadata() + # will detect it and yield it. + touch_file(os.path.join(dist_dir, 'temp.txt')) + + dists = list(pkg_resources.distributions_from_metadata(dist_dir)) + assert len(dists) == 1 + dist, = dists + + return dist, dist_dir + + +@pytest.mark.parametrize( + 'suffix, expected_filename, expected_dist_type', + [ + ('egg-info', 'PKG-INFO', EggInfoDistribution), + ('dist-info', 'METADATA', DistInfoDistribution), + ], +) +def test_distribution_version_missing(tmpdir, suffix, expected_filename, + expected_dist_type): + """ + Test Distribution.version when the "Version" header is missing. + """ + basename = 'foo.{}'.format(suffix) + dist, dist_dir = make_distribution_no_version(tmpdir, basename) + + expected_text = ( + "Missing 'Version:' header and/or {} file at path: " + ).format(expected_filename) + metadata_path = os.path.join(dist_dir, expected_filename) + + # Now check the exception raised when the "version" attribute is accessed. + with pytest.raises(ValueError) as excinfo: + dist.version + + err = str(excinfo) + # Include a string expression after the assert so the full strings + # will be visible for inspection on failure. + assert expected_text in err, str((expected_text, err)) + + # Also check the args passed to the ValueError. + msg, dist = excinfo.value.args + assert expected_text in msg + # Check that the message portion contains the path. + assert metadata_path in msg, str((metadata_path, msg)) + assert type(dist) == expected_dist_type + + +def test_distribution_version_missing_undetected_path(): + """ + Test Distribution.version when the "Version" header is missing and + the path can't be detected. + """ + # Create a Distribution object with no metadata argument, which results + # in an empty metadata provider. + dist = Distribution('/foo') + with pytest.raises(ValueError) as excinfo: + dist.version + + msg, dist = excinfo.value.args + expected = ( + "Missing 'Version:' header and/or PKG-INFO file at path: " + '[could not detect]' + ) + assert msg == expected + + class TestDeepVersionLookupDistutils: @pytest.fixture def env(self, tmpdir): -- cgit v1.2.3 From d24a1adb6a3b8a702eb5033bb1728cde428e5a6f Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Wed, 3 Apr 2019 14:25:01 -0400 Subject: Update changelog for version 40.9.0 --- CHANGES.rst | 10 ++++++++++ changelog.d/1664.change.rst | 2 -- changelog.d/1675.change.rst | 1 - changelog.d/1705.doc.rst | 1 - changelog.d/1720.change.rst | 1 - 5 files changed, 10 insertions(+), 5 deletions(-) delete mode 100644 changelog.d/1664.change.rst delete mode 100644 changelog.d/1675.change.rst delete mode 100644 changelog.d/1705.doc.rst delete mode 100644 changelog.d/1720.change.rst diff --git a/CHANGES.rst b/CHANGES.rst index b043e449..2a8d432a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,13 @@ +v40.9.0 +------- + +* #1675: Added support for ``setup.cfg``-only projects when using the ``setuptools.build_meta`` backend. Projects that have enabled PEP 517 no longer need to have a ``setup.py`` and can use the purely declarative ``setup.cfg`` configuration file instead. +* #1720: Added support for ``pkg_resources.parse_requirements``-style requirements in ``setup_requires`` when ``setup.py`` is invoked from the ``setuptools.build_meta`` build backend. +* #1664: Added the path to the ``PKG-INFO`` or ``METADATA`` file in the exception + text when the ``Version:`` header can't be found. +* #1705: Removed some placeholder documentation sections referring to deprecated features. + + v40.8.0 ------- diff --git a/changelog.d/1664.change.rst b/changelog.d/1664.change.rst deleted file mode 100644 index 85e40a39..00000000 --- a/changelog.d/1664.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added the path to the ``PKG-INFO`` or ``METADATA`` file in the exception -text when the ``Version:`` header can't be found. diff --git a/changelog.d/1675.change.rst b/changelog.d/1675.change.rst deleted file mode 100644 index e9067628..00000000 --- a/changelog.d/1675.change.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for ``setup.cfg``-only projects when using the ``setuptools.build_meta`` backend. Projects that have enabled PEP 517 no longer need to have a ``setup.py`` and can use the purely declarative ``setup.cfg`` configuration file instead. diff --git a/changelog.d/1705.doc.rst b/changelog.d/1705.doc.rst deleted file mode 100644 index a2ce9c2b..00000000 --- a/changelog.d/1705.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Removed some placeholder documentation sections referring to deprecated features. diff --git a/changelog.d/1720.change.rst b/changelog.d/1720.change.rst deleted file mode 100644 index a0d8fb35..00000000 --- a/changelog.d/1720.change.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for ``pkg_resources.parse_requirements``-style requirements in ``setup_requires`` when ``setup.py`` is invoked from the ``setuptools.build_meta`` build backend. -- cgit v1.2.3 From dd522e601426ad35644022278ca2a09a7cc542ad Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Wed, 3 Apr 2019 14:43:31 -0400 Subject: =?UTF-8?q?Bump=20version:=2040.8.0=20=E2=86=92=2040.9.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 3 ++- setup.cfg | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f4e8b40b..9840c086 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,6 +1,7 @@ [bumpversion] -current_version = 40.8.0 +current_version = 40.9.0 commit = True tag = True [bumpversion:file:setup.cfg] + diff --git a/setup.cfg b/setup.cfg index 7a0fac15..01fe6ae9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,4 +19,4 @@ universal = 1 [metadata] license_file = LICENSE -version = 40.8.0 +version = 40.9.0 -- cgit v1.2.3 From 393809a02ed4d0f07faec5c1f23384233e6cd68e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 09:27:23 -0400 Subject: Feed the hobgoblins (delint). --- setuptools/dist.py | 5 ++--- setuptools/tests/test_config.py | 11 +++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index e6d08b92..ae380290 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -11,7 +11,6 @@ import distutils.log import distutils.core import distutils.cmd import distutils.dist -from distutils.errors import DistutilsOptionError from distutils.util import strtobool from distutils.debug import DEBUG from distutils.fancy_getopt import translate_longopt @@ -135,7 +134,6 @@ def write_pkg_file(self, file): def write_field(key, value): file.write("%s: %s\n" % (key, value)) - write_field('Metadata-Version', str(version)) write_field('Name', self.get_name()) write_field('Version', self.get_version()) @@ -1281,4 +1279,5 @@ class Feature: class DistDeprecationWarning(SetuptoolsDeprecationWarning): - """Class for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.""" + """Class for warning about deprecations in dist in + setuptools. Not ignored by default, unlike DeprecationWarning.""" diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 6b177709..4daf1df1 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -8,7 +8,7 @@ from distutils.errors import DistutilsOptionError, DistutilsFileError from mock import patch from setuptools.dist import Distribution, _Distribution from setuptools.config import ConfigHandler, read_configuration -from setuptools.extern.six.moves.configparser import InterpolationMissingOptionError +from setuptools.extern.six.moves import configparser from setuptools.tests import is_ascii from . import py2_only, py3_only from .textwrap import DALS @@ -29,7 +29,9 @@ def make_package_dir(name, base_dir, ns=False): return dir_package, init_file -def fake_env(tmpdir, setup_cfg, setup_py=None, encoding='ascii', package_path='fake_package'): +def fake_env( + tmpdir, setup_cfg, setup_py=None, + encoding='ascii', package_path='fake_package'): if setup_py is None: setup_py = ( @@ -440,11 +442,12 @@ class TestMetadata: '[metadata]\n' 'description = %(message)s\n' ) - with pytest.raises(InterpolationMissingOptionError): + with pytest.raises(configparser.InterpolationMissingOptionError): with get_dist(tmpdir): pass - skip_if_not_ascii = pytest.mark.skipif(not is_ascii, reason='Test not supported with this locale') + skip_if_not_ascii = pytest.mark.skipif( + not is_ascii, reason='Test not supported with this locale') @skip_if_not_ascii def test_non_ascii_1(self, tmpdir): -- cgit v1.2.3 From 85fa4a6bc506be12fdbd0f4cff139e7c4e3bc6a8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 10:04:50 -0400 Subject: When reading config files, require them to be encoded with UTF-8. Fixes #1702. --- setuptools/dist.py | 9 ++------- setuptools/tests/test_config.py | 31 +++++++++---------------------- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index ae380290..9a165de0 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -35,7 +35,6 @@ from setuptools.depends import Require from setuptools import windows_support from setuptools.monkey import get_unpatched from setuptools.config import parse_configuration -from .unicode_utils import detect_encoding import pkg_resources __import__('setuptools.extern.packaging.specifiers') @@ -587,13 +586,9 @@ class Distribution(_Distribution): parser = ConfigParser() for filename in filenames: - with io.open(filename, 'rb') as fp: - encoding = detect_encoding(fp) + with io.open(filename, encoding='utf-8') as reader: if DEBUG: - self.announce(" reading %s [%s]" % ( - filename, encoding or 'locale') - ) - reader = io.TextIOWrapper(fp, encoding=encoding) + self.announce(" reading {filename}".format(**locals())) (parser.read_file if six.PY3 else parser.readfp)(reader) for section in parser.sections(): options = parser.options(section) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 4daf1df1..bc97664d 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -9,7 +9,6 @@ from mock import patch from setuptools.dist import Distribution, _Distribution from setuptools.config import ConfigHandler, read_configuration from setuptools.extern.six.moves import configparser -from setuptools.tests import is_ascii from . import py2_only, py3_only from .textwrap import DALS @@ -446,10 +445,6 @@ class TestMetadata: with get_dist(tmpdir): pass - skip_if_not_ascii = pytest.mark.skipif( - not is_ascii, reason='Test not supported with this locale') - - @skip_if_not_ascii def test_non_ascii_1(self, tmpdir): fake_env( tmpdir, @@ -457,18 +452,8 @@ class TestMetadata: 'description = éàïôñ\n', encoding='utf-8' ) - with pytest.raises(UnicodeDecodeError): - with get_dist(tmpdir): - pass - - def test_non_ascii_2(self, tmpdir): - fake_env( - tmpdir, - '# -*- coding: invalid\n' - ) - with pytest.raises(LookupError): - with get_dist(tmpdir): - pass + with get_dist(tmpdir): + pass def test_non_ascii_3(self, tmpdir): fake_env( @@ -479,7 +464,6 @@ class TestMetadata: with get_dist(tmpdir): pass - @skip_if_not_ascii def test_non_ascii_4(self, tmpdir): fake_env( tmpdir, @@ -491,8 +475,10 @@ class TestMetadata: with get_dist(tmpdir) as dist: assert dist.metadata.description == 'éàïôñ' - @skip_if_not_ascii - def test_non_ascii_5(self, tmpdir): + def test_not_utf8(self, tmpdir): + """ + Config files encoded not in UTF-8 will fail + """ fake_env( tmpdir, '# vim: set fileencoding=iso-8859-15 :\n' @@ -500,8 +486,9 @@ class TestMetadata: 'description = éàïôñ\n', encoding='iso-8859-15' ) - with get_dist(tmpdir) as dist: - assert dist.metadata.description == 'éàïôñ' + with pytest.raises(UnicodeDecodeError): + with get_dist(tmpdir): + pass class TestOptions: -- cgit v1.2.3 From e89509f7de02d116b97715d4d8637ea24faa9419 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 10:23:51 -0400 Subject: Add changelog entry. Ref #1702. --- changelog.d/1735.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1735.breaking.rst diff --git a/changelog.d/1735.breaking.rst b/changelog.d/1735.breaking.rst new file mode 100644 index 00000000..448730c4 --- /dev/null +++ b/changelog.d/1735.breaking.rst @@ -0,0 +1 @@ +When parsing setup.cfg files, setuptools now requires the files to be encoded as UTF-8. Any other encoding will lead to a UnicodeDecodeError. This change removes support for specifying an encoding using a 'coding: ' directive in the header of the file, a feature that was introduces in 40.7. Given the recent release of the aforementioned feature, it is assumed that few if any projects are utilizing the feature to specify an encoding other than UTF-8. -- cgit v1.2.3 From 7b09ba64c0327ecea04cc95057ffa7d5c8d939c8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 10:46:00 -0400 Subject: Add test for setopt to demonstrate that edit_config retains non-ASCII characters. --- setuptools/tests/test_setopt.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 setuptools/tests/test_setopt.py diff --git a/setuptools/tests/test_setopt.py b/setuptools/tests/test_setopt.py new file mode 100644 index 00000000..2241ef73 --- /dev/null +++ b/setuptools/tests/test_setopt.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +from __future__ import unicode_literals + +import io + +import six + +from setuptools.command import setopt +from setuptools.extern.six.moves import configparser + + +class TestEdit: + @staticmethod + def parse_config(filename): + parser = configparser.ConfigParser() + with io.open(filename, encoding='utf-8') as reader: + (parser.read_file if six.PY3 else parser.readfp)(reader) + return parser + + @staticmethod + def write_text(file, content): + with io.open(file, 'wb') as strm: + strm.write(content.encode('utf-8')) + + def test_utf8_encoding_retained(self, tmpdir): + """ + When editing a file, non-ASCII characters encoded in + UTF-8 should be retained. + """ + config = tmpdir.join('setup.cfg') + self.write_text(config, '[names]\njaraco=йарацо') + setopt.edit_config(str(config), dict(names=dict(other='yes'))) + parser = self.parse_config(str(config)) + assert parser['names']['jaraco'] == 'йарацо' + assert parser['names']['other'] == 'yes' -- cgit v1.2.3 From b336e83a63722b3a3e4d3f1779686149d5cef8d1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 10:49:23 -0400 Subject: Add compatibility for Python 2 --- setuptools/tests/test_setopt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setuptools/tests/test_setopt.py b/setuptools/tests/test_setopt.py index 2241ef73..7c803500 100644 --- a/setuptools/tests/test_setopt.py +++ b/setuptools/tests/test_setopt.py @@ -29,8 +29,8 @@ class TestEdit: UTF-8 should be retained. """ config = tmpdir.join('setup.cfg') - self.write_text(config, '[names]\njaraco=йарацо') + self.write_text(str(config), '[names]\njaraco=йарацо') setopt.edit_config(str(config), dict(names=dict(other='yes'))) parser = self.parse_config(str(config)) - assert parser['names']['jaraco'] == 'йарацо' - assert parser['names']['other'] == 'yes' + assert parser.get('names', 'jaraco') == 'йарацо' + assert parser.get('names', 'other') == 'yes' -- cgit v1.2.3 From 7ed188bcaf38a25fb63fbb1ed3b070428ff95759 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 11:07:02 -0400 Subject: Correct cyrillic to match preferred pronunciation. --- setuptools/tests/test_setopt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/tests/test_setopt.py b/setuptools/tests/test_setopt.py index 7c803500..3fb04fb4 100644 --- a/setuptools/tests/test_setopt.py +++ b/setuptools/tests/test_setopt.py @@ -29,8 +29,8 @@ class TestEdit: UTF-8 should be retained. """ config = tmpdir.join('setup.cfg') - self.write_text(str(config), '[names]\njaraco=йарацо') + self.write_text(str(config), '[names]\njaraco=джарако') setopt.edit_config(str(config), dict(names=dict(other='yes'))) parser = self.parse_config(str(config)) - assert parser.get('names', 'jaraco') == 'йарацо' + assert parser.get('names', 'jaraco') == 'джарако' assert parser.get('names', 'other') == 'yes' -- cgit v1.2.3 From f36781084f8f870ea747d477bd742057ea022421 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 12:25:03 -0400 Subject: Remove detect_encoding, no longer used. --- setuptools/unicode_utils.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/setuptools/unicode_utils.py b/setuptools/unicode_utils.py index 3b8179a8..7c63efd2 100644 --- a/setuptools/unicode_utils.py +++ b/setuptools/unicode_utils.py @@ -1,6 +1,5 @@ import unicodedata import sys -import re from setuptools.extern import six @@ -43,15 +42,3 @@ def try_encode(string, enc): return string.encode(enc) except UnicodeEncodeError: return None - - -CODING_RE = re.compile(br'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)') - - -def detect_encoding(fp): - first_line = fp.readline() - fp.seek(0) - m = CODING_RE.match(first_line) - if m is None: - return None - return m.group(1).decode('ascii') -- cgit v1.2.3 From 7a80e29b31f255a3fff5147e50d0135271b7c101 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 13:23:32 -0400 Subject: =?UTF-8?q?Bump=20version:=2040.9.0=20=E2=86=92=2041.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 6 ++++++ changelog.d/1735.breaking.rst | 1 - setup.cfg | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/1735.breaking.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 9840c086..a8fd179a 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 40.9.0 +current_version = 41.0.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 2a8d432a..8785d3d2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v41.0.0 +------- + +* #1735: When parsing setup.cfg files, setuptools now requires the files to be encoded as UTF-8. Any other encoding will lead to a UnicodeDecodeError. This change removes support for specifying an encoding using a 'coding: ' directive in the header of the file, a feature that was introduces in 40.7. Given the recent release of the aforementioned feature, it is assumed that few if any projects are utilizing the feature to specify an encoding other than UTF-8. + + v40.9.0 ------- diff --git a/changelog.d/1735.breaking.rst b/changelog.d/1735.breaking.rst deleted file mode 100644 index 448730c4..00000000 --- a/changelog.d/1735.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -When parsing setup.cfg files, setuptools now requires the files to be encoded as UTF-8. Any other encoding will lead to a UnicodeDecodeError. This change removes support for specifying an encoding using a 'coding: ' directive in the header of the file, a feature that was introduces in 40.7. Given the recent release of the aforementioned feature, it is assumed that few if any projects are utilizing the feature to specify an encoding other than UTF-8. diff --git a/setup.cfg b/setup.cfg index 01fe6ae9..561e7b24 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,4 +19,4 @@ universal = 1 [metadata] license_file = LICENSE -version = 40.9.0 +version = 41.0.0 -- cgit v1.2.3 From 8db41e478db4ded53b9836f62211f8c9371ec7c9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 15:12:21 -0400 Subject: Rely on unique_everseen to avoid unnecessarily polluting the PYTHONPATH with duplicate entries. --- setuptools/command/test.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/setuptools/command/test.py b/setuptools/command/test.py index 997fd8b0..973e4eb2 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -15,6 +15,7 @@ from pkg_resources import (resource_listdir, resource_exists, normalize_path, working_set, _namespace_packages, evaluate_marker, add_activation_listener, require, EntryPoint) from setuptools import Command +from .build_py import _unique_everseen __metaclass__ = type @@ -186,12 +187,11 @@ class test(Command): orig_pythonpath = os.environ.get('PYTHONPATH', nothing) current_pythonpath = os.environ.get('PYTHONPATH', '') try: - to_join = [] - for x in list(paths) + current_pythonpath.split(os.pathsep): - if x not in to_join: - to_join.append(x) - if to_join: - os.environ['PYTHONPATH'] = os.pathsep.join(to_join) + prefix = os.pathsep.join(_unique_everseen(paths)) + to_join = filter(None, [prefix, current_pythonpath]) + new_path = os.pathsep.join(to_join) + if new_path: + os.environ['PYTHONPATH'] = new_path yield finally: if orig_pythonpath is nothing: -- cgit v1.2.3 From 1b4ef9635452958482a121f41e65d0b6cca1a9d6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 15:16:31 -0400 Subject: Add changelog entry. --- changelog.d/1709.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1709.bugfix.rst diff --git a/changelog.d/1709.bugfix.rst b/changelog.d/1709.bugfix.rst new file mode 100644 index 00000000..c6670ae9 --- /dev/null +++ b/changelog.d/1709.bugfix.rst @@ -0,0 +1 @@ +In test.paths_on_python_path, avoid adding unnecessary duplicates to the PYTHONPATH. -- cgit v1.2.3 From 7db010201783ae4b795908161e2027565e70a12f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Apr 2019 15:25:33 -0400 Subject: Rename changelog entry to use correct category. --- changelog.d/1709.bugfix.rst | 1 - changelog.d/1709.change.rst | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 changelog.d/1709.bugfix.rst create mode 100644 changelog.d/1709.change.rst diff --git a/changelog.d/1709.bugfix.rst b/changelog.d/1709.bugfix.rst deleted file mode 100644 index c6670ae9..00000000 --- a/changelog.d/1709.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -In test.paths_on_python_path, avoid adding unnecessary duplicates to the PYTHONPATH. diff --git a/changelog.d/1709.change.rst b/changelog.d/1709.change.rst new file mode 100644 index 00000000..c6670ae9 --- /dev/null +++ b/changelog.d/1709.change.rst @@ -0,0 +1 @@ +In test.paths_on_python_path, avoid adding unnecessary duplicates to the PYTHONPATH. -- cgit v1.2.3 From 59aeb62614ab07acb4b9520d81179d6e647dfbb7 Mon Sep 17 00:00:00 2001 From: 2xB <31772910+2xB@users.noreply.github.com> Date: Fri, 12 Apr 2019 00:32:12 +0200 Subject: FIX: git and hg revision checkout under Windows Windows does not change the working directory for a process via `cd .. && ` (see e.g. this question: https://stackoverflow.com/q/55641332/8575607 ). This commit replaces the use of `cd .. &&` with arguments provided by `git` and `hg` respectively. --- setuptools/package_index.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 705a47cf..6b06f2ca 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -897,7 +897,7 @@ class PackageIndex(Environment): if rev is not None: self.info("Checking out %s", rev) - os.system("(cd %s && git checkout --quiet %s)" % ( + os.system("git -C %s checkout --quiet %s" % ( filename, rev, )) @@ -913,7 +913,7 @@ class PackageIndex(Environment): if rev is not None: self.info("Updating to %s", rev) - os.system("(cd %s && hg up -C -r %s -q)" % ( + os.system("hg --cwd %s up -C -r %s -q" % ( filename, rev, )) -- cgit v1.2.3 From 01376621f092f9d448e1bf0e1e669bda15b73809 Mon Sep 17 00:00:00 2001 From: 2xB <31772910+2xB@users.noreply.github.com> Date: Fri, 12 Apr 2019 00:58:48 +0200 Subject: Added description in changelog.d --- changelog.d/1741.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1741.change.rst diff --git a/changelog.d/1741.change.rst b/changelog.d/1741.change.rst new file mode 100644 index 00000000..b465958a --- /dev/null +++ b/changelog.d/1741.change.rst @@ -0,0 +1 @@ +Fixed revision checkout routine of git and hg repositories under Windows -- cgit v1.2.3 From 0259db3b7aaaff9d0dfdde48e9dbc0361d3ab47f Mon Sep 17 00:00:00 2001 From: 2xB <31772910+2xB@users.noreply.github.com> Date: Fri, 12 Apr 2019 01:10:33 +0200 Subject: Updated test to check for changed git rev checkout Checking for new implementation solving issue #1740 --- setuptools/tests/test_packageindex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index ab371884..60d968fd 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -249,7 +249,7 @@ class TestPackageIndex: first_call_args = os_system_mock.call_args_list[0][0] assert first_call_args == (expected,) - tmpl = '(cd {expected_dir} && git checkout --quiet master)' + tmpl = 'git -C {expected_dir} checkout --quiet master' expected = tmpl.format(**locals()) assert os_system_mock.call_args_list[1][0] == (expected,) assert result == expected_dir -- cgit v1.2.3 From eaa19fd89c2e61f52c677c958041013422df133f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 12 Apr 2019 13:50:25 -0400 Subject: More directly describe the change. --- changelog.d/1741.change.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/1741.change.rst b/changelog.d/1741.change.rst index b465958a..03b24780 100644 --- a/changelog.d/1741.change.rst +++ b/changelog.d/1741.change.rst @@ -1 +1 @@ -Fixed revision checkout routine of git and hg repositories under Windows +In package_index, now honor "current directory" during a checkout of git and hg repositories under Windows -- cgit v1.2.3 From 80f67626467684fffb9702eb523fc7c3efa8c510 Mon Sep 17 00:00:00 2001 From: gpotter2 Date: Sun, 14 Apr 2019 16:00:24 +0200 Subject: Update super old CHANGES.rst dead links --- CHANGES.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 8785d3d2..08c5ee0b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1496,8 +1496,8 @@ v20.6.0 19.7 ---- -* `Off-project PR `_: - For FreeBSD, also honor root certificates from ca_root_nss. +* Off-project PR: `0dcee79 `_ and `f9bd9b9 `_ + For FreeBSD, also `honor root certificates from ca_root_nss `_. 19.6.2 ------ @@ -1661,9 +1661,9 @@ v20.6.0 now logged when pkg_resources is imported on Python 3.2 or earlier Python 3 versions. * `Add support for python_platform_implementation environment marker - `_. + `_. * `Fix dictionary mutation during iteration - `_. + `_. 18.4 ---- @@ -2023,7 +2023,7 @@ process to fail and PyPI uploads no longer accept files for 13.0. --- * Prefer vendored packaging library `as recommended - `_. + `_. 9.0.1 ----- -- cgit v1.2.3 From 869c634880f24b918ca074588b625b9dce2038b2 Mon Sep 17 00:00:00 2001 From: Floris Lambrechts Date: Tue, 26 Mar 2019 09:08:33 +0100 Subject: Add test for pre-existing wheels in build_meta Currently, this will fail because setuptools.build_meta.build_wheel assumes that no wheels already exist in the `dist/` directory. See GH #1671 --- setuptools/tests/test_build_meta.py | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 0bdea2d6..90400afc 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -157,6 +157,44 @@ class TestBuildMetaBackend: assert os.path.isfile(os.path.join(dist_dir, wheel_name)) + @pytest.mark.xfail(reason="Known error, see GH #1671") + def test_build_wheel_with_existing_wheel_file_present(self, tmpdir_cwd): + # Building a wheel should still succeed if there's already a wheel + # in the wheel directory + files = { + 'setup.py': "from setuptools import setup\nsetup()", + 'VERSION': "0.0.1", + 'setup.cfg': DALS(""" + [metadata] + name = foo + version = file: VERSION + """), + 'pyproject.toml': DALS(""" + [build-system] + requires = ["setuptools", "wheel"] + build-backend = "setuptools.build_meta + """), + } + + build_files(files) + + dist_dir = os.path.abspath('pip-wheel-preexisting') + os.makedirs(dist_dir) + + # make first wheel + build_backend = self.get_build_backend() + wheel_one = build_backend.build_wheel(dist_dir) + + # change version + with open("VERSION", "wt") as version_file: + version_file.write("0.0.2") + + # make *second* wheel + wheel_two = self.get_build_backend().build_wheel(dist_dir) + + assert os.path.isfile(os.path.join(dist_dir, wheel_one)) + assert wheel_one != wheel_two + def test_build_sdist(self, build_backend): dist_dir = os.path.abspath('pip-sdist') os.makedirs(dist_dir) -- cgit v1.2.3 From 901f7cc2a036bfeb93bfbe480608e04c76c2c5ec Mon Sep 17 00:00:00 2001 From: Shashank Singh Date: Sat, 20 Apr 2019 23:24:41 -0400 Subject: Fix error when wheels already exist in dist/ `build_meta.build_wheel` assumes that the only wheel in its output directory is the one it builds, but prior to this, it also used the `dist/` folder as its working output directory. This commit uses a temporary directory instead, preventing an error that was triggered when previously-generated wheel files were still sitting in `dist/`. Fixes GH #1671 --- setuptools/build_meta.py | 23 ++++++++++++++++------- setuptools/py31compat.py | 4 ++-- setuptools/tests/test_build_meta.py | 7 ++++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index 47cbcbf6..e40904a5 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -35,6 +35,7 @@ import contextlib import setuptools import distutils +from setuptools.py31compat import TemporaryDirectory from pkg_resources import parse_requirements @@ -182,14 +183,22 @@ class _BuildMetaBackend(object): metadata_directory=None): config_settings = self._fix_config(config_settings) wheel_directory = os.path.abspath(wheel_directory) - sys.argv = sys.argv[:1] + ['bdist_wheel'] + \ - config_settings["--global-option"] - self.run_setup() - if wheel_directory != 'dist': - shutil.rmtree(wheel_directory) - shutil.copytree('dist', wheel_directory) - return _file_with_extension(wheel_directory, '.whl') + # Build the wheel in a temporary directory, then copy to the target + with TemporaryDirectory(dir=wheel_directory) as tmp_dist_dir: + sys.argv = (sys.argv[:1] + + ['bdist_wheel', '--dist-dir', tmp_dist_dir] + + config_settings["--global-option"]) + self.run_setup() + + wheel_basename = _file_with_extension(tmp_dist_dir, '.whl') + wheel_path = os.path.join(wheel_directory, wheel_basename) + if os.path.exists(wheel_path): + # os.rename will fail overwriting on non-unix env + os.remove(wheel_path) + os.rename(os.path.join(tmp_dist_dir, wheel_basename), wheel_path) + + return wheel_basename def build_sdist(self, sdist_directory, config_settings=None): config_settings = self._fix_config(config_settings) diff --git a/setuptools/py31compat.py b/setuptools/py31compat.py index 1a0705ec..e1da7ee2 100644 --- a/setuptools/py31compat.py +++ b/setuptools/py31compat.py @@ -17,9 +17,9 @@ except ImportError: errors on deletion. """ - def __init__(self): + def __init__(self, **kwargs): self.name = None # Handle mkdtemp raising an exception - self.name = tempfile.mkdtemp() + self.name = tempfile.mkdtemp(**kwargs) def __enter__(self): return self.name diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 90400afc..88e29ffe 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -157,7 +157,6 @@ class TestBuildMetaBackend: assert os.path.isfile(os.path.join(dist_dir, wheel_name)) - @pytest.mark.xfail(reason="Known error, see GH #1671") def test_build_wheel_with_existing_wheel_file_present(self, tmpdir_cwd): # Building a wheel should still succeed if there's already a wheel # in the wheel directory @@ -195,6 +194,12 @@ class TestBuildMetaBackend: assert os.path.isfile(os.path.join(dist_dir, wheel_one)) assert wheel_one != wheel_two + # and if rebuilding the same wheel? + open(os.path.join(dist_dir, wheel_two), 'w').close() + wheel_three = self.get_build_backend().build_wheel(dist_dir) + assert wheel_three == wheel_two + assert os.path.getsize(os.path.join(dist_dir, wheel_three)) > 0 + def test_build_sdist(self, build_backend): dist_dir = os.path.abspath('pip-sdist') os.makedirs(dist_dir) -- cgit v1.2.3 From e4f987b141104e709367cbe629f3cd6ef5153216 Mon Sep 17 00:00:00 2001 From: Shashank Singh Date: Sat, 20 Apr 2019 23:25:59 -0400 Subject: Add changelog for PR #1745 --- changelog.d/1671.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1671.change.rst diff --git a/changelog.d/1671.change.rst b/changelog.d/1671.change.rst new file mode 100644 index 00000000..95ae49da --- /dev/null +++ b/changelog.d/1671.change.rst @@ -0,0 +1 @@ +Fixed issue with the PEP 517 backend that prevented building a wheel when the ``dist/`` directory contained existing ``.whl`` files. -- cgit v1.2.3 From bd3d72b030eeae19ebc2eb3a0a325f87b41a09f1 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 22 Apr 2019 16:49:46 +0200 Subject: travis: preemptively switch to xenial As it will soon become the default: https://blog.travis-ci.com/2019-04-15-xenial-default-build-environment --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a5b670e4..d99656e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -dist: trusty +dist: xenial language: python jobs: @@ -9,7 +9,6 @@ jobs: - <<: *latest_py2 env: LANG=C - python: pypy2.7-6.0.0 - dist: xenial env: DISABLE_COVERAGE=1 # Don't run coverage on pypy (too slow). - python: pypy3 env: DISABLE_COVERAGE=1 @@ -19,11 +18,9 @@ jobs: python: 3.6 - &latest_py3 python: 3.7 - dist: xenial - <<: *latest_py3 env: LANG=C - python: 3.8-dev - dist: xenial env: DISABLE_COVERAGE=1 # Ignore invalid coverage data. - <<: *default_py stage: deploy (to PyPI for tagged commits) -- cgit v1.2.3 From 3a797435ccdc5a115b681572d5ba0cfd484ae810 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 22 Apr 2019 16:53:37 +0200 Subject: travis: update PyPy 3 job to latest supported version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d99656e0..9429dc6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ jobs: env: LANG=C - python: pypy2.7-6.0.0 env: DISABLE_COVERAGE=1 # Don't run coverage on pypy (too slow). - - python: pypy3 + - python: pypy3.5-6.0.0 env: DISABLE_COVERAGE=1 - python: 3.4 - python: 3.5 -- cgit v1.2.3 From 127c8c74dead715b67a66eed86c420fe7b31ea3b Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Mon, 22 Apr 2019 11:05:29 -0400 Subject: Limit workers in ProcessPoolExecutor As a mitigation for #1730, this commit limits the number of workers in the ProcessPoolExecutor to 1 (default is the number of CPUs). On PyPy, having a higher number of available workers dramatically increases the number of concurrent processes, leading to some resource exhaustion issues. This does not address the root issue, but should improve the situation until the root issue is addressed. --- setuptools/tests/test_build_meta.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 90400afc..e32cfb92 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -28,7 +28,7 @@ class BuildBackend(BuildBackendBase): def __init__(self, *args, **kwargs): super(BuildBackend, self).__init__(*args, **kwargs) - self.pool = futures.ProcessPoolExecutor() + self.pool = futures.ProcessPoolExecutor(max_workers=1) def __getattr__(self, name): """Handles aribrary function invocations on the build backend.""" -- cgit v1.2.3 From e66857af348a823b15701c39a88add28cfaab3bd Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 22 Apr 2019 16:00:24 +0000 Subject: travis: re-enable coverage for Python 3.8 job (#1748) Now that the issue with invalid coverage data has been fixed. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9429dc6c..ffcad998 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,6 @@ jobs: - <<: *latest_py3 env: LANG=C - python: 3.8-dev - env: DISABLE_COVERAGE=1 # Ignore invalid coverage data. - <<: *default_py stage: deploy (to PyPI for tagged commits) if: tag IS present -- cgit v1.2.3 From 97d7563915b6e2ad8a638e988361357709a83bda Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 22 Apr 2019 22:07:03 +0200 Subject: =?UTF-8?q?Bump=20version:=2041.0.0=20=E2=86=92=2041.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 8 ++++++++ changelog.d/1671.change.rst | 1 - changelog.d/1709.change.rst | 1 - changelog.d/1741.change.rst | 1 - setup.cfg | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) delete mode 100644 changelog.d/1671.change.rst delete mode 100644 changelog.d/1709.change.rst delete mode 100644 changelog.d/1741.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a8fd179a..87acb5ef 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 41.0.0 +current_version = 41.0.1 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 08c5ee0b..9da22537 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,11 @@ +v41.0.1 +------- + +* #1671: Fixed issue with the PEP 517 backend that prevented building a wheel when the ``dist/`` directory contained existing ``.whl`` files. +* #1709: In test.paths_on_python_path, avoid adding unnecessary duplicates to the PYTHONPATH. +* #1741: In package_index, now honor "current directory" during a checkout of git and hg repositories under Windows + + v41.0.0 ------- diff --git a/changelog.d/1671.change.rst b/changelog.d/1671.change.rst deleted file mode 100644 index 95ae49da..00000000 --- a/changelog.d/1671.change.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed issue with the PEP 517 backend that prevented building a wheel when the ``dist/`` directory contained existing ``.whl`` files. diff --git a/changelog.d/1709.change.rst b/changelog.d/1709.change.rst deleted file mode 100644 index c6670ae9..00000000 --- a/changelog.d/1709.change.rst +++ /dev/null @@ -1 +0,0 @@ -In test.paths_on_python_path, avoid adding unnecessary duplicates to the PYTHONPATH. diff --git a/changelog.d/1741.change.rst b/changelog.d/1741.change.rst deleted file mode 100644 index 03b24780..00000000 --- a/changelog.d/1741.change.rst +++ /dev/null @@ -1 +0,0 @@ -In package_index, now honor "current directory" during a checkout of git and hg repositories under Windows diff --git a/setup.cfg b/setup.cfg index 561e7b24..39454081 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,4 +19,4 @@ universal = 1 [metadata] license_file = LICENSE -version = 41.0.0 +version = 41.0.1 -- cgit v1.2.3 From 5f88c42f3b4529956e4d02453ae571e32bc4692a Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 22 Apr 2019 22:18:50 +0200 Subject: build_meta: fix 2 issues with `build_wheel` / `build_sdist` Fix the following cases: * `build_sdist` is called with another sdist already present in the destination directory * `build_wheel` is called with the destination directory not already created --- setuptools/build_meta.py | 47 ++++++++++++++++++++----------------- setuptools/tests/test_build_meta.py | 38 ++++++++++++++++-------------- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index e40904a5..10c4b528 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -38,6 +38,7 @@ import distutils from setuptools.py31compat import TemporaryDirectory from pkg_resources import parse_requirements +from pkg_resources.py31compat import makedirs __all__ = ['get_requires_for_build_sdist', 'get_requires_for_build_wheel', @@ -179,36 +180,38 @@ class _BuildMetaBackend(object): return dist_infos[0] - def build_wheel(self, wheel_directory, config_settings=None, - metadata_directory=None): + def _build_with_temp_dir(self, setup_command, result_extension, + result_directory, config_settings): config_settings = self._fix_config(config_settings) - wheel_directory = os.path.abspath(wheel_directory) + result_directory = os.path.abspath(result_directory) - # Build the wheel in a temporary directory, then copy to the target - with TemporaryDirectory(dir=wheel_directory) as tmp_dist_dir: - sys.argv = (sys.argv[:1] + - ['bdist_wheel', '--dist-dir', tmp_dist_dir] + + # Build in a temporary directory, then copy to the target. + makedirs(result_directory, exist_ok=True) + with TemporaryDirectory(dir=result_directory) as tmp_dist_dir: + sys.argv = (sys.argv[:1] + setup_command + + ['--dist-dir', tmp_dist_dir] + config_settings["--global-option"]) self.run_setup() - wheel_basename = _file_with_extension(tmp_dist_dir, '.whl') - wheel_path = os.path.join(wheel_directory, wheel_basename) - if os.path.exists(wheel_path): - # os.rename will fail overwriting on non-unix env - os.remove(wheel_path) - os.rename(os.path.join(tmp_dist_dir, wheel_basename), wheel_path) + result_basename = _file_with_extension(tmp_dist_dir, result_extension) + result_path = os.path.join(result_directory, result_basename) + if os.path.exists(result_path): + # os.rename will fail overwriting on non-Unix. + os.remove(result_path) + os.rename(os.path.join(tmp_dist_dir, result_basename), result_path) - return wheel_basename + return result_basename - def build_sdist(self, sdist_directory, config_settings=None): - config_settings = self._fix_config(config_settings) - sdist_directory = os.path.abspath(sdist_directory) - sys.argv = sys.argv[:1] + ['sdist', '--formats', 'gztar'] + \ - config_settings["--global-option"] + \ - ["--dist-dir", sdist_directory] - self.run_setup() - return _file_with_extension(sdist_directory, '.tar.gz') + def build_wheel(self, wheel_directory, config_settings=None, + metadata_directory=None): + return self._build_with_temp_dir(['bdist_wheel'], '.whl', + wheel_directory, config_settings) + + def build_sdist(self, sdist_directory, config_settings=None): + return self._build_with_temp_dir(['sdist', '--formats', 'gztar'], + '.tar.gz', sdist_directory, + config_settings) class _BuildMetaLegacyBackend(_BuildMetaBackend): diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 7612ebd7..e1efe561 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -157,9 +157,10 @@ class TestBuildMetaBackend: assert os.path.isfile(os.path.join(dist_dir, wheel_name)) - def test_build_wheel_with_existing_wheel_file_present(self, tmpdir_cwd): - # Building a wheel should still succeed if there's already a wheel - # in the wheel directory + @pytest.mark.parametrize('build_type', ('wheel', 'sdist')) + def test_build_with_existing_file_present(self, build_type, tmpdir_cwd): + # Building a sdist/wheel should still succeed if there's + # already a sdist/wheel in the destination directory. files = { 'setup.py': "from setuptools import setup\nsetup()", 'VERSION': "0.0.1", @@ -177,28 +178,31 @@ class TestBuildMetaBackend: build_files(files) - dist_dir = os.path.abspath('pip-wheel-preexisting') - os.makedirs(dist_dir) + dist_dir = os.path.abspath('preexisting-' + build_type) - # make first wheel build_backend = self.get_build_backend() - wheel_one = build_backend.build_wheel(dist_dir) + build_method = getattr(build_backend, 'build_' + build_type) + + # Build a first sdist/wheel. + # Note: this also check the destination directory is + # successfully created if it does not exist already. + first_result = build_method(dist_dir) - # change version + # Change version. with open("VERSION", "wt") as version_file: version_file.write("0.0.2") - # make *second* wheel - wheel_two = self.get_build_backend().build_wheel(dist_dir) + # Build a *second* sdist/wheel. + second_result = build_method(dist_dir) - assert os.path.isfile(os.path.join(dist_dir, wheel_one)) - assert wheel_one != wheel_two + assert os.path.isfile(os.path.join(dist_dir, first_result)) + assert first_result != second_result - # and if rebuilding the same wheel? - open(os.path.join(dist_dir, wheel_two), 'w').close() - wheel_three = self.get_build_backend().build_wheel(dist_dir) - assert wheel_three == wheel_two - assert os.path.getsize(os.path.join(dist_dir, wheel_three)) > 0 + # And if rebuilding the exact same sdist/wheel? + open(os.path.join(dist_dir, second_result), 'w').close() + third_result = build_method(dist_dir) + assert third_result == second_result + assert os.path.getsize(os.path.join(dist_dir, third_result)) > 0 def test_build_sdist(self, build_backend): dist_dir = os.path.abspath('pip-sdist') -- cgit v1.2.3 From 812a97c2a90f67a551b6b158e08fe466748d7902 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 22 Apr 2019 23:25:17 +0200 Subject: changelog: add entry for PR #1750 --- changelog.d/1749.change.rst | 1 + changelog.d/1750.change.rst | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelog.d/1749.change.rst create mode 100644 changelog.d/1750.change.rst diff --git a/changelog.d/1749.change.rst b/changelog.d/1749.change.rst new file mode 100644 index 00000000..de678072 --- /dev/null +++ b/changelog.d/1749.change.rst @@ -0,0 +1 @@ +Fixed issue with the PEP 517 backend where building a source distribution would fail if any tarball existed in the destination directory. diff --git a/changelog.d/1750.change.rst b/changelog.d/1750.change.rst new file mode 100644 index 00000000..7a22229e --- /dev/null +++ b/changelog.d/1750.change.rst @@ -0,0 +1 @@ +Fixed an issue with PEP 517 backend where wheel builds would fail if the destination directory did not already exist. -- cgit v1.2.3 From f58549ab38eb6f5d1146510cbf15965aeb75c6fb Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Tue, 14 May 2019 15:31:27 +0200 Subject: tests: fix_test_build_deps_on_distutils * ignore distutils' warning (`Unknown distribution option: 'python_requires'`) * fix test on Windows --- setuptools/tests/test_integration.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index e54f3209..1e132188 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -141,6 +141,7 @@ def test_build_deps_on_distutils(request, tmpdir_factory, build_dep): allowed_unknowns = [ 'test_suite', 'tests_require', + 'python_requires', 'install_requires', ] assert not match or match.group(1).strip('"\'') in allowed_unknowns @@ -149,8 +150,8 @@ def test_build_deps_on_distutils(request, tmpdir_factory, build_dep): def install(pkg_dir, install_dir): with open(os.path.join(pkg_dir, 'setuptools.py'), 'w') as breaker: breaker.write('raise ImportError()') - cmd = [sys.executable, 'setup.py', 'install', '--prefix', install_dir] - env = dict(os.environ, PYTHONPATH=pkg_dir) + cmd = [sys.executable, 'setup.py', 'install', '--prefix', str(install_dir)] + env = dict(os.environ, PYTHONPATH=str(pkg_dir)) output = subprocess.check_output( cmd, cwd=pkg_dir, env=env, stderr=subprocess.STDOUT) return output.decode('utf-8') -- cgit v1.2.3 From 9146e8808d3912c5a193f6f9b0cc32c13bc4a4fc Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Tue, 14 May 2019 16:58:09 +0200 Subject: appveyor: fix Python 2 job Update virtualenv so the tox environment use a more recent version of pip (and probably setuptools/wheel too). --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 7a3d174d..08818069 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,7 +26,7 @@ cache: test_script: - python --version - python -m pip install --disable-pip-version-check --upgrade pip setuptools wheel - - pip install --upgrade tox tox-venv + - pip install --upgrade tox tox-venv virtualenv - pip freeze --all - python bootstrap.py - tox -- --cov -- cgit v1.2.3 From 835580ae8926fc6ca7560ab7421387e3ba47242c Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Tue, 14 May 2019 17:01:08 +0200 Subject: tox: tweak configuration Fix the `list_dependencies_command` so arguably the most important packages are not hidden (pip, setuptools, and wheel). --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index bb940ac0..e0eef95a 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ deps=-rtests/requirements.txt # from being added to `sys.path`. install_command=python -c 'import sys; sys.path.remove(""); from pkg_resources import load_entry_point; load_entry_point("pip", "console_scripts", "pip")()' install {opts} {packages} # Same as above. -list_dependencies_command={envbindir}/pip freeze +list_dependencies_command={envbindir}/pip freeze --all setenv=COVERAGE_FILE={toxworkdir}/.coverage.{envname} # TODO: The passed environment variables came from copying other tox.ini files # These should probably be individually annotated to explain what needs them. -- cgit v1.2.3 From a775582b44ca39096640c36550a9dcec7f965ec1 Mon Sep 17 00:00:00 2001 From: Bastian Venthur Date: Tue, 14 May 2019 12:35:35 +0200 Subject: Migrate constants from setup.py to setup.cfg This also makes wheel an unconditional setup_requires dependency. Closes: #1697 --- setup.cfg | 43 ++++++++++++++++++++++++++++++++++++++++++- setup.py | 46 ---------------------------------------------- 2 files changed, 42 insertions(+), 47 deletions(-) diff --git a/setup.cfg b/setup.cfg index 39454081..ff87464b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,5 +18,46 @@ formats = zip universal = 1 [metadata] -license_file = LICENSE +name = setuptools version = 41.0.1 +description = Easily download, build, install, upgrade, and uninstall Python packages +author = Python Packaging Authority +author_email = distutils-sig@python.org +long_description = file: README.rst +long_description_content_type = text/x-rst; charset=UTF-8 +license_file = LICENSE +keywords = CPAN PyPI distutils eggs package management +url = https://github.com/pypa/setuptools +project_urls = + Documentation = https://setuptools.readthedocs.io/ +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Topic :: Software Development :: Libraries :: Python Modules + Topic :: System :: Archiving :: Packaging + Topic :: System :: Systems Administration + Topic :: Utilities + +[options] +zip_safe = True +python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.* +py_modules = easy_install +packages = find: + +[options.packages.find] +exclude = *.tests + +[options.extras_require] +ssl = + wincertstore==0.2; sys_platform=='win32' +certs = + certifi==2016.9.26 diff --git a/setup.py b/setup.py index 78d7018c..f5030dd6 100755 --- a/setup.py +++ b/setup.py @@ -3,10 +3,8 @@ Distutils setup file, used to install or test 'setuptools' """ -import io import os import sys -import textwrap import setuptools @@ -49,10 +47,6 @@ def _gen_console_scripts(): yield tmpl.format(shortver=sys.version[:3]) -readme_path = os.path.join(here, 'README.rst') -with io.open(readme_path, encoding='utf-8') as readme_file: - long_description = readme_file.read() - package_data = dict( setuptools=['script (dev).tmpl', 'script.tmpl', 'site-patch.py'], ) @@ -88,25 +82,8 @@ def pypi_link(pkg_filename): setup_params = dict( - name="setuptools", - description=( - "Easily download, build, install, upgrade, and uninstall " - "Python packages" - ), - author="Python Packaging Authority", - author_email="distutils-sig@python.org", - long_description=long_description, - long_description_content_type='text/x-rst; charset=UTF-8', - keywords="CPAN PyPI distutils eggs package management", - url="https://github.com/pypa/setuptools", - project_urls={ - "Documentation": "https://setuptools.readthedocs.io/", - }, src_root=None, - packages=setuptools.find_packages(exclude=['*.tests']), package_data=package_data, - py_modules=['easy_install'], - zip_safe=True, entry_points={ "distutils.commands": [ "%(cmd)s = setuptools.command.%(cmd)s:%(cmd)s" % locals() @@ -152,28 +129,6 @@ setup_params = dict( "setuptools.installation": ['eggsecutable = setuptools.command.easy_install:bootstrap'], }, - classifiers=textwrap.dedent(""" - Development Status :: 5 - Production/Stable - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Operating System :: OS Independent - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.4 - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Topic :: Software Development :: Libraries :: Python Modules - Topic :: System :: Archiving :: Packaging - Topic :: System :: Systems Administration - Topic :: Utilities - """).strip().splitlines(), - python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*', - extras_require={ - "ssl:sys_platform=='win32'": "wincertstore==0.2", - "certs": "certifi==2016.9.26", - }, dependency_links=[ pypi_link( 'certifi-2016.9.26.tar.gz#md5=baa81e951a29958563689d868ef1064d', @@ -182,7 +137,6 @@ setup_params = dict( 'wincertstore-0.2.zip#md5=ae728f2f007185648d0c7a8679b361e2', ), ], - scripts=[], setup_requires=[ ] + wheel, ) -- cgit v1.2.3 From 17eb6b93f482385c5c4c9d2ab92fbc00fa49674e Mon Sep 17 00:00:00 2001 From: Bastian Venthur Date: Tue, 14 May 2019 12:39:34 +0200 Subject: Added changelog fragment --- changelog.d/1697.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1697.change.rst diff --git a/changelog.d/1697.change.rst b/changelog.d/1697.change.rst new file mode 100644 index 00000000..44818b3c --- /dev/null +++ b/changelog.d/1697.change.rst @@ -0,0 +1 @@ +Moved most of the constants from setup.py to setup.cfg -- cgit v1.2.3 From 880ff4a3579bac7839f8f038085381ae14155f31 Mon Sep 17 00:00:00 2001 From: Bastian Venthur Date: Thu, 16 May 2019 12:46:50 +0200 Subject: Force metadata-version = 1.2 when project urls are present. Closes: #1756 --- setuptools/dist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index 9a165de0..ea6411b1 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -54,7 +54,8 @@ def get_metadata_version(self): mv = StrictVersion('2.1') elif (self.maintainer is not None or self.maintainer_email is not None or - getattr(self, 'python_requires', None) is not None): + getattr(self, 'python_requires', None) is not None or + self.project_urls): mv = StrictVersion('1.2') elif (self.provides or self.requires or self.obsoletes or self.classifiers or self.download_url): -- cgit v1.2.3 From a64ddf0d2f2bcd6e9843fb55c94fba922f315722 Mon Sep 17 00:00:00 2001 From: Bastian Venthur Date: Thu, 16 May 2019 13:48:15 +0200 Subject: Added test for metadata-version 1.2 --- setuptools/tests/test_egg_info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index db9c3873..316eb2ed 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -622,6 +622,7 @@ class TestEggInfo: assert expected_line in pkg_info_lines expected_line = 'Project-URL: Link Two, https://example.com/two/' assert expected_line in pkg_info_lines + assert 'Metadata-Version: 1.2' in pkg_info_lines def test_python_requires_egg_info(self, tmpdir_cwd, env): self._setup_script_with_requires( -- cgit v1.2.3 From 5e8927a17f4e1a5b7e97cbe42639dbcba21acb69 Mon Sep 17 00:00:00 2001 From: Bastian Venthur Date: Fri, 17 May 2019 08:22:55 +0200 Subject: Added changelog entry. --- changelog.d/1756.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1756.change.rst diff --git a/changelog.d/1756.change.rst b/changelog.d/1756.change.rst new file mode 100644 index 00000000..5c908d35 --- /dev/null +++ b/changelog.d/1756.change.rst @@ -0,0 +1 @@ +Forse metadata-version >= 1.2. when project urls are present. -- cgit v1.2.3 From ca1f766ee16c3a504082a95f2afd5a58fcae7d47 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Tue, 28 May 2019 21:38:56 +0200 Subject: tests: unpin pytest The new releases for pytest-fixture-config and pytest-shutil are compatible with pytest>=4.0. --- tests/requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index f944df27..cb3e6726 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -3,8 +3,7 @@ pytest-flake8; python_version!="3.4" pytest-flake8<=1.0.0; python_version=="3.4" virtualenv>=13.0.0 pytest-virtualenv>=1.2.7 -# pytest pinned to <4 due to #1638 -pytest>=3.7,<4 +pytest>=3.7 wheel coverage>=4.5.1 pytest-cov>=2.5.1 -- cgit v1.2.3 From 59dd72d9df7a88d692637a8c488aa884c182e557 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Sat, 1 Jun 2019 20:33:32 +0200 Subject: Use license classifiers rather than the license field. The license field has a 'free' format, while the classifiers are unique identifiers, similar to SPDX identifiers. In the documentation, we should therefore showcase the use of classifiers. --- changelog.d/1776.doc.rst | 1 + docs/setuptools.txt | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changelog.d/1776.doc.rst diff --git a/changelog.d/1776.doc.rst b/changelog.d/1776.doc.rst new file mode 100644 index 00000000..d4f1dbca --- /dev/null +++ b/changelog.d/1776.doc.rst @@ -0,0 +1 @@ +Use license classifiers rather than the license field. diff --git a/docs/setuptools.txt b/docs/setuptools.txt index 64b385cb..2e7fe3bd 100644 --- a/docs/setuptools.txt +++ b/docs/setuptools.txt @@ -136,16 +136,18 @@ dependencies, and perhaps some data files and scripts:: author="Me", author_email="me@example.com", description="This is an Example Package", - license="PSF", keywords="hello world example examples", url="http://example.com/HelloWorld/", # project home page, if any project_urls={ "Bug Tracker": "https://bugs.example.com/HelloWorld/", "Documentation": "https://docs.example.com/HelloWorld/", "Source Code": "https://code.example.com/HelloWorld/", - } + }, + classifiers=[ + 'License :: OSI Approved :: Python Software Foundation License' + ] - # could also include long_description, download_url, classifiers, etc. + # could also include long_description, download_url, etc. ) In the sections that follow, we'll explain what most of these ``setup()`` @@ -2234,6 +2236,7 @@ boilerplate code in some cases. license = BSD 3-Clause License classifiers = Framework :: Django + License :: OSI Approved :: BSD License Programming Language :: Python :: 3 Programming Language :: Python :: 3.5 -- cgit v1.2.3 From 8aeff6b2c9a64e47ad2a22533d7e65c08cd4103f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 10 Jun 2019 13:03:33 -0400 Subject: Update developer docs to describe motivation behind vendored dependencies. Ref #1781. --- docs/developer-guide.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/developer-guide.txt b/docs/developer-guide.txt index a5942c8b..d145fba1 100644 --- a/docs/developer-guide.txt +++ b/docs/developer-guide.txt @@ -137,3 +137,17 @@ To build the docs locally, use tox:: .. _Sphinx: http://www.sphinx-doc.org/en/master/ .. _published documentation: https://setuptools.readthedocs.io/en/latest/ + +--------------------- +Vendored Dependencies +--------------------- + +Setuptools has some dependencies, but due to `bootstrapping issues +`, those dependencies +cannot be declared as they won't be resolved soon enough to build +setuptools from source. Eventually, this limitation may be lifted as +PEP 517/518 reach ubiquitous adoption, but for now, Setuptools +cannot declare dependencies other than through +``setuptools/_vendor/vendored.txt`` and +``pkg_reosurces/_vendor/vendored.txt`` and refreshed by way of +``paver update_vendored`` (pavement.py). -- cgit v1.2.3 From fa22b42d9f2f8a15568dd3a3d290e33c9be86796 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Thu, 13 Jun 2019 18:31:57 +0200 Subject: launcher: Fix build with mingw-w64 execv() requires process.h to be included according to the MSVC documentation but for some reason it also works without it. mingw-w64 on the other hand fails to build the launcher if the include isn't there, so add it. --- launcher.c | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher.c b/launcher.c index be69f0c6..23ef3ac2 100644 --- a/launcher.c +++ b/launcher.c @@ -37,6 +37,7 @@ #include #include #include +#include int child_pid=0; -- cgit v1.2.3 From 53b8db359378f436bfd88f90a90aaf01b650d3a6 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 18 Jun 2019 16:15:25 +0900 Subject: Stop using deprecated HTMLParser.unescape HTMLParser.unescape is accessed even when unused - this will cause an exception when `HTMLParser.unescape` is removed in Python 3.9. --- changelog.d/1788.change.rst | 1 + setuptools/py33compat.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog.d/1788.change.rst diff --git a/changelog.d/1788.change.rst b/changelog.d/1788.change.rst new file mode 100644 index 00000000..d8a49fd4 --- /dev/null +++ b/changelog.d/1788.change.rst @@ -0,0 +1 @@ +Changed compatibility fallback logic for ``html.unescape`` to avoid accessing ``HTMLParser.unescape`` when not necessary. ``HTMLParser.unescape`` is deprecated and will be removed in Python 3.9. diff --git a/setuptools/py33compat.py b/setuptools/py33compat.py index 87cf5398..cb694436 100644 --- a/setuptools/py33compat.py +++ b/setuptools/py33compat.py @@ -52,4 +52,8 @@ class Bytecode_compat: Bytecode = getattr(dis, 'Bytecode', Bytecode_compat) -unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape) +unescape = getattr(html, 'unescape', None) +if unescape is None: + # HTMLParser.unescape is deprecated since Python 3.4, and will be removed + # from 3.9. + unescape = html_parser.HTMLParser().unescape -- cgit v1.2.3 From 10fe6be3d61414bd6cd9ed723e961d7ea8f5fd61 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sun, 30 Jun 2019 14:24:41 +0200 Subject: tests: fix `test_distribution_version_missing` to work with pytest>=5.0 --- pkg_resources/tests/test_pkg_resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index fb77c685..a0f2c452 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -242,7 +242,7 @@ def test_distribution_version_missing(tmpdir, suffix, expected_filename, with pytest.raises(ValueError) as excinfo: dist.version - err = str(excinfo) + err = str(excinfo.value) # Include a string expression after the assert so the full strings # will be visible for inspection on failure. assert expected_text in err, str((expected_text, err)) -- cgit v1.2.3 From 4598c1a2a918f2f74e7242df775308841e477038 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sun, 30 Jun 2019 14:25:12 +0200 Subject: tests: tweak default pytest arguments to fix Python 3.8 support --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 1c5b6b09..612fb91f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts=--doctest-modules --doctest-glob=pkg_resources/api_tests.txt -rsxX +addopts=--doctest-modules --doctest-glob=pkg_resources/api_tests.txt -r sxX norecursedirs=dist build *.egg setuptools/extern pkg_resources/extern .* flake8-ignore = setuptools/site-patch.py F821 -- cgit v1.2.3 From 67344c95b9402b4720d3c9e61d01096a6453efa6 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Sat, 13 Jul 2019 03:19:50 -0700 Subject: Fix #1790 : Include the file path in get_metadata() UnicodeDecodeErrors (#1791) Include the file path in get_metadata() UnicodeDecodeErrors. --- changelog.d/1790.change.rst | 2 ++ pkg_resources/__init__.py | 13 ++++++-- pkg_resources/tests/test_pkg_resources.py | 54 +++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 changelog.d/1790.change.rst diff --git a/changelog.d/1790.change.rst b/changelog.d/1790.change.rst new file mode 100644 index 00000000..e4a7998d --- /dev/null +++ b/changelog.d/1790.change.rst @@ -0,0 +1,2 @@ +Added the file path to the error message when a ``UnicodeDecodeError`` occurs +while reading a metadata file. diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 97e08d68..1f170cfd 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -1416,8 +1416,17 @@ class NullProvider: def get_metadata(self, name): if not self.egg_info: return "" - value = self._get(self._fn(self.egg_info, name)) - return value.decode('utf-8') if six.PY3 else value + path = self._get_metadata_path(name) + value = self._get(path) + if six.PY2: + return value + try: + return value.decode('utf-8') + except UnicodeDecodeError as exc: + # Include the path in the error message to simplify + # troubleshooting, and without changing the exception type. + exc.reason += ' in {} file at path: {}'.format(name, path) + raise def get_metadata_lines(self, name): return yield_lines(self.get_metadata(name)) diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index a0f2c452..5960868a 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -18,6 +18,7 @@ except ImportError: import mock from pkg_resources import DistInfoDistribution, Distribution, EggInfoDistribution +from setuptools.extern import six from pkg_resources.extern.six.moves import map from pkg_resources.extern.six import text_type, string_types @@ -191,6 +192,59 @@ class TestResourceManager: subprocess.check_call(cmd) +def make_test_distribution(metadata_path, metadata): + """ + Make a test Distribution object, and return it. + + :param metadata_path: the path to the metadata file that should be + created. This should be inside a distribution directory that should + also be created. For example, an argument value might end with + ".dist-info/METADATA". + :param metadata: the desired contents of the metadata file, as bytes. + """ + dist_dir = os.path.dirname(metadata_path) + os.mkdir(dist_dir) + with open(metadata_path, 'wb') as f: + f.write(metadata) + dists = list(pkg_resources.distributions_from_metadata(dist_dir)) + dist, = dists + + return dist + + +def test_get_metadata__bad_utf8(tmpdir): + """ + Test a metadata file with bytes that can't be decoded as utf-8. + """ + filename = 'METADATA' + # Convert the tmpdir LocalPath object to a string before joining. + metadata_path = os.path.join(str(tmpdir), 'foo.dist-info', filename) + # Encode a non-ascii string with the wrong encoding (not utf-8). + metadata = 'née'.encode('iso-8859-1') + dist = make_test_distribution(metadata_path, metadata=metadata) + + if six.PY2: + # In Python 2, get_metadata() doesn't do any decoding. + actual = dist.get_metadata(filename) + assert actual == metadata + return + + # Otherwise, we are in the Python 3 case. + with pytest.raises(UnicodeDecodeError) as excinfo: + dist.get_metadata(filename) + + exc = excinfo.value + actual = str(exc) + expected = ( + # The error message starts with "'utf-8' codec ..." However, the + # spelling of "utf-8" can vary (e.g. "utf8") so we don't include it + "codec can't decode byte 0xe9 in position 1: " + 'invalid continuation byte in METADATA file at path: ' + ) + assert expected in actual, 'actual: {}'.format(actual) + assert actual.endswith(metadata_path), 'actual: {}'.format(actual) + + # TODO: remove this in favor of Path.touch() when Python 2 is dropped. def touch_file(path): """ -- cgit v1.2.3 From 305bb1cefc3251c67b55149139a768ddf474f7b6 Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Thu, 23 May 2019 14:15:19 -0400 Subject: fix assert_string_list docstring value=None raises TypeError DistutilsSetupError: 2 must be a list of strings (got None) --- setuptools/dist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index ea6411b1..1e1b83be 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -213,7 +213,7 @@ def check_importable(dist, attr, value): def assert_string_list(dist, attr, value): - """Verify that value is a string list or None""" + """Verify that value is a string list""" try: assert ''.join(value) != value except (TypeError, ValueError, AttributeError, AssertionError): -- cgit v1.2.3 From 8f848bd777278fc8dcb42dc45751cd8b95ec2a02 Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Wed, 22 May 2019 17:45:44 -0400 Subject: improve `package_data` check Ensure the dictionary values are lists/tuples of strings. Fix #1459. --- changelog.d/1769.change.rst | 1 + setuptools/dist.py | 29 +++++++++++------------ setuptools/tests/test_dist.py | 53 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 68 insertions(+), 15 deletions(-) create mode 100644 changelog.d/1769.change.rst diff --git a/changelog.d/1769.change.rst b/changelog.d/1769.change.rst new file mode 100644 index 00000000..d48a23b6 --- /dev/null +++ b/changelog.d/1769.change.rst @@ -0,0 +1 @@ +Improve ``package_data`` check: ensure the dictionary values are lists/tuples of strings. diff --git a/setuptools/dist.py b/setuptools/dist.py index 1e1b83be..f0f030b5 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -215,6 +215,10 @@ def check_importable(dist, attr, value): def assert_string_list(dist, attr, value): """Verify that value is a string list""" try: + # verify that value is a list or tuple to exclude unordered + # or single-use iterables + assert isinstance(value, (list, tuple)) + # verify that elements of value are strings assert ''.join(value) != value except (TypeError, ValueError, AttributeError, AssertionError): raise DistutilsSetupError( @@ -307,20 +311,17 @@ def check_test_suite(dist, attr, value): def check_package_data(dist, attr, value): """Verify that value is a dictionary of package names to glob lists""" - if isinstance(value, dict): - for k, v in value.items(): - if not isinstance(k, str): - break - try: - iter(v) - except TypeError: - break - else: - return - raise DistutilsSetupError( - attr + " must be a dictionary mapping package names to lists of " - "wildcard patterns" - ) + if not isinstance(value, dict): + raise DistutilsSetupError( + "{!r} must be a dictionary mapping package names to lists of " + "string wildcard patterns".format(attr)) + for k, v in value.items(): + if not isinstance(k, six.string_types): + raise DistutilsSetupError( + "keys of {!r} dict must be strings (got {!r})" + .format(attr, k) + ) + assert_string_list(dist, 'values of {!r} dict'.format(attr), v) def check_packages(dist, attr, value): diff --git a/setuptools/tests/test_dist.py b/setuptools/tests/test_dist.py index 390c3dfc..c771a19a 100644 --- a/setuptools/tests/test_dist.py +++ b/setuptools/tests/test_dist.py @@ -3,7 +3,13 @@ from __future__ import unicode_literals import io -from setuptools.dist import DistDeprecationWarning, _get_unpatched +import re +from distutils.errors import DistutilsSetupError +from setuptools.dist import ( + _get_unpatched, + check_package_data, + DistDeprecationWarning, +) from setuptools import Distribution from setuptools.extern.six.moves.urllib.request import pathname2url from setuptools.extern.six.moves.urllib_parse import urljoin @@ -263,3 +269,48 @@ def test_maintainer_author(name, attrs, tmpdir): else: line = '%s: %s' % (fkey, val) assert line in pkg_lines_set + + +CHECK_PACKAGE_DATA_TESTS = ( + # Valid. + ({ + '': ['*.txt', '*.rst'], + 'hello': ['*.msg'], + }, None), + # Not a dictionary. + (( + ('', ['*.txt', '*.rst']), + ('hello', ['*.msg']), + ), ( + "'package_data' must be a dictionary mapping package" + " names to lists of string wildcard patterns" + )), + # Invalid key type. + ({ + 400: ['*.txt', '*.rst'], + }, ( + "keys of 'package_data' dict must be strings (got 400)" + )), + # Invalid value type. + ({ + 'hello': str('*.msg'), + }, ( + "\"values of 'package_data' dict\" must be a list of strings (got '*.msg')" + )), + # Invalid value type (generators are single use) + ({ + 'hello': (x for x in "generator"), + }, ( + "\"values of 'package_data' dict\" must be a list of strings " + "(got Date: Tue, 23 Jul 2019 11:29:21 +0200 Subject: tests: fix `test_pip_upgrade_from_source` on Python 3.4 Do not test pip's master on 3.4, as support for it has been dropped. --- setuptools/tests/test_virtualenv.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index d7b98c77..74a1284c 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -8,6 +8,8 @@ from pytest_fixture_config import yield_requires_config import pytest_virtualenv +from setuptools.extern import six + from .textwrap import DALS from .test_easy_install import make_nspkg_sdist @@ -75,9 +77,12 @@ def _get_pip_versions(): 'pip==10.0.1', 'pip==18.1', 'pip==19.0.1', - 'https://github.com/pypa/pip/archive/master.zip', ] + # Pip's master dropped support for 3.4. + if not six.PY34: + network_versions.append('https://github.com/pypa/pip/archive/master.zip') + versions = [None] + [ pytest.param(v, **({} if network else {'marks': pytest.mark.skip})) for v in network_versions -- cgit v1.2.3 From 5405d1e2770e798ed755e8cc821f6b95cb480d52 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 12 Aug 2019 06:18:19 +0200 Subject: travis: update PyPy jobs to use more recent versions --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ffcad998..64d0544c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,9 @@ jobs: python: 2.7 - <<: *latest_py2 env: LANG=C - - python: pypy2.7-6.0.0 + - python: pypy env: DISABLE_COVERAGE=1 # Don't run coverage on pypy (too slow). - - python: pypy3.5-6.0.0 + - python: pypy3 env: DISABLE_COVERAGE=1 - python: 3.4 - python: 3.5 -- cgit v1.2.3 From 95d72cc558c7dddef164eb09a880b95e2f484bee Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 13 Aug 2019 09:42:47 -0400 Subject: =?UTF-8?q?Bump=20version:=2041.0.1=20=E2=86=92=2041.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 13 +++++++++++++ changelog.d/1697.change.rst | 1 - changelog.d/1749.change.rst | 1 - changelog.d/1750.change.rst | 1 - changelog.d/1756.change.rst | 1 - changelog.d/1769.change.rst | 1 - changelog.d/1776.doc.rst | 1 - changelog.d/1788.change.rst | 1 - changelog.d/1790.change.rst | 2 -- setup.cfg | 2 +- 11 files changed, 15 insertions(+), 11 deletions(-) delete mode 100644 changelog.d/1697.change.rst delete mode 100644 changelog.d/1749.change.rst delete mode 100644 changelog.d/1750.change.rst delete mode 100644 changelog.d/1756.change.rst delete mode 100644 changelog.d/1769.change.rst delete mode 100644 changelog.d/1776.doc.rst delete mode 100644 changelog.d/1788.change.rst delete mode 100644 changelog.d/1790.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 87acb5ef..5a453660 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 41.0.1 +current_version = 41.1.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 9da22537..9f9603c0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,16 @@ +v41.1.0 +------- + +* #1697: Moved most of the constants from setup.py to setup.cfg +* #1749: Fixed issue with the PEP 517 backend where building a source distribution would fail if any tarball existed in the destination directory. +* #1750: Fixed an issue with PEP 517 backend where wheel builds would fail if the destination directory did not already exist. +* #1756: Forse metadata-version >= 1.2. when project urls are present. +* #1769: Improve ``package_data`` check: ensure the dictionary values are lists/tuples of strings. +* #1788: Changed compatibility fallback logic for ``html.unescape`` to avoid accessing ``HTMLParser.unescape`` when not necessary. ``HTMLParser.unescape`` is deprecated and will be removed in Python 3.9. +* #1790: Added the file path to the error message when a ``UnicodeDecodeError`` occurs while reading a metadata file. +* #1776: Use license classifiers rather than the license field. + + v41.0.1 ------- diff --git a/changelog.d/1697.change.rst b/changelog.d/1697.change.rst deleted file mode 100644 index 44818b3c..00000000 --- a/changelog.d/1697.change.rst +++ /dev/null @@ -1 +0,0 @@ -Moved most of the constants from setup.py to setup.cfg diff --git a/changelog.d/1749.change.rst b/changelog.d/1749.change.rst deleted file mode 100644 index de678072..00000000 --- a/changelog.d/1749.change.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed issue with the PEP 517 backend where building a source distribution would fail if any tarball existed in the destination directory. diff --git a/changelog.d/1750.change.rst b/changelog.d/1750.change.rst deleted file mode 100644 index 7a22229e..00000000 --- a/changelog.d/1750.change.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed an issue with PEP 517 backend where wheel builds would fail if the destination directory did not already exist. diff --git a/changelog.d/1756.change.rst b/changelog.d/1756.change.rst deleted file mode 100644 index 5c908d35..00000000 --- a/changelog.d/1756.change.rst +++ /dev/null @@ -1 +0,0 @@ -Forse metadata-version >= 1.2. when project urls are present. diff --git a/changelog.d/1769.change.rst b/changelog.d/1769.change.rst deleted file mode 100644 index d48a23b6..00000000 --- a/changelog.d/1769.change.rst +++ /dev/null @@ -1 +0,0 @@ -Improve ``package_data`` check: ensure the dictionary values are lists/tuples of strings. diff --git a/changelog.d/1776.doc.rst b/changelog.d/1776.doc.rst deleted file mode 100644 index d4f1dbca..00000000 --- a/changelog.d/1776.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Use license classifiers rather than the license field. diff --git a/changelog.d/1788.change.rst b/changelog.d/1788.change.rst deleted file mode 100644 index d8a49fd4..00000000 --- a/changelog.d/1788.change.rst +++ /dev/null @@ -1 +0,0 @@ -Changed compatibility fallback logic for ``html.unescape`` to avoid accessing ``HTMLParser.unescape`` when not necessary. ``HTMLParser.unescape`` is deprecated and will be removed in Python 3.9. diff --git a/changelog.d/1790.change.rst b/changelog.d/1790.change.rst deleted file mode 100644 index e4a7998d..00000000 --- a/changelog.d/1790.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added the file path to the error message when a ``UnicodeDecodeError`` occurs -while reading a metadata file. diff --git a/setup.cfg b/setup.cfg index ff87464b..3bcf4429 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ universal = 1 [metadata] name = setuptools -version = 41.0.1 +version = 41.1.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 42bd00ada0e0f47c2446d6d1b750eb97eba45640 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 13 Aug 2019 09:47:19 -0400 Subject: Prefer token for automated releases --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 64d0544c..13815fd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,9 +35,9 @@ jobs: on: tags: true all_branches: true - user: jaraco + user: __token__ password: - secure: tfWrsQMH2bHrWjqnP+08IX1WlkbW94Q30f4d7lCyhWS1FIf/jBDx4jrEILNfMxQ1NCwuBRje5sihj1Ow0BFf0vVrkaeff2IdvnNDEGFduMejaEQJL3s3QrLfpiAvUbtqwyWaHfAdGfk48PovDKTx0ZTvXZKYGXZhxGCYSlG2CE6Y6RDvnEl6Tk8e+LqUohkcSOwxrRwUoyxSnUaavdGohXxDT8MJlfWOXgr2u+KsRrriZqp3l6Fdsnk4IGvy6pXpy42L1HYQyyVu9XyJilR2JTbC6eCp5f8p26093m1Qas49+t6vYb0VLqQe12dO+Jm3v4uztSS5pPQzS7PFyjEYd2Rdb6ijsdbsy1074S4q7G9Sz+T3RsPUwYEJ07lzez8cxP64dtj5j94RL8m35A1Fb1OE8hHN+4c1yLG1gudfXbem+fUhi2eqhJrzQo5vsvDv1xS5x5GIS5ZHgKHCsWcW1Tv+dsFkrhaup3uU6VkOuc9UN+7VPsGEY7NvquGpTm8O1CnGJRzuJg6nbYRGj8ORwDpI0KmrExx6akV92P72fMC/I5TCgbSQSZn370H3Jj40gz1SM30WAli9M+wFHFd4ddMVY65yxj0NLmrP+m1tvnWdKtNh/RHuoW92d9/UFtiA5IhMf1/3djfsjBq6S9NT1uaLkVkTttqrPYJ7hOql8+g= + secure: lBgpqft5tKMPRGefCPScPLWNKKGPF89kYrGt3RogqZrb9xB9+52bNrHgt0M5H2EQIRW9IC7/RFRXpT/dF4N8CT1hsljSVQxTQxiGazEYPSdEfOJ2CJxqs0smiL5Ck1T8EQeiuqRSM+/RFEDNaTjp+fe4HhSoPhea6TojAXRSzKdmcDLCwSJOujDccz0yMOagibnqfhO6ZsIv1LUUHWBeeUVrmx+3lz6uAqmNIOQ6hn6YTP4HLoEXTN+IIeQGIzXEZwY2Z/OXakiugxeNZOgRlkikT32KXyZ01hOhOdPOWrtv+q9tAAdqUeQmtdfFb3zy2vBr6bJkvplI5Obh/qHTphWA3iOTOoCICFYPhXY/npztwwqG7jFBRsZbWo1zuP92zUji6OoxK0ezkqEQcIhu+qsUERmsuowriNyFJZK8zVRdGc7JGaZvYe1h9k4l44J+VEIXUurKWji8BpL7dxq/ZPZRf2r5P2JqhU1VkGXrNgfze/N7U1Z1oUkHo1g/5InOl8nDN4Ul0oRXm9tezk5vYO/RMs9hphTdzda4iETikVjnXyHScSLWwI0UqF5MQdKBYsOCJM9deirWG2gXXspkW4HPkYUUe1pTCkaqoQ9+fWHcKTeDVT/52iuCsaSOJccOItyQqH/4nS3i3LaEf11DPMKKL58pbkoMD56p9iSrCCs= distributions: release skip_cleanup: true skip_upload_docs: true -- cgit v1.2.3 From e40a6035d9e688d5a34077132b49c48dc74932f4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 13 Aug 2019 13:39:28 -0400 Subject: Revert "Prefer token for automated releases" This reverts commit 42bd00ada0e0f47c2446d6d1b750eb97eba45640. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 13815fd4..64d0544c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,9 +35,9 @@ jobs: on: tags: true all_branches: true - user: __token__ + user: jaraco password: - secure: lBgpqft5tKMPRGefCPScPLWNKKGPF89kYrGt3RogqZrb9xB9+52bNrHgt0M5H2EQIRW9IC7/RFRXpT/dF4N8CT1hsljSVQxTQxiGazEYPSdEfOJ2CJxqs0smiL5Ck1T8EQeiuqRSM+/RFEDNaTjp+fe4HhSoPhea6TojAXRSzKdmcDLCwSJOujDccz0yMOagibnqfhO6ZsIv1LUUHWBeeUVrmx+3lz6uAqmNIOQ6hn6YTP4HLoEXTN+IIeQGIzXEZwY2Z/OXakiugxeNZOgRlkikT32KXyZ01hOhOdPOWrtv+q9tAAdqUeQmtdfFb3zy2vBr6bJkvplI5Obh/qHTphWA3iOTOoCICFYPhXY/npztwwqG7jFBRsZbWo1zuP92zUji6OoxK0ezkqEQcIhu+qsUERmsuowriNyFJZK8zVRdGc7JGaZvYe1h9k4l44J+VEIXUurKWji8BpL7dxq/ZPZRf2r5P2JqhU1VkGXrNgfze/N7U1Z1oUkHo1g/5InOl8nDN4Ul0oRXm9tezk5vYO/RMs9hphTdzda4iETikVjnXyHScSLWwI0UqF5MQdKBYsOCJM9deirWG2gXXspkW4HPkYUUe1pTCkaqoQ9+fWHcKTeDVT/52iuCsaSOJccOItyQqH/4nS3i3LaEf11DPMKKL58pbkoMD56p9iSrCCs= + secure: tfWrsQMH2bHrWjqnP+08IX1WlkbW94Q30f4d7lCyhWS1FIf/jBDx4jrEILNfMxQ1NCwuBRje5sihj1Ow0BFf0vVrkaeff2IdvnNDEGFduMejaEQJL3s3QrLfpiAvUbtqwyWaHfAdGfk48PovDKTx0ZTvXZKYGXZhxGCYSlG2CE6Y6RDvnEl6Tk8e+LqUohkcSOwxrRwUoyxSnUaavdGohXxDT8MJlfWOXgr2u+KsRrriZqp3l6Fdsnk4IGvy6pXpy42L1HYQyyVu9XyJilR2JTbC6eCp5f8p26093m1Qas49+t6vYb0VLqQe12dO+Jm3v4uztSS5pPQzS7PFyjEYd2Rdb6ijsdbsy1074S4q7G9Sz+T3RsPUwYEJ07lzez8cxP64dtj5j94RL8m35A1Fb1OE8hHN+4c1yLG1gudfXbem+fUhi2eqhJrzQo5vsvDv1xS5x5GIS5ZHgKHCsWcW1Tv+dsFkrhaup3uU6VkOuc9UN+7VPsGEY7NvquGpTm8O1CnGJRzuJg6nbYRGj8ORwDpI0KmrExx6akV92P72fMC/I5TCgbSQSZn370H3Jj40gz1SM30WAli9M+wFHFd4ddMVY65yxj0NLmrP+m1tvnWdKtNh/RHuoW92d9/UFtiA5IhMf1/3djfsjBq6S9NT1uaLkVkTttqrPYJ7hOql8+g= distributions: release skip_cleanup: true skip_upload_docs: true -- cgit v1.2.3 From 05f42a2c14275937250c99478c94b20171d14aeb Mon Sep 17 00:00:00 2001 From: A_Rog Date: Wed, 14 Aug 2019 00:40:12 +0100 Subject: Fixed html sidebars to supported version in Sphinx (#1804) --- .travis.yml | 2 ++ changelog.d/1565.misc.rst | 2 ++ docs/conf.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog.d/1565.misc.rst diff --git a/.travis.yml b/.travis.yml index 64d0544c..8441261d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,8 @@ jobs: - <<: *latest_py3 env: LANG=C - python: 3.8-dev + - <<: *latest_py3 + env: TOXENV=docs DISABLE_COVERAGE=1 - <<: *default_py stage: deploy (to PyPI for tagged commits) if: tag IS present diff --git a/changelog.d/1565.misc.rst b/changelog.d/1565.misc.rst new file mode 100644 index 00000000..ca15573a --- /dev/null +++ b/changelog.d/1565.misc.rst @@ -0,0 +1,2 @@ +Changed html_sidebars from string to list of string as per +https://www.sphinx-doc.org/en/master/changes.html#id58 diff --git a/docs/conf.py b/docs/conf.py index c7eb6d3f..cbd19fb4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -69,7 +69,7 @@ html_theme_path = ['_theme'] html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -html_sidebars = {'index': 'indexsidebar.html'} +html_sidebars = {'index': ['relations.html', 'sourcelink.html', 'indexsidebar.html', 'searchbox.html']} # If false, no module index is generated. html_use_modindex = False -- cgit v1.2.3 From eb7436b36f9967d1becd2b822da548bd59b35d05 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 8 Jul 2019 09:32:21 -0700 Subject: Fix some usage of deprecated `imp` module --- changelog.d/479.change.rst | 1 + setuptools/command/build_ext.py | 10 ++++++++-- setuptools/command/install_lib.py | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 changelog.d/479.change.rst diff --git a/changelog.d/479.change.rst b/changelog.d/479.change.rst new file mode 100644 index 00000000..d494c0fc --- /dev/null +++ b/changelog.d/479.change.rst @@ -0,0 +1 @@ +Remove some usage of the deprecated ``imp`` module. diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 60a8a32f..daa8e4fe 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -1,7 +1,6 @@ import os import sys import itertools -import imp from distutils.command.build_ext import build_ext as _du_build_ext from distutils.file_util import copy_file from distutils.ccompiler import new_compiler @@ -12,6 +11,13 @@ from distutils import log from setuptools.extension import Library from setuptools.extern import six +if six.PY2: + import imp + + EXTENSION_SUFFIXES = [s for s, _, tp in imp.get_suffixes() if tp == imp.C_EXTENSION] +else: + from importlib.machinery import EXTENSION_SUFFIXES + try: # Attempt to use Cython for building extensions, if available from Cython.Distutils.build_ext import build_ext as _build_ext @@ -64,7 +70,7 @@ if_dl = lambda s: s if have_rtld else '' def get_abi3_suffix(): """Return the file extension for an abi3-compliant Extension()""" - for suffix, _, _ in (s for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION): + for suffix in EXTENSION_SUFFIXES: if '.abi3' in suffix: # Unix return suffix elif suffix == '.pyd': # Windows diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 2b31c3e3..07d65933 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -1,5 +1,5 @@ import os -import imp +import sys from itertools import product, starmap import distutils.command.install_lib as orig @@ -74,10 +74,10 @@ class install_lib(orig.install_lib): yield '__init__.pyc' yield '__init__.pyo' - if not hasattr(imp, 'get_tag'): + if not hasattr(sys, 'implementation'): return - base = os.path.join('__pycache__', '__init__.' + imp.get_tag()) + base = os.path.join('__pycache__', '__init__.' + sys.implementation.cache_tag) yield base + '.pyc' yield base + '.pyo' yield base + '.opt-1.pyc' -- cgit v1.2.3 From 35233197be40eafa1e81d71aedeb82af1a761f54 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 21 Aug 2019 04:49:30 -0400 Subject: Once again, use token for cutting releases. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8441261d..8b7cece8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,9 +37,9 @@ jobs: on: tags: true all_branches: true - user: jaraco + user: __token__ password: - secure: tfWrsQMH2bHrWjqnP+08IX1WlkbW94Q30f4d7lCyhWS1FIf/jBDx4jrEILNfMxQ1NCwuBRje5sihj1Ow0BFf0vVrkaeff2IdvnNDEGFduMejaEQJL3s3QrLfpiAvUbtqwyWaHfAdGfk48PovDKTx0ZTvXZKYGXZhxGCYSlG2CE6Y6RDvnEl6Tk8e+LqUohkcSOwxrRwUoyxSnUaavdGohXxDT8MJlfWOXgr2u+KsRrriZqp3l6Fdsnk4IGvy6pXpy42L1HYQyyVu9XyJilR2JTbC6eCp5f8p26093m1Qas49+t6vYb0VLqQe12dO+Jm3v4uztSS5pPQzS7PFyjEYd2Rdb6ijsdbsy1074S4q7G9Sz+T3RsPUwYEJ07lzez8cxP64dtj5j94RL8m35A1Fb1OE8hHN+4c1yLG1gudfXbem+fUhi2eqhJrzQo5vsvDv1xS5x5GIS5ZHgKHCsWcW1Tv+dsFkrhaup3uU6VkOuc9UN+7VPsGEY7NvquGpTm8O1CnGJRzuJg6nbYRGj8ORwDpI0KmrExx6akV92P72fMC/I5TCgbSQSZn370H3Jj40gz1SM30WAli9M+wFHFd4ddMVY65yxj0NLmrP+m1tvnWdKtNh/RHuoW92d9/UFtiA5IhMf1/3djfsjBq6S9NT1uaLkVkTttqrPYJ7hOql8+g= + secure: FSp9KU+pdvWPxBOaxe6BNmcJ9y8259G3/NdTJ00r0qx/xMLpSneGjpuLqoD6BL2JoM6gRwurwakWoH/9Ah+Di7afETjMnL6WJKtDZ+Uu3YLx3ss7/FlhVz6zmVTaDJUzuo9dGr//qLBQTIxVjGYfQelRJyfMAXtrYWdeT/4489E45lMw+86Z/vnSBOxs4lWekeQW5Gem0cDViWu67RRiGkAEvrYVwuImMr2Dyhpv+l/mQGQIS/ezXuAEFToE6+q8VUVe/aK498Qovdc+O4M7OYk1JouFpffZ3tVZ6iWHQFcR11480UdI6VCIcFpPvGC/J8MWUWLjq7YOm0X9jPXgdYMUQLAP4clFgUr2qNoRSKWfuQlNdVVuS2htYcjJ3eEl90FhcIZKp+WVMrypRPOQJ8CBielZEs0dhytRrZSaJC1BNq25O/BPzws8dL8hYtoXsM6I3Zv5cZgdyqyq/eOEMCX7Cetv6do0U41VGEV5UohvyyuwH5l9GCuPREpY3sXayPg8fw7XcPjvvzSVyjcUT/ePW8sfnAyWZnngjweAn6dK8IFGPuSPQdlos78uxeUOvCVUW0xv/0m4lX73yoHdVVdLbu1MJTyibFGec86Bew9JqIcDlhHaIJ9ihZ9Z9tOtvp1cuNyKYE4kvmOtumDDicEw4DseYn2z5sZDTYTBsKY= distributions: release skip_cleanup: true skip_upload_docs: true -- cgit v1.2.3 From a3e6e68365079642d8949b26ecb810751cc15ef1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 21 Aug 2019 04:50:43 -0400 Subject: =?UTF-8?q?Bump=20version:=2041.1.0=20=E2=86=92=2041.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 8 ++++++++ changelog.d/1565.misc.rst | 2 -- changelog.d/479.change.rst | 1 - setup.cfg | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) delete mode 100644 changelog.d/1565.misc.rst delete mode 100644 changelog.d/479.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 5a453660..5e7e8ee4 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 41.1.0 +current_version = 41.2.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 9f9603c0..84007b31 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,11 @@ +v41.2.0 +------- + +* #479: Remove some usage of the deprecated ``imp`` module. +* #1565: Changed html_sidebars from string to list of string as per + https://www.sphinx-doc.org/en/master/changes.html#id58 + + v41.1.0 ------- diff --git a/changelog.d/1565.misc.rst b/changelog.d/1565.misc.rst deleted file mode 100644 index ca15573a..00000000 --- a/changelog.d/1565.misc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Changed html_sidebars from string to list of string as per -https://www.sphinx-doc.org/en/master/changes.html#id58 diff --git a/changelog.d/479.change.rst b/changelog.d/479.change.rst deleted file mode 100644 index d494c0fc..00000000 --- a/changelog.d/479.change.rst +++ /dev/null @@ -1 +0,0 @@ -Remove some usage of the deprecated ``imp`` module. diff --git a/setup.cfg b/setup.cfg index 3bcf4429..96792dd3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ universal = 1 [metadata] name = setuptools -version = 41.1.0 +version = 41.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 04940b6e09bb5054666442196383c2fe9e5a09a2 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Tue, 3 Sep 2019 21:36:49 +0300 Subject: Fix typo in CHANGES.rst --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 84007b31..dd47cb43 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,7 +12,7 @@ v41.1.0 * #1697: Moved most of the constants from setup.py to setup.cfg * #1749: Fixed issue with the PEP 517 backend where building a source distribution would fail if any tarball existed in the destination directory. * #1750: Fixed an issue with PEP 517 backend where wheel builds would fail if the destination directory did not already exist. -* #1756: Forse metadata-version >= 1.2. when project urls are present. +* #1756: Force metadata-version >= 1.2. when project urls are present. * #1769: Improve ``package_data`` check: ensure the dictionary values are lists/tuples of strings. * #1788: Changed compatibility fallback logic for ``html.unescape`` to avoid accessing ``HTMLParser.unescape`` when not necessary. ``HTMLParser.unescape`` is deprecated and will be removed in Python 3.9. * #1790: Added the file path to the error message when a ``UnicodeDecodeError`` occurs while reading a metadata file. -- cgit v1.2.3