Imported Upstream version 42.0.2 upstream/42.0.2
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 29 Dec 2020 22:04:37 +0000 (07:04 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 29 Dec 2020 22:04:37 +0000 (07:04 +0900)
.bumpversion.cfg
.travis.yml
CHANGES.rst
README.rst
docs/_templates/indexsidebar.html
setup.cfg
setuptools/installer.py
setuptools/tests/test_easy_install.py
tox.ini

index e37acce5f92a74e80459e7d05c924d8c65f1f2de..8a9f4435a01173af94652070de1b644cfa2fd792 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 42.0.1
+current_version = 42.0.2
 commit = True
 tag = True
 
index 7088d16621504fdcb0ec9f065b0fcc519702b45d..b3a6556d663cf6d76ef2578c7b27a3d1efdd2dad 100644 (file)
@@ -14,8 +14,7 @@ jobs:
     env: DISABLE_COVERAGE=1
   - python: 3.4
   - python: 3.5
-  - &default_py
-    python: 3.6
+  - python: 3.6
   - python: 3.7
   - &latest_py3
     python: 3.8
@@ -24,26 +23,11 @@ jobs:
   - python: 3.8-dev
   - <<: *latest_py3
     env: TOXENV=docs DISABLE_COVERAGE=1
-  - <<: *default_py
-    stage: deploy (to PyPI for tagged commits)
+  - <<: *latest_py3
+    stage: deploy
     if: tag IS present
-    install: skip
-    script: skip
-    after_success: true
-    before_deploy:
-      - python bootstrap.py
-      - "! grep pyc setuptools.egg-info/SOURCES.txt"
-    deploy:
-      provider: pypi
-      on:
-        tags: true
-        all_branches: true
-      user: __token__
-      password:
-        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
+    script: tox -e release
+    after_success: skip
 
 cache: pip
 
index da657c28018996d04973bd65f2aae88664e73b7c..81abbe5976063aa9d0c918f4c1b599faabf7878f 100644 (file)
@@ -1,3 +1,10 @@
+v42.0.2
+-------
+
+* #1921: Fix support for easy_install's ``find-links`` option in ``setup.cfg``.
+* #1922: Build dependencies (setup_requires and tests_require) now install transitive dependencies indicated by extras.
+
+
 v42.0.1
 -------
 
index dac8a468736693ea7c872ee961415a4162e0a5c4..da0549a98a723aa7fc43e2da5c1d570d0236fd37 100644 (file)
@@ -34,8 +34,17 @@ To report a security vulnerability, please use the
 Tidelift will coordinate the fix and disclosure.
 
 
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+Setuptools and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more <https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=referral&utm_campaign=github>`_.
+
 Code of Conduct
----------------
+===============
 
 Everyone interacting in the setuptools project's codebases, issue trackers,
 chat rooms, and mailing lists is expected to follow the
index 504de6b0691de635f51c6e9235d01272a8dea00d..d803b8a37a10fc092564d2dc8b14d1d545153a4c 100644 (file)
@@ -1,3 +1,10 @@
+<h3 class="donation">For Enterprise</h3>
+
+<p>
+Professionally-supported {{ project }} is available with the
+<a href="https://tidelift.com/subscription/pkg/pypi-{{ project }}?utm_source=pypi-{{ project }}&utm_medium=referral">Tidelift Subscription</a>.
+</p>
+
 <h3>Download</h3>
 
 <p>Current version: <b>{{ version }}</b></p>
@@ -6,10 +13,3 @@
 <h3>Questions? Suggestions? Contributions?</h3>
 
 <p>Visit the <a href="{{ package_url }}">Project page</a> </p>
-
-<h3 class="donation">Professional support</h3>
-
-<p>
-Professionally-supported {{ project }} is available with the
-<a href="https://tidelift.com/subscription/pkg/pypi-{{ project }}?utm_source=pypi-{{ project }}&utm_medium=readme">Tidelift Subscription</a>.
-</p>
index b8e542798ad353537783df9ce293c8e472f91e2f..68b49d734ab2b198e28efd25958b38a587f01622 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -19,7 +19,7 @@ universal = 1
 
 [metadata]
 name = setuptools
-version = 42.0.1
+version = 42.0.2
 description = Easily download, build, install, upgrade, and uninstall Python packages
 author = Python Packaging Authority
 author_email = distutils-sig@python.org
index 35bc3cc55039e67d3ae57dff49ea97db5fde94c7..9f8be2ef8427651e3b0fbef497535e152dde66b1 100644 (file)
@@ -7,11 +7,20 @@ from distutils.errors import DistutilsError
 
 import pkg_resources
 from setuptools.command.easy_install import easy_install
+from setuptools.extern import six
 from setuptools.wheel import Wheel
 
 from .py31compat import TemporaryDirectory
 
 
+def _fixup_find_links(find_links):
+    """Ensure find-links option end-up being a list of strings."""
+    if isinstance(find_links, six.string_types):
+        return find_links.split()
+    assert isinstance(find_links, (tuple, list))
+    return find_links
+
+
 def _legacy_fetch_build_egg(dist, req):
     """Fetch an egg needed for building.
 
@@ -31,7 +40,7 @@ def _legacy_fetch_build_egg(dist, req):
     if dist.dependency_links:
         links = dist.dependency_links[:]
         if 'find_links' in opts:
-            links = opts['find_links'][1] + links
+            links = _fixup_find_links(opts['find_links'][1]) + links
         opts['find_links'] = ('setup', links)
     install_dir = dist.get_egg_cache_dir()
     cmd = easy_install(
@@ -64,8 +73,8 @@ def fetch_build_egg(dist, req):
         pkg_resources.get_distribution('wheel')
     except pkg_resources.DistributionNotFound:
         dist.announce('WARNING: The wheel package is not available.', log.WARN)
-    if not isinstance(req, pkg_resources.Requirement):
-        req = pkg_resources.Requirement.parse(req)
+    # Ignore environment markers; if supplied, it is required.
+    req = strip_marker(req)
     # Take easy_install options into account, but do not override relevant
     # pip environment variables (like PIP_INDEX_URL or PIP_QUIET); they'll
     # take precedence.
@@ -84,7 +93,7 @@ def fetch_build_egg(dist, req):
     else:
         index_url = None
     if 'find_links' in opts:
-        find_links = opts['find_links'][1][:]
+        find_links = _fixup_find_links(opts['find_links'][1])[:]
     else:
         find_links = []
     if dist.dependency_links:
@@ -127,3 +136,15 @@ def fetch_build_egg(dist, req):
         dist = pkg_resources.Distribution.from_filename(
             dist_location, metadata=dist_metadata)
         return dist
+
+
+def strip_marker(req):
+    """
+    Return a new requirement without the environment marker to avoid
+    calling pip with something like `babel; extra == "i18n"`, which
+    would always be ignored.
+    """
+    # create a copy to avoid mutating the input
+    req = pkg_resources.Requirement.parse(str(req))
+    req.marker = None
+    return req
index aa75899a061222eff19eb331e827f86c947cd5fc..2be1be47e82739c557bbf16218d1b249135a9586 100644 (file)
@@ -37,6 +37,7 @@ from setuptools.tests import fail_on_ascii
 import pkg_resources
 
 from . import contexts
+from .files import build_files
 from .textwrap import DALS
 
 __metaclass__ = type
@@ -744,6 +745,87 @@ class TestSetupRequires:
         eggs = list(map(str, pkg_resources.find_distributions(os.path.join(test_pkg, '.eggs'))))
         assert eggs == ['dep 1.0']
 
+    @pytest.mark.parametrize('use_legacy_installer,with_dependency_links_in_setup_py',
+                             itertools.product((False, True), (False, True)))
+    def test_setup_requires_with_find_links_in_setup_cfg(self, monkeypatch,
+                                                         use_legacy_installer,
+                                                         with_dependency_links_in_setup_py):
+        monkeypatch.setenv(str('PIP_RETRIES'), str('0'))
+        monkeypatch.setenv(str('PIP_TIMEOUT'), str('0'))
+        with contexts.save_pkg_resources_state():
+            with contexts.tempdir() as temp_dir:
+                make_trivial_sdist(os.path.join(temp_dir, 'python-xlib-42.tar.gz'), 'python-xlib', '42')
+                test_pkg = os.path.join(temp_dir, 'test_pkg')
+                test_setup_py = os.path.join(test_pkg, 'setup.py')
+                test_setup_cfg = os.path.join(test_pkg, 'setup.cfg')
+                os.mkdir(test_pkg)
+                with open(test_setup_py, 'w') as fp:
+                    if with_dependency_links_in_setup_py:
+                        dependency_links = [os.path.join(temp_dir, 'links')]
+                    else:
+                        dependency_links = []
+                    fp.write(DALS(
+                        '''
+                        from setuptools import installer, setup
+                        if {use_legacy_installer}:
+                            installer.fetch_build_egg = installer._legacy_fetch_build_egg
+                        setup(setup_requires='python-xlib==42',
+                        dependency_links={dependency_links!r})
+                        ''').format(use_legacy_installer=use_legacy_installer,
+                                    dependency_links=dependency_links))
+                with open(test_setup_cfg, 'w') as fp:
+                    fp.write(DALS(
+                        '''
+                        [easy_install]
+                        index_url = {index_url}
+                        find_links = {find_links}
+                        ''').format(index_url=os.path.join(temp_dir, 'index'),
+                                    find_links=temp_dir))
+                run_setup(test_setup_py, [str('--version')])
+
+    def test_setup_requires_with_transitive_extra_dependency(self, monkeypatch):
+        # Use case: installing a package with a build dependency on
+        # an already installed `dep[extra]`, which in turn depends
+        # on `extra_dep` (whose is not already installed).
+        with contexts.save_pkg_resources_state():
+            with contexts.tempdir() as temp_dir:
+                # Create source distribution for `extra_dep`.
+                make_trivial_sdist(os.path.join(temp_dir, 'extra_dep-1.0.tar.gz'), 'extra_dep', '1.0')
+                # Create source tree for `dep`.
+                dep_pkg = os.path.join(temp_dir, 'dep')
+                os.mkdir(dep_pkg)
+                build_files({
+                    'setup.py':
+                    DALS("""
+                          import setuptools
+                          setuptools.setup(
+                              name='dep', version='2.0',
+                              extras_require={'extra': ['extra_dep']},
+                          )
+                         """),
+                    'setup.cfg': '',
+                }, prefix=dep_pkg)
+                # "Install" dep.
+                run_setup(os.path.join(dep_pkg, 'setup.py'), [str('dist_info')])
+                working_set.add_entry(dep_pkg)
+                # Create source tree for test package.
+                test_pkg = os.path.join(temp_dir, 'test_pkg')
+                test_setup_py = os.path.join(test_pkg, 'setup.py')
+                test_setup_cfg = os.path.join(test_pkg, 'setup.cfg')
+                os.mkdir(test_pkg)
+                with open(test_setup_py, 'w') as fp:
+                    fp.write(DALS(
+                        '''
+                        from setuptools import installer, setup
+                        setup(setup_requires='dep[extra]')
+                        '''))
+                # Check...
+                monkeypatch.setenv(str('PIP_FIND_LINKS'), str(temp_dir))
+                monkeypatch.setenv(str('PIP_NO_INDEX'), str('1'))
+                monkeypatch.setenv(str('PIP_RETRIES'), str('0'))
+                monkeypatch.setenv(str('PIP_TIMEOUT'), str('0'))
+                run_setup(test_setup_py, [str('--version')])
+
 
 def make_trivial_sdist(dist_path, distname, version):
     """
diff --git a/tox.ini b/tox.ini
index 5d439cb34bce97a2edb523251c2557b2f4a6ee49..6d3b9a9bc809e8c590b5b96b89f8d1e613404579 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -55,3 +55,22 @@ source=
        setuptools
 omit=
        */_vendor/*
+
+[testenv:release]
+skip_install = True
+deps =
+       wheel
+       twine[keyring]>=1.13
+       path
+       jaraco.tidelift
+passenv =
+       TWINE_PASSWORD
+       TIDELIFT_TOKEN
+setenv =
+       TWINE_USERNAME = {env:TWINE_USERNAME:__token__}
+commands =
+       python -m bootstrap
+       python -c "import path; path.Path('dist').rmtree_p()"
+       python setup.py release
+       python -m twine upload dist/*
+       python -m jaraco.tidelift.publish-release-notes