diff options
author | PJ Eby <distutils-sig@python.org> | 2006-03-17 17:16:19 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2006-03-17 17:16:19 +0000 |
commit | 5393f13525c33abcde2893fc0793a9db0aa03373 (patch) | |
tree | 285ef85a880c8f191f62879f5d7cc41c51d5666c | |
parent | 92a61578a4b7d09ad6a6f9524163e67b62782e18 (diff) | |
download | external_python_setuptools-5393f13525c33abcde2893fc0793a9db0aa03373.tar.gz external_python_setuptools-5393f13525c33abcde2893fc0793a9db0aa03373.tar.bz2 external_python_setuptools-5393f13525c33abcde2893fc0793a9db0aa03373.zip |
Tweak the nspkg.pth hack to avoid creating a module if there *is* an
__init__.py installed. It may be that this should check for .pyc/.pyo,
but system packagers don't normally remove them.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4043120
-rwxr-xr-x | setuptools/command/install_egg_info.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/setuptools/command/install_egg_info.py b/setuptools/command/install_egg_info.py index a537b5e7..4c79f41b 100755 --- a/setuptools/command/install_egg_info.py +++ b/setuptools/command/install_egg_info.py @@ -43,8 +43,7 @@ class install_egg_info(Command): return self.outputs def copytree(self): - # Copy the .egg-info tree to site-packages - + # Copy the .egg-info tree to site-packages def skimmer(src,dst): # filter out source-control directories; note that 'src' is always # a '/'-separated path, regardless of platform. 'dst' is a @@ -55,7 +54,6 @@ class install_egg_info(Command): self.outputs.append(dst) log.debug("Copying %s to %s", src, dst) return dst - unpack_archive(self.source, self.target, skimmer) def install_namespaces(self): @@ -70,11 +68,13 @@ class install_egg_info(Command): for pkg in nsp: pth = tuple(pkg.split('.')) f.write( - "import sys,new; " - "m = sys.modules.setdefault(%(pkg)r,new.module(%(pkg)r)); " + "import sys,new,os; " "p = os.path.join(sys._getframe(1).f_locals['sitedir'], " - "*%(pth)r); " - "mp = m.__path__ = getattr(m,'__path__',[]); " + "*%(pth)r); " + "ie = os.path.exists(os.path.join(p,'__init__.py')); " + "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" % locals() ) |