From: Zac Medico Date: Tue, 8 Feb 2011 06:35:14 +0000 (-0800) Subject: cache.ebuild_xattr: don't import ENODATA globally X-Git-Tag: v2.2.0_alpha23~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ad382da72d24dbd0df1ee3696aacd638171a1cda;p=portage.git cache.ebuild_xattr: don't import ENODATA globally ENODATA is undefined on FreeBSD. This will fix bug #354057. --- diff --git a/pym/portage/cache/ebuild_xattr.py b/pym/portage/cache/ebuild_xattr.py index 1d7e26f90..6b388faaf 100644 --- a/pym/portage/cache/ebuild_xattr.py +++ b/pym/portage/cache/ebuild_xattr.py @@ -4,6 +4,8 @@ __all__ = ['database'] +import errno + import portage from portage.cache import fs_template from portage.versions import catsplit @@ -11,7 +13,6 @@ from portage import cpv_getkey from portage import os from portage import _encodings from portage import _unicode_decode -from errno import ENODATA,ENOSPC,E2BIG portage.proxy.lazyimport.lazyimport(globals(), 'xattr') @@ -58,16 +59,16 @@ class database(fs_template.FsBased): except IOError as e: # ext based give wrong errno # http://bugzilla.kernel.org/show_bug.cgi?id=12793 - if e.errno in (E2BIG,ENOSPC): + if e.errno in (errno.E2BIG, errno.ENOSPC): result = len(s)-100 else: - raise e + raise try: self.__remove(path,'test_max') except IOError as e: - if e.errno is not ENODATA: - raise e + if e.errno != errno.ENODATA: + raise return result @@ -87,7 +88,7 @@ class database(fs_template.FsBased): try: return xattr.get(path,key,namespace=self.ns) except IOError as e: - if not default is None and ENODATA == e.errno: + if not default is None and errno.ENODATA == e.errno: return default else: raise NoValueException()