Check is os.statvfs() is implemented before trying to us it.
authorZac Medico <zmedico@gentoo.org>
Mon, 24 Mar 2008 23:05:00 +0000 (23:05 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 24 Mar 2008 23:05:00 +0000 (23:05 -0000)
(branches/prefix r9500)

svn path=/main/trunk/; revision=9502

pym/portage/__init__.py

index adfdc87304d8518b8fdbe5eb42fb55efbdc3123f..66ff4ce290ebaa4bcb5f4347ff51e364282f2adf 100644 (file)
@@ -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