Skip to content

Commit

Permalink
Switch from SafeConfigParser to ConfigParser
Browse files Browse the repository at this point in the history
The configparser.SafeConfigParser class was renamed to ConfigParser in
Python 3.2. In Python 3.10, it was finally removed.

The import was copy/pasted from the debian generator to the RPM
generator, but isn't actually used there and could be removed.
  • Loading branch information
cottsay committed Mar 22, 2024
1 parent 058666e commit 437466d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ jobs:
pytest:
uses: ros-infrastructure/ci/.github/workflows/pytest.yaml@main
with:
matrix-filter: >-
del(.matrix.os[] | select(contains("windows"))) | del(.matrix.python[] |
select(contains("3.10") or contains("3.11") or contains("3.12")))
matrix-filter: del(.matrix.os[] | select(contains("windows")))
yamllint:
runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 3 additions & 3 deletions bloom/generators/debian/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@

# Python 2/3 support.
try:
from configparser import SafeConfigParser
from configparser import ConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
from ConfigParser import SafeConfigParser as ConfigParser
from dateutil import tz
from packaging.version import parse as parse_version

Expand Down Expand Up @@ -397,7 +397,7 @@ def generate_substitutions_from_package(
setup_cfg_path = os.path.join(package_path, 'setup.cfg')
data['pass_install_scripts'] = True
if os.path.isfile(setup_cfg_path):
setup_cfg = SafeConfigParser()
setup_cfg = ConfigParser()
setup_cfg.read([setup_cfg_path])
if (
setup_cfg.has_option('install', 'install-scripts') or
Expand Down
5 changes: 0 additions & 5 deletions bloom/generators/rpm/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
import traceback
import textwrap

# Python 2/3 support.
try:
from configparser import SafeConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
from dateutil import tz
from distutils.version import LooseVersion
from time import strptime
Expand Down

0 comments on commit 437466d

Please sign in to comment.