Before using statvfs, check it is actually available on the current host (OS). This...
authorFabian Groffen <grobian@gentoo.org>
Mon, 24 Mar 2008 14:36:16 +0000 (14:36 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 24 Mar 2008 14:36:16 +0000 (14:36 -0000)
svn path=/main/branches/prefix/; revision=9500

pym/portage/__init__.py

index 1579b3d9199dfe05e23eb701825e3eb3a230c97d..7c4ca5fb16abce27c6c098a2ec71d06059009db5 100644 (file)
@@ -3263,11 +3263,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