mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
Fix setup.py register failure with invalid rst in description (#13614).
Original patch by Julien Courteau and Pierre Paul Lefebvre.
This commit is contained in:
parent
9bc9ab5f85
commit
8b503c0a4e
4 changed files with 31 additions and 11 deletions
|
|
@ -23,6 +23,9 @@ try:
|
||||||
|
|
||||||
def system_message(self, level, message, *children, **kwargs):
|
def system_message(self, level, message, *children, **kwargs):
|
||||||
self.messages.append((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
|
HAS_DOCUTILS = True
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
"""Tests for distutils.command.register."""
|
"""Tests for distutils.command.register."""
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import getpass
|
import getpass
|
||||||
|
|
@ -10,11 +9,14 @@ from test.support import check_warnings, run_unittest
|
||||||
|
|
||||||
from distutils.command import register as register_module
|
from distutils.command import register as register_module
|
||||||
from distutils.command.register import register
|
from distutils.command.register import register
|
||||||
from distutils.core import Distribution
|
|
||||||
from distutils.errors import DistutilsSetupError
|
from distutils.errors import DistutilsSetupError
|
||||||
|
|
||||||
from distutils.tests import support
|
from distutils.tests.test_config import PyPIRCCommandTestCase
|
||||||
from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase
|
|
||||||
|
try:
|
||||||
|
import docutils
|
||||||
|
except ImportError:
|
||||||
|
docutils = None
|
||||||
|
|
||||||
PYPIRC_NOPASSWORD = """\
|
PYPIRC_NOPASSWORD = """\
|
||||||
[distutils]
|
[distutils]
|
||||||
|
|
@ -193,6 +195,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
|
||||||
self.assertEqual(headers['Content-length'], '290')
|
self.assertEqual(headers['Content-length'], '290')
|
||||||
self.assertTrue((b'tarek') in req.data)
|
self.assertTrue((b'tarek') in req.data)
|
||||||
|
|
||||||
|
@unittest.skipUnless(docutils is not None, 'needs docutils')
|
||||||
def test_strict(self):
|
def test_strict(self):
|
||||||
# testing the script option
|
# testing the script option
|
||||||
# when on, the register command stops if
|
# when on, the register command stops if
|
||||||
|
|
@ -205,13 +208,6 @@ class RegisterTestCase(PyPIRCCommandTestCase):
|
||||||
cmd.strict = 1
|
cmd.strict = 1
|
||||||
self.assertRaises(DistutilsSetupError, cmd.run)
|
self.assertRaises(DistutilsSetupError, cmd.run)
|
||||||
|
|
||||||
# we don't test the reSt feature if docutils
|
|
||||||
# is not installed
|
|
||||||
try:
|
|
||||||
import docutils
|
|
||||||
except ImportError:
|
|
||||||
return
|
|
||||||
|
|
||||||
# metadata are OK but long_description is broken
|
# metadata are OK but long_description is broken
|
||||||
metadata = {'url': 'xxx', 'author': 'xxx',
|
metadata = {'url': 'xxx', 'author': 'xxx',
|
||||||
'author_email': 'éxéxé',
|
'author_email': 'éxéxé',
|
||||||
|
|
@ -265,6 +261,22 @@ class RegisterTestCase(PyPIRCCommandTestCase):
|
||||||
finally:
|
finally:
|
||||||
del register_module.input
|
del register_module.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 = Inputs('2', 'tarek', 'tarek@ziade.org')
|
||||||
|
register_module.input = inputs
|
||||||
|
self.addCleanup(delattr, register_module, 'input')
|
||||||
|
|
||||||
|
self.assertRaises(DistutilsSetupError, cmd.run)
|
||||||
|
|
||||||
def test_check_metadata_deprecated(self):
|
def test_check_metadata_deprecated(self):
|
||||||
# makes sure make_metadata is deprecated
|
# makes sure make_metadata is deprecated
|
||||||
cmd = self._get_cmd()
|
cmd = self._get_cmd()
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,7 @@ David Costanzo
|
||||||
Scott Cotton
|
Scott Cotton
|
||||||
Greg Couch
|
Greg Couch
|
||||||
David Cournapeau
|
David Cournapeau
|
||||||
|
Julien Courteau
|
||||||
Steve Cousins
|
Steve Cousins
|
||||||
Alex Coventry
|
Alex Coventry
|
||||||
Matthew Dixon Cowles
|
Matthew Dixon Cowles
|
||||||
|
|
@ -621,6 +622,7 @@ Thomas Lee
|
||||||
Christopher Lee
|
Christopher Lee
|
||||||
Tennessee Leeuwenburg
|
Tennessee Leeuwenburg
|
||||||
Luc Lefebvre
|
Luc Lefebvre
|
||||||
|
Pierre Paul Lefebvre
|
||||||
Glyph Lefkowitz
|
Glyph Lefkowitz
|
||||||
Vincent Legoll
|
Vincent Legoll
|
||||||
Kip Lehman
|
Kip Lehman
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,9 @@ Library
|
||||||
|
|
||||||
- Issue #16628: Fix a memory leak in ctypes.resize().
|
- 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 #13512: Create ~/.pypirc securely (CVE-2011-4944). Initial patch by
|
- Issue #13512: Create ~/.pypirc securely (CVE-2011-4944). Initial patch by
|
||||||
Philip Jenvey, tested by Mageia and Debian.
|
Philip Jenvey, tested by Mageia and Debian.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue