Skip to content

Commit

Permalink
Use RawConfigParser instead of SafeConfigParser in PyPIConfig class. …
Browse files Browse the repository at this point in the history
…Interpolated values are no longer supported. Since backward compatibility could not be retained in either case, prefer the simpler, more direct format. Ref #442.
  • Loading branch information
jaraco committed Dec 14, 2015
1 parent 80adba1 commit fbcbb51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ 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 (%%).
* Issue #442: Use RawConfigParser for parsing .pypirc file.
Interpolated values are no longer honored in .pypirc files.

------
18.8.1
Expand Down
4 changes: 2 additions & 2 deletions setuptools/package_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,14 +945,14 @@ def __iter__(self):
def __str__(self):
return '%(username)s:%(password)s' % vars(self)

class PyPIConfig(configparser.SafeConfigParser):
class PyPIConfig(configparser.RawConfigParser):

def __init__(self):
"""
Load from ~/.pypirc
"""
defaults = dict.fromkeys(['username', 'password', 'repository'], '')
configparser.SafeConfigParser.__init__(self, defaults)
configparser.RawConfigParser.__init__(self, defaults)

rc = os.path.join(os.path.expanduser('~'), '.pypirc')
if os.path.exists(rc):
Expand Down
2 changes: 1 addition & 1 deletion setuptools/tests/test_packageindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def test_percent_in_password(self, tmpdir, monkeypatch):
[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']
Expand Down

0 comments on commit fbcbb51

Please sign in to comment.