Skip to content

Commit

Permalink
Use ConfigParser.getboolean to check config value.
Browse files Browse the repository at this point in the history
Using the dict access method will raise a KeyError when the config file
is present but this section or value is missing.
  • Loading branch information
nuclearsandwich committed Aug 12, 2024
1 parent 8b48f13 commit 8e94ef1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rosdep2/platforms/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ def externally_managed_installable():
for xdg_dir in os.environ['XDG_CONFIG_DIRS'].split(':'):
pip_config_file = Path(xdg_dir) / 'pip' / 'pip.conf'
pip_config.read(pip_config_file)
if pip_config['install']['break-system-packages']:
if pip_config.getboolean('install', 'break-system-packages', fallback=False):
return True

fallback_config = Path('/etc/pip.conf')
pip_config.read(fallback_config)
if pip_config['install']['break-system-packages']:
if pip_config.getboolean('install', 'break-system-packages', fallback=False):
return True
# On Python 3.11 and later, when no explicit configuration is present,
# global pip installation will not work.
Expand Down

0 comments on commit 8e94ef1

Please sign in to comment.