diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-03-24 23:05:00 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-03-24 23:05:00 +0000 |
commit | 488570fb356ed591c16fce8d703f669f9bc62146 (patch) | |
tree | c6d1e21d4ace62a62fb8ad135d8894174f00c33f | |
parent | 04075da164e045e57d00f5fcd53744c7706bbff7 (diff) | |
download | portage-488570fb356ed591c16fce8d703f669f9bc62146.tar.gz portage-488570fb356ed591c16fce8d703f669f9bc62146.tar.bz2 portage-488570fb356ed591c16fce8d703f669f9bc62146.zip |
Check is os.statvfs() is implemented before trying to us it.
(branches/prefix r9500)
svn path=/main/trunk/; revision=9502
-rw-r--r-- | pym/portage/__init__.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index adfdc8730..66ff4ce29 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3241,11 +3241,12 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", else: # check if there is enough space in DISTDIR to completely store myfile # overestimate the filesize so we aren't bitten by FS overhead - vfs_stat = os.statvfs(mysettings["DISTDIR"]) - if myfile in mydigests \ - and (mydigests[myfile]["size"] + vfs_stat.f_bsize) >= (vfs_stat.f_bsize * vfs_stat.f_bavail): - writemsg("!!! Insufficient space to store %s in %s\n" % (myfile, mysettings["DISTDIR"]), noiselevel=-1) - has_space = False + if hasattr(os, "statvfs"): + vfs_stat = os.statvfs(mysettings["DISTDIR"]) + if myfile in mydigests \ + and (mydigests[myfile]["size"] + vfs_stat.f_bsize) >= (vfs_stat.f_bsize * vfs_stat.f_bavail): + writemsg("!!! Insufficient space to store %s in %s\n" % (myfile, mysettings["DISTDIR"]), noiselevel=-1) + has_space = False if use_locks and can_fetch: waiting_msg = None |