aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/install_egg_info.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2007-09-04 04:10:16 +0000
committerPJ Eby <distutils-sig@python.org>2007-09-04 04:10:16 +0000
commit46c6ed5eb81ac806fb4e36c4dbfeb8146a07736d (patch)
tree638be5fff153a35bebbe4f653f3eba4f5372c1e4 /setuptools/command/install_egg_info.py
parent9dcf16a56114f901c33cab7ac8057c98411ab85e (diff)
downloadexternal_python_setuptools-46c6ed5eb81ac806fb4e36c4dbfeb8146a07736d.tar.gz
external_python_setuptools-46c6ed5eb81ac806fb4e36c4dbfeb8146a07736d.tar.bz2
external_python_setuptools-46c6ed5eb81ac806fb4e36c4dbfeb8146a07736d.zip
Fix import problems with nested namespace packages installed via
``--root`` or ``--single-version-externally-managed``, due to the parent package not having the child package as an attribute. (backport from trunk) --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4057946
Diffstat (limited to 'setuptools/command/install_egg_info.py')
-rwxr-xr-xsetuptools/command/install_egg_info.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/setuptools/command/install_egg_info.py b/setuptools/command/install_egg_info.py
index 8f972638..939340c5 100755
--- a/setuptools/command/install_egg_info.py
+++ b/setuptools/command/install_egg_info.py
@@ -56,6 +56,30 @@ class install_egg_info(Command):
return dst
unpack_archive(self.source, self.target, skimmer)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
def install_namespaces(self):
nsp = self._get_all_ns_packages()
if not nsp: return
@@ -66,6 +90,12 @@ class install_egg_info(Command):
f = open(filename,'wb')
for pkg in nsp:
pth = tuple(pkg.split('.'))
+ trailer = '\n'
+ if '.' in pkg:
+ trailer = (
+ "; m and setattr(sys.modules[%r], %r, m)\n"
+ % ('.'.join(pth[:-1]), pth[-1])
+ )
f.write(
"import sys,new,os; "
"p = os.path.join(sys._getframe(1).f_locals['sitedir'], "
@@ -74,12 +104,11 @@ class install_egg_info(Command):
"m = not ie and "
"sys.modules.setdefault(%(pkg)r,new.module(%(pkg)r)); "
"mp = (m or []) and m.__dict__.setdefault('__path__',[]); "
- "(p not in mp) and mp.append(p)\n"
+ "(p not in mp) and mp.append(p)%(trailer)s"
% locals()
)
f.close()
-
def _get_all_ns_packages(self):
nsp = {}
for pkg in self.distribution.namespace_packages or []:
@@ -92,32 +121,3 @@ class install_egg_info(Command):
return nsp
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-