[Python-checkins] r53271 - in sandbox/branches/setuptools-0.6: setuptools.txt setuptools/command/install_egg_info.py

phillip.eby python-checkins at python.org
Fri Jan 5 20:39:39 CET 2007


Author: phillip.eby
Date: Fri Jan  5 20:39:39 2007
New Revision: 53271

Modified:
   sandbox/branches/setuptools-0.6/setuptools.txt
   sandbox/branches/setuptools-0.6/setuptools/command/install_egg_info.py
Log:
Fix a problem installing eggs with a system packaging tool if the project
contained an implicit namespace package; for example if the ``setup()``
listed a namespace package ``foo.bar`` without explicitly listing 
``foo`` as a namespace package. (backport from trunk)


Modified: sandbox/branches/setuptools-0.6/setuptools.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools.txt	(original)
+++ sandbox/branches/setuptools-0.6/setuptools.txt	Fri Jan  5 20:39:39 2007
@@ -2623,6 +2623,11 @@
    ``develop`` and the source directory is a subdirectory of the installation
    target directory.
 
+ * Fix a problem installing eggs with a system packaging tool if the project
+   contained an implicit namespace package; for example if the ``setup()``
+   listed a namespace package ``foo.bar`` without explicitly listing ``foo``
+   as a namespace package.
+
 0.6c3
  * Fixed breakages caused by Subversion 1.4's new "working copy" format
 

Modified: sandbox/branches/setuptools-0.6/setuptools/command/install_egg_info.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/install_egg_info.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/install_egg_info.py	Fri Jan  5 20:39:39 2007
@@ -22,7 +22,7 @@
             None, None, ei_cmd.egg_name, ei_cmd.egg_version
         ).egg_name()+'.egg-info'
         self.source = ei_cmd.egg_info
-        self.target = os.path.join(self.install_dir, basename) 
+        self.target = os.path.join(self.install_dir, basename)
         self.outputs = [self.target]
 
     def run(self):
@@ -43,7 +43,7 @@
         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
@@ -57,9 +57,8 @@
         unpack_archive(self.source, self.target, skimmer)
 
     def install_namespaces(self):
-        nsp = (self.distribution.namespace_packages or [])[:]
+        nsp = self._get_all_ns_packages()
         if not nsp: return
-        nsp.sort()  # set up shorter names first
         filename,ext = os.path.splitext(self.target)
         filename += '-nspkg.pth'; self.outputs.append(filename)
         log.info("Installing %s",filename)
@@ -78,5 +77,47 @@
                     "(p not in mp) and mp.append(p)\n"
                     % locals()
                 )
-            f.close()            
+            f.close()
+
+
+    def _get_all_ns_packages(self):
+        nsp = {}
+        for pkg in self.distribution.namespace_packages or []:
+            pkg = pkg.split('.')
+            while pkg:
+                nsp['.'.join(pkg)] = 1
+                pkg.pop()
+        nsp=list(nsp)
+        nsp.sort()  # set up shorter names first
+        return nsp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 


More information about the Python-checkins mailing list