[gentoo-portage-dev] [PATCH] movefile: enable absolute_import for Python 2 (bug 550886)

2015-05-31 Thread Zac Medico
Since commit 1032cbf4c218741df1c57767fead2d00cc6321d9, with Python 2,
movefile imports portage.util.xattr instead of xattr. Fix it by
enabling absolute_import.

Fixes: 1032cbf4c218 (quickpkg: support FEATURES=xattr (bug 550006))
X-Gentoo-Bug: 550886
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=550886
---
 pym/portage/util/movefile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index d00f624..1000569 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -1,7 +1,7 @@
 # Copyright 2010-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-from __future__ import unicode_literals
+from __future__ import absolute_import, unicode_literals
 
 __all__ = ['movefile']
 
-- 
2.3.5




[gentoo-portage-dev] [PATCH] _LazyImportFrom._get_target: handle submodule import (bug 550906)

2015-05-31 Thread Zac Medico
Since commit 1032cbf4c218741df1c57767fead2d00cc6321d9,
PreloadPortageSubmodulesTestCase fails because
_LazyImportFrom._get_target does not try to import submodules.
Fix it to do so.

Fixes: 1032cbf4c218 (quickpkg: support FEATURES=xattr (bug 550006))
X-Gentoo-Bug: 550906
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=550906
---
 pym/portage/proxy/lazyimport.py | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/pym/portage/proxy/lazyimport.py b/pym/portage/proxy/lazyimport.py
index 5aa7e50..d425870 100644
--- a/pym/portage/proxy/lazyimport.py
+++ b/pym/portage/proxy/lazyimport.py
@@ -128,10 +128,19 @@ class _LazyImportFrom(_LazyImport):
name = object.__getattribute__(self, '_name')
attr_name = object.__getattribute__(self, '_attr_name')
__import__(name)
-   # If called by _unregister_module_proxy() and the target module 
is
-   # partially imported, then the following getattr call may raise 
an
-   # AttributeError for _unregister_module_proxy() to handle.
-   target = getattr(sys.modules[name], attr_name)
+   try:
+   target = getattr(sys.modules[name], attr_name)
+   except AttributeError:
+   # Try to import it as a submodule
+   try:
+   __import__(%s.%s % (name, attr_name))
+   except ImportError:
+   pass
+   # If it's a submodule, this will succeed. Otherwise, it 
may
+   # be that the module is only partially imported, so 
raise
+   # AttributeError for _unregister_module_proxy() to 
handle.
+   target = getattr(sys.modules[name], attr_name)
+
object.__setattr__(self, '_target', target)
object.__getattribute__(self, '_scope')[
object.__getattribute__(self, '_alias')] = target
-- 
2.3.5




Re: [gentoo-portage-dev] [PATCH] _approx_multilib_categories: rename ia to ia64 (bug 550898)

2015-05-31 Thread Mike Frysinger
On 31 May 2015 11:43, Zac Medico wrote:
 In LinkageMapELF.py, there's a fallback mapping for
 multilib categories, which is used by the LinkMapElf class when
 NEEDED.ELF.2 does not contain multilib categories due to being
 generated by older portage. This mapping should be consistent with
 the mutilib categories generated by the compute_multilib_category
 function which was modified by commit
 b50bbcb70506254d66937dac376056bbf99b3fe9.

looks obvious enough ;)
-mike


signature.asc
Description: Digital signature