[Python-checkins] distutils2: avoid inclusion of README or test/*.py

tarek.ziade python-checkins at python.org
Sat Jan 29 14:54:16 CET 2011


tarek.ziade pushed 374f93ab103c to distutils2:

http://hg.python.org/distutils2/rev/374f93ab103c
changeset:   915:374f93ab103c
parent:      899:93c02eaba941
user:        Godefroid Chapelle <gotcha at bubblenet.be>
date:        Fri Jan 28 18:40:08 2011 +0100
summary:
  avoid inclusion of README or test/*.py

files:
  distutils2/command/sdist.py
  distutils2/tests/test_command_sdist.py

diff --git a/distutils2/command/sdist.py b/distutils2/command/sdist.py
--- a/distutils2/command/sdist.py
+++ b/distutils2/command/sdist.py
@@ -214,8 +214,6 @@
 
     def add_defaults(self):
         """Add all the default files to self.filelist:
-          - README or README.txt
-          - test/test*.py
           - all pure Python modules mentioned in setup script
           - all files pointed by package_data (build_py)
           - all files defined in data_files.
@@ -225,32 +223,6 @@
         Warns if (README or README.txt) or setup.py are missing; everything
         else is optional.
         """
-        standards = [('README', 'README.txt')]
-        for fn in standards:
-            if isinstance(fn, tuple):
-                alts = fn
-                got_it = 0
-                for fn in alts:
-                    if os.path.exists(fn):
-                        got_it = 1
-                        self.filelist.append(fn)
-                        break
-
-                if not got_it:
-                    self.warn("standard file not found: should have one of " +
-                              string.join(alts, ', '))
-            else:
-                if os.path.exists(fn):
-                    self.filelist.append(fn)
-                else:
-                    self.warn("standard file '%s' not found" % fn)
-
-        optional = ['test/test*.py', 'setup.cfg']
-        for pattern in optional:
-            files = filter(os.path.isfile, glob(pattern))
-            if files:
-                self.filelist.extend(files)
-
         for cmd_name in get_command_names():
             try:
                 cmd_obj = self.get_finalized_command(cmd_name)
@@ -376,4 +348,3 @@
         # Now create them
         for dir in need_dirs:
             self.mkpath(dir, mode, verbose=verbose, dry_run=dry_run)
-
diff --git a/distutils2/tests/test_command_sdist.py b/distutils2/tests/test_command_sdist.py
--- a/distutils2/tests/test_command_sdist.py
+++ b/distutils2/tests/test_command_sdist.py
@@ -45,7 +45,6 @@
 
 MANIFEST = """\
 # file GENERATED by distutils, do NOT edit
-README
 inroot.txt
 data%(sep)sdata.dt
 scripts%(sep)sscript.py
@@ -141,7 +140,7 @@
             zip_file.close()
 
         # making sure everything has been pruned correctly
-        self.assertEqual(len(content), 3)
+        self.assertEqual(len(content), 2)
 
     @unittest.skipUnless(zlib, "requires zlib")
     def test_make_distribution(self):
@@ -236,7 +235,7 @@
             zip_file.close()
 
         # making sure everything was added
-        self.assertEqual(len(content), 10)
+        self.assertEqual(len(content), 9)
 
         # checking the MANIFEST
         manifest = open(join(self.tmp_dir, 'MANIFEST')).read()
@@ -362,8 +361,7 @@
                         if line.strip() != '']
         finally:
             f.close()
-
-        self.assertEqual(len(manifest), 4)
+        self.assertEqual(len(manifest), 3)
 
         # adding a file
         self.write_file((self.tmp_dir, 'somecode', 'doc2.txt'), '#')
@@ -383,7 +381,7 @@
             f.close()
 
         # do we have the new file in MANIFEST ?
-        self.assertEqual(len(manifest2), 5)
+        self.assertEqual(len(manifest2), 4)
         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