1. Tarek Ziadé
  2. distribute

Commits

phillip.eby  committed 82be5c3

Fix bdist_egg not including files in .egg-info subdirectories.
(merge from trunk)

  • Participants
  • Parent commits 8200b9d
  • Branches setuptools-0.6

Comments (0)

Files changed (2)

File setuptools.txt

View file
 Release Notes/Change History
 ----------------------------
 
+0.6b3
+ * Fix bdist_egg not including files in .egg-info subdirectories.
+
 0.6b1
  * Strip ``module`` from the end of compiled extension modules when computing
    the name of a ``.py`` loader/wrapper.  (Python's import machinery ignores

File setuptools/command/bdist_egg.py

View file
 from distutils.dir_util import remove_tree, mkpath
 from distutils.sysconfig import get_python_version, get_python_lib
 from distutils import log
-from pkg_resources import get_build_platform, Distribution
+from pkg_resources import get_build_platform, Distribution, ensure_directory
 from types import CodeType
 from setuptools.extension import Library
 
 
 
     def finalize_options(self):
-        ei_cmd = self.get_finalized_command("egg_info")
+        ei_cmd = self.ei_cmd = self.get_finalized_command("egg_info")
         self.egg_info = ei_cmd.egg_info
 
         if self.bdist_dir is None:
             if not self.dry_run:
                 os.unlink(native_libs)
 
-        for filename in os.listdir(self.egg_info):
-            path = os.path.join(self.egg_info,filename)
-            if os.path.isfile(path):
-                self.copy_file(path,os.path.join(egg_info,filename))
+        self.copy_metadata_to(egg_info)
 
         write_safety_flag(
             os.path.join(archive_root,'EGG-INFO'), self.zip_safe()
 
         if self.exclude_source_files:
             self.zap_pyfiles()
-        
+
         # Make the archive
         make_zipfile(self.egg_output, archive_root, verbose=self.verbose,
                           dry_run=self.dry_run)
         getattr(self.distribution,'dist_files',[]).append(
             ('bdist_egg',get_python_version(),self.egg_output))
 
+
+
+
     def zap_pyfiles(self):
         log.info("Removing .py files from temporary directory")
         for base,dirs,files in walk_egg(self.bdist_dir):
 
     def make_init_files(self):
         """Create missing package __init__ files"""
-        init_files = []       
+        init_files = []
         for base,dirs,files in walk_egg(self.bdist_dir):
             if base==self.bdist_dir:
                 # don't put an __init__ in the root
                             filename = os.path.join(base,'__init__.py')
                             if not self.dry_run:
                                 f = open(filename,'w'); f.write(NS_PKG_STUB)
-                                f.close()    
+                                f.close()
                             init_files.append(filename)
                     break
             else:
 
         return init_files
 
+    def copy_metadata_to(self, target_dir):
+        prefix = os.path.join(self.egg_info,'')
+        for path in self.ei_cmd.filelist.files:
+            if path.startswith(prefix):
+                target = os.path.join(target_dir, path[len(prefix):])
+                ensure_directory(target)
+                self.copy_file(path, target)
+
     def get_ext_outputs(self):
         """Get a list of relative paths to C extensions in the output distro"""
 
 
 
 
-
-
-
-
-
-
-
-
 def walk_egg(egg_dir):
     """Walk an unpacked egg's contents, skipping the metadata directory"""
     walker = os.walk(egg_dir)
-    base,dirs,files = walker.next()       
+    base,dirs,files = walker.next()
     if 'EGG-INFO' in dirs:
         dirs.remove('EGG-INFO')
     yield base,dirs,files
 
     return zip_filename
 
-
+#