Bug #288025 - Avoid AttributeError on OSes that don't have os.statvfs.
authorZac Medico <zmedico@gentoo.org>
Sat, 10 Oct 2009 10:44:49 +0000 (10:44 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 10 Oct 2009 10:44:49 +0000 (10:44 -0000)
(trunk r14553)

svn path=/main/branches/2.1.7/; revision=14554

pym/portage/__init__.py

index 8bc8bcc08f3de8d1b11b6f397dd69ded8f47c350..ec92d6b83cccfaf0d062aee2d400e73349cae007 100644 (file)
@@ -258,10 +258,12 @@ _os_overrides = {
        id(_os.fdopen)        : _os.fdopen,
        id(_os.popen)         : _os.popen,
        id(_os.read)          : _os.read,
-       id(_os.statvfs)       : _os.statvfs,
        id(_os.system)        : _os.system,
 }
 
+if hasattr(_os, 'statvfs'):
+       _os_overrides[id(_os.statvfs)] = _os.statvfs
+
 os = _unicode_module_wrapper(_os, overrides=_os_overrides,
        encoding=_encodings['fs'])
 _os_merge = _unicode_module_wrapper(_os,