[Python-checkins] r58257 - sandbox/trunk/setuptools/setuptools/command/egg_info.py

phillip.eby python-checkins at python.org
Wed Sep 26 19:03:39 CEST 2007


Author: phillip.eby
Date: Wed Sep 26 19:03:39 2007
New Revision: 58257

Modified:
   sandbox/trunk/setuptools/setuptools/command/egg_info.py
Log:
Fix cross-platform line-end problem with SOURCES.txt: distutils
doesn't expect manifest files to be shipped across platforms.


Modified: sandbox/trunk/setuptools/setuptools/command/egg_info.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/egg_info.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/egg_info.py	Wed Sep 26 19:03:39 2007
@@ -8,7 +8,6 @@
 from distutils.errors import *
 from distutils import log
 from setuptools.command.sdist import sdist
-from distutils import file_util
 from distutils.util import convert_path
 from distutils.filelist import FileList
 from pkg_resources import parse_requirements, safe_name, parse_version, \
@@ -39,6 +38,7 @@
 
 
 
+
     def initialize_options(self):
         self.egg_name = None
         self.egg_version = None
@@ -271,6 +271,8 @@
     """File list that accepts only existing, platform-independent paths"""
 
     def append(self, item):
+        if item.endswith('\r'):     # Fix older sdists built on Windows
+            item = item[:-1]
         path = convert_path(item)
         if os.path.exists(path):
             self.files.append(path)
@@ -283,8 +285,6 @@
 
 
 
-
-
 class manifest_maker(sdist):
 
     template = "MANIFEST.in"
@@ -319,7 +319,7 @@
         files = self.filelist.files
         if os.sep!='/':
             files = [f.replace(os.sep,'/') for f in files]
-        self.execute(file_util.write_file, (self.manifest, files),
+        self.execute(write_file, (self.manifest, files),
                      "writing manifest file '%s'" % self.manifest)
 
     def warn(self, msg):    # suppress missing-file warnings from sdist
@@ -347,13 +347,13 @@
         self.filelist.exclude_pattern(sep+r'(RCS|CVS|\.svn)'+sep, is_regex=1)
 
 
-
-
-
-
-
-
-
+def write_file (filename, contents):
+    """Create a file with the specified name and write 'contents' (a
+    sequence of strings without line terminators) to it.
+    """
+    f = open(filename, "wb")        # always write POSIX-style manifest
+    f.write("\n".join(contents))
+    f.close()
 
 
 


More information about the Python-checkins mailing list