From 76c2f812f0366dd7d3bd8d54ba9566febab70e16 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 23 Sep 2018 14:17:19 +0300 Subject: [PATCH] osx: reflink: check if clib has clonefile() Signed-off-by: Ruslan Kuprieiev --- dvc/system.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/dvc/system.py b/dvc/system.py index 56121e7c1..5348d5867 100644 --- a/dvc/system.py +++ b/dvc/system.py @@ -36,15 +36,12 @@ class System(object): @staticmethod def _reflink_darwin(src, dst): import ctypes - import platform - version = platform.mac_ver()[0] - major, minor, patch = version.split('.') - # Starting from High Sierra - if major < 10 or (major == 10 and minor < 13): + clib = ctypes.CDLL('libc.dylib') + if not hasattr(clib, 'clonefile'): return -1 - clonefile = ctypes.CDLL('libc.dylib').clonefile + clonefile = clib.clonefile clonefile.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int]