Replaced usage of os.statvfs with shutil.disk_usage

The RepositoryCache used `os.statvfs` which is not available on Windows.
`shutil.disk_usage` provides the same information but in a cross platform way.
This commit is contained in:
Jürg Rast 2019-11-03 17:40:34 +01:00
parent 66d86b6280
commit f8856193d3
1 changed files with 1 additions and 2 deletions

View File

@ -1112,8 +1112,7 @@ class RepositoryCache(RepositoryNoCache):
self.enospc = 0
def query_size_limit(self):
stat_fs = os.statvfs(self.basedir)
available_space = stat_fs.f_bavail * stat_fs.f_frsize
available_space = shutil.disk_usage(self.basedir).free
self.size_limit = int(min(available_space * 0.25, 2**31))
def key_filename(self, key):