Skip to content

Commit

Permalink
backport configparser to fully fix ini life parsing in python2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Tremblay authored and kblomqvist committed Aug 19, 2020
1 parent eb5838f commit b2fe0ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"pytoml",
"pyyaml",
"xmltodict",
'configparser;python_version<"3.5"'
],
entry_points='''
[console_scripts]
Expand Down
6 changes: 1 addition & 5 deletions yasha/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ def parse_svd(file):


def parse_ini(file):
if sys.version_info[0] == 2:
from ConfigParser import ConfigParser
else:
from configparser import ConfigParser
from io import TextIOWrapper
from configparser import ConfigParser
cfg = ConfigParser()
# yasha opens files in binary mode, configparser expects files in text mode
content = file.read().decode(ENCODING)
Expand Down

0 comments on commit b2fe0ad

Please sign in to comment.