[Python-checkins] distutils2: removed setup.py from the list of files included by default, and make sure the

tarek.ziade python-checkins at python.org
Sat Oct 2 14:52:55 CEST 2010


tarek.ziade pushed 9fa805e588f3 to distutils2:

http://hg.python.org/distutils2/rev/9fa805e588f3
changeset:   732:9fa805e588f3
user:        Tarek Ziade <tarek at ziade.org>
date:        Sat Oct 02 14:51:50 2010 +0200
summary:     removed setup.py from the list of files included by default, and make sure the list builder dont die on a command
files:       distutils2/command/sdist.py, distutils2/tests/test_sdist.py

diff --git a/distutils2/command/sdist.py b/distutils2/command/sdist.py
--- a/distutils2/command/sdist.py
+++ b/distutils2/command/sdist.py
@@ -197,7 +197,6 @@
     def add_defaults(self):
         """Add all the default files to self.filelist:
           - README or README.txt
-          - setup.py
           - test/test*.py
           - all pure Python modules mentioned in setup script
           - all files pointed by package_data (build_py)
@@ -208,8 +207,7 @@
         Warns if (README or README.txt) or setup.py are missing; everything
         else is optional.
         """
-
-        standards = [('README', 'README.txt'), self.distribution.script_name]
+        standards = [('README', 'README.txt')]
         for fn in standards:
             if isinstance(fn, tuple):
                 alts = fn
@@ -236,8 +234,12 @@
                 self.filelist.extend(files)
 
         for cmd_name in self.distribution.get_command_names():
-            cmd_obj = self.get_finalized_command(cmd_name)
-            self.filelist.extend(cmd_obj.get_source_files())
+            try:
+                cmd_obj = self.get_finalized_command(cmd_name)
+            except DistutilsOptionError:
+                pass
+            else:
+                self.filelist.extend(cmd_obj.get_source_files())
 
     def prune_file_list(self):
         """Prune off branches that might slip into the file list as created
diff --git a/distutils2/tests/test_sdist.py b/distutils2/tests/test_sdist.py
--- a/distutils2/tests/test_sdist.py
+++ b/distutils2/tests/test_sdist.py
@@ -47,7 +47,6 @@
 # file GENERATED by distutils, do NOT edit
 README
 inroot.txt
-setup.py
 data%(sep)sdata.dt
 scripts%(sep)sscript.py
 some%(sep)sfile.txt
@@ -138,7 +137,7 @@
             zip_file.close()
 
         # making sure everything has been pruned correctly
-        self.assertEqual(len(content), 4)
+        self.assertEqual(len(content), 3)
 
     @unittest.skipUnless(zlib, "requires zlib")
     def test_make_distribution(self):
@@ -233,7 +232,7 @@
             zip_file.close()
 
         # making sure everything was added
-        self.assertEqual(len(content), 11)
+        self.assertEqual(len(content), 10)
 
         # checking the MANIFEST
         manifest = open(join(self.tmp_dir, 'MANIFEST')).read()
@@ -361,7 +360,7 @@
         finally:
             f.close()
 
-        self.assertEquals(len(manifest), 5)
+        self.assertEquals(len(manifest), 4)
 
         # adding a file
         self.write_file((self.tmp_dir, 'somecode', 'doc2.txt'), '#')
@@ -381,7 +380,7 @@
             f.close()
 
         # do we have the new file in MANIFEST ?
-        self.assertEquals(len(manifest2), 6)
+        self.assertEquals(len(manifest2), 5)
         self.assertIn('doc2.txt', manifest2[-1])
 
     def test_manifest_marker(self):

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list