Update Windows Python 2 link workaround to use helper functions

This commit is contained in:
ines 2017-03-25 14:04:27 +01:00
parent fdec758113
commit 97814f8da6

View File

@ -5,7 +5,6 @@ import pip
from pathlib import Path from pathlib import Path
import importlib import importlib
from .. import util from .. import util
import sys
def link(origin, link_name, force=False): def link(origin, link_name, force=False):
@ -44,10 +43,11 @@ def symlink(model_path, link_name, force):
elif link_path.exists(): elif link_path.exists():
link_path.unlink() link_path.unlink()
if sys.version.startswith('2.') and sys.platform.startswith('win'): # Add workaround for Python 2 on Windows (see issue #909)
if util.is_python2() and util.is_windows():
import subprocess import subprocess
subprocess.call(['mklink','/d',str(link_path), str(model_path)], command = ['mklink', '/d', link_path.as_posix(), model_path.as_posix()]
shell=True) subprocess.call(command, shell=True)
else: else:
link_path.symlink_to(model_path) link_path.symlink_to(model_path)