Merge pull request #1246 from efiop/master

link: properly catch error on windows
This commit is contained in:
Ruslan Kuprieiev
2018-10-21 05:02:39 +03:00
committed by GitHub
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ install:
- cinst gcloudsdk
- refreshenv
- cinst gsutil
- cinst openssl.light
- cinst openssl.light --version 1.1.1
- python -m pip install -U pip setuptools wheel
- pip install -r requirements.txt
- python setup.py install
+6 -2
View File
@@ -9,6 +9,8 @@ class System(object):
@staticmethod
def hardlink(source, link_name):
import ctypes
from dvc.exceptions import DvcException
if System.is_unix():
os.link(source, link_name)
return
@@ -21,11 +23,13 @@ class System(object):
res = CreateHardLink(link_name, source, None)
if res == 0:
raise ctypes.WinError()
raise DvcException('CreateHardLinkW', cause=ctypes.WinError())
@staticmethod
def symlink(source, link_name):
import ctypes
from dvc.exceptions import DvcException
if System.is_unix():
return os.symlink(source, link_name)
@@ -38,7 +42,7 @@ class System(object):
func.restype = ctypes.c_ubyte
if func(link_name, source, flags) == 0:
raise ctypes.WinError()
raise DvcException('CreateSymbolicLinkW', cause=ctypes.WinError())
@staticmethod
def _reflink_darwin(src, dst):