From afe4c8427916276cde883358f50c52b15065cdca Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Sat, 13 Nov 2021 15:58:51 +0100 Subject: [PATCH] Do not reinstall in develop mode without setup.py The detection logic for figuring out whether a editable install needs to be reinstalled only works for setuptools based builds using setup.py. If setup.py cannot be found the code will fail with an invocation error. Currently no standard mechanism exists to query a package installed in editable mode whether it should be reinstalled or not. Hence, this change skips reinstallation if setup.py cannot be found. Fixes #2197 --- CONTRIBUTORS | 1 + docs/changelog/2197.bugfix.rst | 1 + docs/config.rst | 4 +++- src/tox/venv.py | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/2197.bugfix.rst diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d91bef3475..e353a3e2c5 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -114,6 +114,7 @@ Tim Laurence Tyagraj Desigar Usama Sadiq Ville Skyttä +Vincent Vanlaer Vlastimil Zíma Xander Johnson anatoly techtonik diff --git a/docs/changelog/2197.bugfix.rst b/docs/changelog/2197.bugfix.rst new file mode 100644 index 0000000000..9fc18563a1 --- /dev/null +++ b/docs/changelog/2197.bugfix.rst @@ -0,0 +1 @@ +Fixed an issue where ``usedevelop`` would cause an invocation error if setup.py does not exist. -- by :user:`VincentVanlaer` diff --git a/docs/config.rst b/docs/config.rst index da10f38c96..231ccc0530 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -596,7 +596,9 @@ Complete list of settings that you can put into ``testenv*`` sections: Install the current package in development mode with "setup.py develop" instead of installing from the ``sdist`` package. (This uses pip's ``-e`` option, so should be avoided if you've specified a - custom :conf:`install_command` that does not support ``-e``). + custom :conf:`install_command` that does not support ``-e``). Note that + changes to the build/install process (including changes in dependencies) + are only detected when using setuptools with setup.py. .. conf:: skip_install ^ true|false ^ false diff --git a/src/tox/venv.py b/src/tox/venv.py index 7ba743f807..cdd6949a19 100644 --- a/src/tox/venv.py +++ b/src/tox/venv.py @@ -325,6 +325,10 @@ def finish(self): def _needs_reinstall(self, setupdir, action): setup_py = setupdir.join("setup.py") + + if not setup_py.exists(): + return False + setup_cfg = setupdir.join("setup.cfg") args = [self.envconfig.envpython, str(setup_py), "--name"] env = self._get_os_environ()