mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2024-12-24 09:06:15 +01:00
Remove duplicate code and only delete venv if needed
There is no associated issue. I was juts reading the code and noticed those two related things.
This commit is contained in:
parent
688a41cceb
commit
dc47ce3ddf
@ -132,13 +132,14 @@ def tox_testenv_create(venv, action):
|
|||||||
# Remove the rest of the virtualenv.
|
# Remove the rest of the virtualenv.
|
||||||
link = venv.envconfig.get_envpython()
|
link = venv.envconfig.get_envpython()
|
||||||
target = sys.executable
|
target = sys.executable
|
||||||
shutil.rmtree(os.path.dirname(os.path.dirname(link)), ignore_errors=True)
|
rm_venv(venv)
|
||||||
os.makedirs(os.path.dirname(link))
|
os.makedirs(os.path.dirname(link))
|
||||||
os.symlink(target, link)
|
os.symlink(target, link)
|
||||||
|
# prevent tox from creating the venv
|
||||||
return True
|
return True
|
||||||
else:
|
if not is_proper_venv(venv):
|
||||||
rm_venv(venv)
|
rm_venv(venv)
|
||||||
return None # let tox handle the rest
|
return None # let tox handle the rest
|
||||||
|
|
||||||
|
|
||||||
@tox.hookimpl
|
@tox.hookimpl
|
||||||
|
Loading…
Reference in New Issue
Block a user