Skip to content

Commit

Permalink
Do not reinstall in develop mode without setup.py
Browse files Browse the repository at this point in the history
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 tox-dev#2197
  • Loading branch information
VincentVanlaer committed Nov 13, 2021
1 parent 4cf816c commit afe4c84
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Tim Laurence
Tyagraj Desigar
Usama Sadiq
Ville Skyttä
Vincent Vanlaer
Vlastimil Zíma
Xander Johnson
anatoly techtonik
1 change: 1 addition & 0 deletions docs/changelog/2197.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed an issue where ``usedevelop`` would cause an invocation error if setup.py does not exist. -- by :user:`VincentVanlaer`
4 changes: 3 additions & 1 deletion docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions src/tox/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit afe4c84

Please sign in to comment.