[Python-checkins] distutils2: fix: setup.py register fails if description has ReST uncompatible with Sphinx

eric.araujo python-checkins at python.org
Wed May 16 07:07:26 CEST 2012


http://hg.python.org/distutils2/rev/70c683338f9b
changeset:   1321:70c683338f9b
user:        Julien Courteau <j_courteau at hotmail.com>
date:        Sat Apr 21 20:59:06 2012 -0400
summary:
  fix: setup.py register fails if description has ReST uncompatible with Sphinx (#13614)

files:
  distutils2/metadata.py            |  3 +++
  distutils2/tests/test_metadata.py |  9 +++++++++
  2 files changed, 12 insertions(+), 0 deletions(-)


diff --git a/distutils2/metadata.py b/distutils2/metadata.py
--- a/distutils2/metadata.py
+++ b/distutils2/metadata.py
@@ -35,6 +35,9 @@
 
         def system_message(self, level, message, *children, **kwargs):
             self.messages.append((level, message, children, kwargs))
+            return nodes.system_message(message, level=level, type=self.
+                    levels[level], *children, **kwargs)
+
 
     _HAS_DOCUTILS = True
 except ImportError:
diff --git a/distutils2/tests/test_metadata.py b/distutils2/tests/test_metadata.py
--- a/distutils2/tests/test_metadata.py
+++ b/distutils2/tests/test_metadata.py
@@ -379,6 +379,15 @@
         folded_desc = desc.replace('\n', '\n' + (7 * ' ') + '|')
         self.assertIn(folded_desc, out.getvalue())
 
+    def test_description_invalid_rst(self):
+        # make sure bad rst is well handled in the description attribute
+        metadata = Metadata()
+        description_with_bad_rst = ':funkie:`str`'  # Sphinx-specific markup
+        metadata['description'] = description_with_bad_rst
+        missing, warnings = metadata.check(restructuredtext=True)
+        warning = warnings[0][1]
+        self.assertIn('funkie', warning)
+
     def test_project_url(self):
         metadata = Metadata()
         metadata['Project-URL'] = [('one', 'http://ok')]

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


More information about the Python-checkins mailing list