[Python-checkins] distutils2: now accepting description-file
tarek.ziade
python-checkins at python.org
Wed Oct 13 16:52:47 CEST 2010
tarek.ziade pushed bb3afd03c844 to distutils2:
http://hg.python.org/distutils2/rev/bb3afd03c844
changeset: 766:bb3afd03c844
tag: tip
user: Tarek Ziade <tarek at ziade.org>
date: Wed Oct 13 16:51:49 2010 +0200
summary: now accepting description-file
files: distutils2/config.py, distutils2/tests/test_config.py
diff --git a/distutils2/config.py b/distutils2/config.py
--- a/distutils2/config.py
+++ b/distutils2/config.py
@@ -118,6 +118,20 @@
value = [(label.strip(), url.strip())
for label, url in
[v.split(',') for v in value]]
+
+ if key == 'description-file':
+ if 'description' in content['metadata']:
+ msg = ("description and description-file' are "
+ "mutually exclusive")
+ raise DistutilsOptionError(msg)
+
+ f = open(value) # will raise if file not found
+ try:
+ value = f.read()
+ finally:
+ f.close()
+ key = 'description'
+
if metadata.is_metadata_field(key):
metadata[key] = self._convert_metadata(key, value)
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
@@ -16,7 +16,7 @@
maintainer = Ãric Araujo
maintainer_email = merwok at netwok.org
summary = A sample project demonstrating distutils2 packaging
-description = README
+description-file = README
keywords = distutils2, packaging, sample project
classifier =
@@ -102,6 +102,7 @@
tempdir = self.mkdtemp()
os.chdir(tempdir)
self.write_file('setup.cfg', SETUP_CFG)
+ self.write_file('README', 'yeah')
# try to load the metadata now
sys.stdout = StringIO()
@@ -163,6 +164,8 @@
# make sure we get the foo command loaded !
self.assertEquals(dist.cmdclass['foo'], Foo)
+ # did the README got loaded ?
+ self.assertEquals(dist.metadata['description'], 'yeah')
def test_suite():
return unittest.makeSuite(ConfigTestCase)
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list