[Python-checkins] distutils2: merged + fixed tests : now README is to be added explicitely in extra_files
tarek.ziade
python-checkins at python.org
Sat Jan 29 14:54:16 CET 2011
tarek.ziade pushed 88b453387537 to distutils2:
http://hg.python.org/distutils2/rev/88b453387537
changeset: 916:88b453387537
tag: tip
parent: 914:e050062fe83b
parent: 915:374f93ab103c
user: Tarek Ziade <tarek at ziade.org>
date: Sat Jan 29 14:54:02 2011 +0100
summary:
merged + fixed tests : now README is to be added explicitely in extra_files
files:
distutils2/command/sdist.py
distutils2/tests/test_config.py
diff --git a/distutils2/command/sdist.py b/distutils2/command/sdist.py
--- a/distutils2/command/sdist.py
+++ b/distutils2/command/sdist.py
@@ -215,8 +215,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.
@@ -226,32 +224,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)
@@ -323,7 +295,7 @@
for file in self.distribution.metadata.requires_files:
if file not in files:
- msg = "'%s' must be included explicitly extra-files metadata" % file
+ msg = "'%s' must be included explicitly in 'extra_files'" % file
raise DistutilsFileError(msg)
for file in files:
@@ -383,4 +355,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):
diff --git a/distutils2/tests/test_config.py b/distutils2/tests/test_config.py
--- a/distutils2/tests/test_config.py
+++ b/distutils2/tests/test_config.py
@@ -280,7 +280,8 @@
def test_metadata_requires_description_files(self):
tempdir = self.mkdtemp()
os.chdir(tempdir)
- self.write_setup({'description-file': 'README\n README2', 'extra-files':'\n README2'})
+ self.write_setup({'description-file': 'README\n README2',
+ 'extra-files':'\n README2'})
self.write_file('README', 'yeah')
self.write_file('README2', 'yeah')
self.write_file('haven.py', '#')
@@ -302,10 +303,17 @@
cmd = sdist(dist)
cmd.finalize_options()
cmd.get_file_list()
+ self.assertRaises(DistutilsFileError, cmd.make_distribution)
+
+ self.write_setup({'description-file': 'README\n README2',
+ 'extra-files': '\n README2\n README'})
+ dist = self.run_setup('--description')
+ cmd = sdist(dist)
+ cmd.finalize_options()
+ cmd.get_file_list()
cmd.make_distribution()
self.assertIn('README\nREADME2\n', open('MANIFEST').read())
-
def test_sub_commands(self):
tempdir = self.mkdtemp()
os.chdir(tempdir)
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list