Commit eeb71cea authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Remove deprecated usage of SafeConfigParser in python3

parent c8f590ae
Pipeline #38426 passed with stage
in 0 seconds
...@@ -278,9 +278,10 @@ https://creativecommons.org/publicdomain/zero/1.0/ . ...@@ -278,9 +278,10 @@ https://creativecommons.org/publicdomain/zero/1.0/ .
from __future__ import print_function from __future__ import print_function
try: try:
import configparser from configparser import ConfigParser
except ImportError: except ImportError:
import ConfigParser as configparser from ConfigParser import SafeConfigParser as ConfigParser
ConfigParser.read_file = ConfigParser.readfp
import errno import errno
import json import json
import os import os
...@@ -339,9 +340,9 @@ def get_config_from_root(root): ...@@ -339,9 +340,9 @@ def get_config_from_root(root):
# configparser.NoOptionError (if it lacks "VCS="). See the docstring at # configparser.NoOptionError (if it lacks "VCS="). See the docstring at
# the top of versioneer.py for instructions on writing your setup.cfg . # the top of versioneer.py for instructions on writing your setup.cfg .
setup_cfg = os.path.join(root, "setup.cfg") setup_cfg = os.path.join(root, "setup.cfg")
parser = configparser.SafeConfigParser() parser = ConfigParser()
with open(setup_cfg, "r") as f: with open(setup_cfg, "r") as f:
parser.readfp(f) parser.read_file(f)
VCS = parser.get("versioneer", "VCS") # mandatory VCS = parser.get("versioneer", "VCS") # mandatory
def get(parser, name): def get(parser, name):
......
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