From 9485c4e6a0359aff268480520d00cbe8cb5f03c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sat, 20 Feb 2021 16:10:21 +0100 Subject: [PATCH 1/4] Fix --target not working with --editable as setup.py develop does not understand --home but instead requires the --install-dir option. Parially fixes #4390 --- src/pip/_internal/utils/setuptools_build.py | 3 ++- tests/functional/test_install.py | 22 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/pip/_internal/utils/setuptools_build.py b/src/pip/_internal/utils/setuptools_build.py index 7d91f6f2677..0458a4d0484 100644 --- a/src/pip/_internal/utils/setuptools_build.py +++ b/src/pip/_internal/utils/setuptools_build.py @@ -103,7 +103,8 @@ def make_setuptools_develop_args( if prefix: args += ["--prefix", prefix] if home is not None: - args += ["--home", home] + # args += ["--home", home] + args += ["--install-dir", home] if use_user_site: args += ["--user", "--prefix="] diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 2cfb3d3d272..39a06ec3f8f 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -1059,6 +1059,28 @@ def test_install_editable_with_prefix(script): result.did_create(install_path) +@pytest.mark.network +def test_install_editable_with_target(script): + pkg_path = script.scratch_path / 'pkg' + pkg_path.mkdir() + pkg_path.joinpath("setup.py").write_text(textwrap.dedent(""" + from setuptools import setup + setup( + name='pkg', + install_requires=['watching_testrunner'] + ) + """)) + + target = script.scratch_path / 'target' + target.mkdir() + result = script.pip( + 'install', '--editable', pkg_path, '--target', target + ) + + result.did_create(script.scratch / 'target' / 'pkg.egg-link') + result.did_create(script.scratch / 'target' / 'watching_testrunner.py') + + def test_install_package_conflict_prefix_and_user(script, data): """ Test installing a package using pip install --prefix --user errors out From 4d3b9fe7f628ff2e860ca175f95a81219af4e2a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sat, 20 Feb 2021 16:16:59 +0100 Subject: [PATCH 2/4] Add news entry. --- news/4390.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/4390.bugfix.rst diff --git a/news/4390.bugfix.rst b/news/4390.bugfix.rst new file mode 100644 index 00000000000..9f0afb5bb6f --- /dev/null +++ b/news/4390.bugfix.rst @@ -0,0 +1 @@ +Fix --target to work with --editable installs. From 8add29f9605725d6b09784ca0fa8218c16829826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AErekc=C3=A4H=20nitraM=E2=80=AE?= Date: Sat, 20 Feb 2021 20:19:08 +0100 Subject: [PATCH 3/4] Better formatting Thanks @webknjaz Co-authored-by: Sviatoslav Sydorenko --- news/4390.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/4390.bugfix.rst b/news/4390.bugfix.rst index 9f0afb5bb6f..0d84de5cf48 100644 --- a/news/4390.bugfix.rst +++ b/news/4390.bugfix.rst @@ -1 +1 @@ -Fix --target to work with --editable installs. +Fixed ``--target`` to work with ``--editable`` installs. From 7b2548905db91b584b5f8a11e7d3c87bf807faae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sat, 20 Feb 2021 20:17:59 +0100 Subject: [PATCH 4/4] Remove dead code --- src/pip/_internal/utils/setuptools_build.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pip/_internal/utils/setuptools_build.py b/src/pip/_internal/utils/setuptools_build.py index 0458a4d0484..d6eff99384f 100644 --- a/src/pip/_internal/utils/setuptools_build.py +++ b/src/pip/_internal/utils/setuptools_build.py @@ -103,7 +103,6 @@ def make_setuptools_develop_args( if prefix: args += ["--prefix", prefix] if home is not None: - # args += ["--home", home] args += ["--install-dir", home] if use_user_site: