aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt8
-rwxr-xr-xsetuptools/package_index.py4
-rw-r--r--setuptools/tests/test_packageindex.py2
3 files changed, 11 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index ff31275a..1396d5fe 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,14 @@ CHANGES
=======
+----
+19.0
+----
+
+* Issue #442: Use SafeConfigParser for parsing .pypirc file. Now
+ fields containing the percent symbol (%) must have each percent
+ replaced with two percent symbols (%%).
+
------
18.8.1
------
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index a26b58bc..322f9a61 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -945,14 +945,14 @@ class Credential(object):
def __str__(self):
return '%(username)s:%(password)s' % vars(self)
-class PyPIConfig(configparser.ConfigParser):
+class PyPIConfig(configparser.SafeConfigParser):
def __init__(self):
"""
Load from ~/.pypirc
"""
defaults = dict.fromkeys(['username', 'password', 'repository'], '')
- configparser.ConfigParser.__init__(self, defaults)
+ configparser.SafeConfigParser.__init__(self, defaults)
rc = os.path.join(os.path.expanduser('~'), '.pypirc')
if os.path.exists(rc):
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 746860d5..a3e45adc 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -216,7 +216,7 @@ class TestPyPIConfig:
[pypi]
repository=https://pypi.python.org
username=jaraco
- password=pity%
+ password=pity%%
"""))
cfg = setuptools.package_index.PyPIConfig()
cred = cfg.creds_by_repository['https://pypi.python.org']