Skip to content

Commit 99818e1

Browse files
authored
Merge pull request #10692 from t20100/fix-install-pre
Fix `pip install --pre` for packages with dependencies defined in `pyproject.toml` and `setup.py`
2 parents 8be911b + 23b09c1 commit 99818e1

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

news/10222.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ``pip install --pre`` for packages with pre-release build dependencies defined both in ``pyproject.toml``'s ``build-system.requires`` and ``setup.py``'s ``setup_requires``.

tests/functional/test_install.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,45 @@ def test_editable_install__local_dir_setup_requires_with_pyproject(
733733
script.pip("install", "--find-links", shared_data.find_links, "-e", local_dir)
734734

735735

736+
def test_install_pre__setup_requires_with_pyproject(
737+
script: PipTestEnvironment, shared_data: TestData, common_wheels: Path
738+
) -> None:
739+
"""
740+
Test installing with a pre-release build dependency declared in both
741+
setup.py and pyproject.toml.
742+
743+
https://github.com/pypa/pip/issues/10573
744+
"""
745+
depends_package = "prerelease_dependency"
746+
depends_path = create_basic_wheel_for_package(script, depends_package, "1.0.0a1")
747+
748+
local_dir = script.scratch_path.joinpath("temp")
749+
local_dir.mkdir()
750+
pyproject_path = local_dir.joinpath("pyproject.toml")
751+
pyproject_path.write_text(
752+
"[build-system]\n"
753+
f'requires = ["setuptools", "wheel", "{depends_package}"]\n'
754+
'build-backend = "setuptools.build_meta"\n'
755+
)
756+
setup_py_path = local_dir.joinpath("setup.py")
757+
setup_py_path.write_text(
758+
"from setuptools import setup\n"
759+
f"setup(name='dummy', setup_requires=['{depends_package}'])\n"
760+
)
761+
762+
script.pip(
763+
"install",
764+
"--pre",
765+
"--no-cache-dir",
766+
"--no-index",
767+
"--find-links",
768+
common_wheels,
769+
"--find-links",
770+
depends_path.parent,
771+
local_dir,
772+
)
773+
774+
736775
@pytest.mark.network
737776
def test_upgrade_argparse_shadowed(script: PipTestEnvironment) -> None:
738777
# If argparse is installed - even if shadowed for imported - we support

0 commit comments

Comments
 (0)