dvc: use getdirinfo from ntfsutils

We can now use getdirinfo directly, since our patch
https://github.com/sid0/ntfs/pull/10 is now merged
and released in ntfsutils 0.1.4.

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-03-22 13:27:08 +02:00
parent af6ac421fd
commit 13e0e9d2e4
3 changed files with 5 additions and 19 deletions
+3 -17
View File
@@ -6,7 +6,7 @@ from builtins import str
if os.name == 'nt':
import ntfsutils.hardlink as winlink
from ntfsutils.fs import *
from ntfsutils.fs import getdirinfo
class System(object):
@@ -24,27 +24,13 @@ class System(object):
return winlink.create(source, link_name)
@staticmethod
def _getfileinfo(path):
# FIXME: current implementation from ntfsutils doesn't support dirs,
# and until https://github.com/sid0/ntfs/pull/10 is not merged and
# pip package not updated, we have to use our own version.
hfile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, None, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, None)
if hfile is None:
raise WinError()
info = BY_HANDLE_FILE_INFORMATION()
rv = GetFileInformationByHandle(hfile, info)
CloseHandle(hfile)
if rv == 0:
raise WinError()
return info
@staticmethod
def inode(path):
if System.is_unix():
return os.stat(path).st_ino
info = System._getfileinfo(path)
# getdirinfo from ntfsutils works on both files and dirs
info = getdirinfo(path)
return hash((info.dwVolumeSerialNumber, info.nFileIndexHigh, info.nFileIndexLow))
@staticmethod
+1 -1
View File
@@ -10,7 +10,7 @@ configobj>=5.0.6
networkx>=1.11
pyyaml>=3.12
gitpython>=2.1.8
ntfsutils>=0.1.3
ntfsutils>=0.1.4
checksumdir>=1.1.4
setuptools>=34.0.0
nanotime>=0.5.2
+1 -1
View File
@@ -16,7 +16,7 @@ install_requires = [
"networkx>=1.11",
"pyyaml>=3.12",
"gitpython>=2.1.8",
"ntfsutils>=0.1.3",
"ntfsutils>=0.1.4",
"checksumdir>=1.1.4",
"setuptools>=34.0.0",
"nanotime>=0.5.2",