Skip to content

Commit

Permalink
Merge pull request #196 from luca-della-vedova/luca/migrate_configparser
Browse files Browse the repository at this point in the history
Migrate off SafeConfigParser
  • Loading branch information
nuclearsandwich authored Nov 14, 2024
2 parents fbe2834 + 7730361 commit 3a09257
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
7 changes: 1 addition & 6 deletions stdeb/cli_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
import shutil
import subprocess
import sys
try:
# python 2.x
from ConfigParser import SafeConfigParser # noqa: F401
except ImportError:
# python 3.x
from configparser import SafeConfigParser # noqa: F401
from configparser import ConfigParser # noqa: F401
from distutils.util import strtobool
from distutils.fancy_getopt import FancyGetopt, translate_longopt
from stdeb.util import stdeb_cmdline_opts, stdeb_cmd_bool_opts
Expand Down
13 changes: 4 additions & 9 deletions stdeb/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
import sys
import time
import codecs
try:
# Python 2.x
import ConfigParser
except ImportError:
# Python 3.x
import configparser as ConfigParser
import configparser as ConfigParser
import subprocess
import tempfile
import stdeb # noqa: F401
Expand Down Expand Up @@ -732,7 +727,7 @@ def check_cfg_files(cfg_files, module_name):
example.
"""

cfg = ConfigParser.SafeConfigParser()
cfg = ConfigParser.ConfigParser()
cfg.read(cfg_files)
if cfg.has_section(module_name):
section_items = cfg.items(module_name)
Expand Down Expand Up @@ -803,10 +798,10 @@ def __init__(self,
if len(cfg_files):
check_cfg_files(cfg_files, module_name)

cfg = ConfigParser.SafeConfigParser(cfg_defaults)
cfg = ConfigParser.ConfigParser(cfg_defaults)
for cfg_file in cfg_files:
with codecs.open(cfg_file, mode='r', encoding='utf-8') as fd:
cfg.readfp(fd)
cfg.read_file(fd)

if sdist_dsc_command is not None:
# Allow distutils commands to override config files (this lets
Expand Down

0 comments on commit 3a09257

Please sign in to comment.