]> granicus.if.org Git - python/commitdiff
Fix setup.py register failure with invalid rst in description (#13614).
authorÉric Araujo <aeric@mtlpy.org>
Sun, 9 Dec 2012 03:26:57 +0000 (22:26 -0500)
committerÉric Araujo <aeric@mtlpy.org>
Sun, 9 Dec 2012 03:26:57 +0000 (22:26 -0500)
Original patch by Julien Courteau and Pierre Paul Lefebvre.

Lib/distutils/command/check.py
Lib/distutils/tests/test_register.py
Misc/ACKS
Misc/NEWS

index 4b64e458bc2dd2cc4e5fa0a008732b18e609e835..152bf0de98bf705261dc5b7a3ab9f5ed4ad82652 100644 (file)
@@ -26,6 +26,9 @@ try:
 
         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:
index aa9bc43c5cf1a8b1965ef385becf901c241d42f9..9a0ff34c45177e02adf540a945a657b3dc91de6a 100644 (file)
@@ -1,6 +1,5 @@
 # -*- encoding: utf8 -*-
 """Tests for distutils.command.register."""
-import sys
 import os
 import unittest
 import getpass
@@ -11,11 +10,14 @@ from test.test_support import check_warnings, run_unittest
 
 from distutils.command import register as register_module
 from distutils.command.register import register
-from distutils.core import Distribution
 from distutils.errors import DistutilsSetupError
 
-from distutils.tests import support
-from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase
+from distutils.tests.test_config import PyPIRCCommandTestCase
+
+try:
+    import docutils
+except ImportError:
+    docutils = None
 
 PYPIRC_NOPASSWORD = """\
 [distutils]
@@ -264,6 +266,21 @@ class RegisterTestCase(PyPIRCCommandTestCase):
         finally:
             del register_module.raw_input
 
+    @unittest.skipUnless(docutils is not None, 'needs docutils')
+    def test_register_invalid_long_description(self):
+        description = ':funkie:`str`'  # mimic Sphinx-specific markup
+        metadata = {'url': 'xxx', 'author': 'xxx',
+                    'author_email': 'xxx',
+                    'name': 'xxx', 'version': 'xxx',
+                    'long_description': description}
+        cmd = self._get_cmd(metadata)
+        cmd.ensure_finalized()
+        cmd.strict = True
+        inputs = RawInputs('2', 'tarek', 'tarek@ziade.org')
+        register_module.raw_input = inputs
+        self.addCleanup(delattr, register_module, 'raw_input')
+        self.assertRaises(DistutilsSetupError, cmd.run)
+
     def test_check_metadata_deprecated(self):
         # makes sure make_metadata is deprecated
         cmd = self._get_cmd()
index 0a7c8bd2e215ad441f6a01b7c21132306a11a964..87499b65768cd098b682df3b8e6e3a5e5e7a1169 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -201,6 +201,7 @@ David Costanzo
 Scott Cotton
 Greg Couch
 David Cournapeau
+Julien Courteau
 Steve Cousins
 Alex Coventry
 Matthew Dixon Cowles
@@ -572,6 +573,7 @@ Inyeol Lee
 Thomas Lee
 Christopher Lee
 Luc Lefebvre
+Pierre Paul Lefebvre
 Glyph Lefkowitz
 Vincent Legoll
 Kip Lehman
index 0c01e8b6ab8e924d475902fcc6040b2827c3d33b..3981f570bdb184accb6ea74f794c14879635b2c7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -158,6 +158,9 @@ Library
 
 - Issue #16628: Fix a memory leak in ctypes.resize().
 
+- Issue #13614: Fix setup.py register failure with invalid rst in description.
+  Patch by Julien Courteau and Pierre Paul Lefebvre.
+
 - Issue #10182: The re module doesn't truncate indices to 32 bits anymore.
   Patch by Serhiy Storchaka.