Commit fbcbb510 authored by Jason R. Coombs's avatar Jason R. Coombs

Use RawConfigParser instead of SafeConfigParser in PyPIConfig class....

Use RawConfigParser instead of SafeConfigParser in PyPIConfig class. Interpolated values are no longer supported. Since backward compatibility could not be retained in either case, prefer the simpler, more direct format. Ref #442.
parent 80adba1c
...@@ -7,9 +7,8 @@ CHANGES ...@@ -7,9 +7,8 @@ CHANGES
19.0 19.0
---- ----
* Issue #442: Use SafeConfigParser for parsing .pypirc file. Now * Issue #442: Use RawConfigParser for parsing .pypirc file.
fields containing the percent symbol (%) must have each percent Interpolated values are no longer honored in .pypirc files.
replaced with two percent symbols (%%).
------ ------
18.8.1 18.8.1
......
...@@ -945,14 +945,14 @@ class Credential(object): ...@@ -945,14 +945,14 @@ class Credential(object):
def __str__(self): def __str__(self):
return '%(username)s:%(password)s' % vars(self) return '%(username)s:%(password)s' % vars(self)
class PyPIConfig(configparser.SafeConfigParser): class PyPIConfig(configparser.RawConfigParser):
def __init__(self): def __init__(self):
""" """
Load from ~/.pypirc Load from ~/.pypirc
""" """
defaults = dict.fromkeys(['username', 'password', 'repository'], '') defaults = dict.fromkeys(['username', 'password', 'repository'], '')
configparser.SafeConfigParser.__init__(self, defaults) configparser.RawConfigParser.__init__(self, defaults)
rc = os.path.join(os.path.expanduser('~'), '.pypirc') rc = os.path.join(os.path.expanduser('~'), '.pypirc')
if os.path.exists(rc): if os.path.exists(rc):
......
...@@ -216,7 +216,7 @@ class TestPyPIConfig: ...@@ -216,7 +216,7 @@ class TestPyPIConfig:
[pypi] [pypi]
repository=https://pypi.python.org repository=https://pypi.python.org
username=jaraco username=jaraco
password=pity%% password=pity%
""")) """))
cfg = setuptools.package_index.PyPIConfig() cfg = setuptools.package_index.PyPIConfig()
cred = cfg.creds_by_repository['https://pypi.python.org'] cred = cfg.creds_by_repository['https://pypi.python.org']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment