mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2024-12-25 09:36:13 +01:00
Avoid requiring admin rights on Windows
This fixes an error on Windows (I'm on with Python 3.7) where the symlink cannot be created without admin rights. https://github.com/fedora-python/tox-current-env/pull/24
This commit is contained in:
parent
dc47ce3ddf
commit
bfbc61a4b7
@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tox
|
import tox
|
||||||
|
|
||||||
@ -134,6 +135,10 @@ def tox_testenv_create(venv, action):
|
|||||||
target = sys.executable
|
target = sys.executable
|
||||||
rm_venv(venv)
|
rm_venv(venv)
|
||||||
os.makedirs(os.path.dirname(link))
|
os.makedirs(os.path.dirname(link))
|
||||||
|
if sys.platform == "win32":
|
||||||
|
# Avoid requiring admin rights on Windows
|
||||||
|
subprocess.check_call(f'mklink /J "{link}" "{target}"', shell=True)
|
||||||
|
else:
|
||||||
os.symlink(target, link)
|
os.symlink(target, link)
|
||||||
# prevent tox from creating the venv
|
# prevent tox from creating the venv
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user