diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2019-12-01 09:44:24 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2019-12-01 09:44:24 -0500 |
commit | f8a6f27b42078292fa8624d294558ffcf884c7cd (patch) | |
tree | e92ed09959918ccb4803f3b7d58bb12b43f9c04f | |
parent | 6f46a4b703d4db225e96bb871e1bf6a7c3597329 (diff) | |
parent | 812b83c9b4c6134c559f8609b69bca37d7c1204d (diff) | |
download | python-setuptools-git-f8a6f27b42078292fa8624d294558ffcf884c7cd.tar.gz |
Merge branch 'master' into fix_handling_of_find-links_in_setup.cfg
-rw-r--r-- | README.rst | 11 | ||||
-rw-r--r-- | changelog.d/1922.change.rst | 1 | ||||
-rw-r--r-- | docs/_templates/indexsidebar.html | 14 | ||||
-rw-r--r-- | setuptools/installer.py | 16 | ||||
-rw-r--r-- | setuptools/tests/test_easy_install.py | 44 |
5 files changed, 76 insertions, 10 deletions
@@ -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 diff --git a/changelog.d/1922.change.rst b/changelog.d/1922.change.rst new file mode 100644 index 00000000..837ef9c9 --- /dev/null +++ b/changelog.d/1922.change.rst @@ -0,0 +1 @@ +Build dependencies (setup_requires and tests_require) now install transitive dependencies indicated by extras. diff --git a/docs/_templates/indexsidebar.html b/docs/_templates/indexsidebar.html index 504de6b0..d803b8a3 100644 --- a/docs/_templates/indexsidebar.html +++ b/docs/_templates/indexsidebar.html @@ -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> diff --git a/setuptools/installer.py b/setuptools/installer.py index a5816608..9f8be2ef 100644 --- a/setuptools/installer.py +++ b/setuptools/installer.py @@ -73,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. @@ -136,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 diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index a21651ec..2be1be47 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -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 @@ -782,6 +783,49 @@ class TestSetupRequires: 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): """ |