Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't depend on distutils #1121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
## Upcoming
* Improvements to the CarlaDataProvider:
- Added `spawn_actor` for a blueprint based actor creation similar to `World.spawn_actor`
* Implement `strtobool` formerly included in `distutils`, which is removed in Python 3.12.

## CARLA ScenarioRunner 0.9.15
### :rocket: New Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- Can only consider obstacles in forward facing reaching (i.e. in tight corners obstacles may be ignored).
"""

from distutils.util import strtobool
from srunner.tools.util import strtobool
import math

import carla
Expand Down
2 changes: 1 addition & 1 deletion srunner/scenarios/open_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from __future__ import print_function

from distutils.util import strtobool
from srunner.tools.util import strtobool
import itertools
import os
import py_trees
Expand Down
2 changes: 1 addition & 1 deletion srunner/tools/openscenario_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from __future__ import print_function

from distutils.util import strtobool
from srunner.tools.util import strtobool
import re
import copy
import datetime
Expand Down
14 changes: 14 additions & 0 deletions srunner/tools/util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def strtobool(val):
"""Convert a string representation of truth to true (1) or false (0).

True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
'val' is anything else.
"""
val = val.lower()
if val in ('y', 'yes', 't', 'true', 'on', '1'):
return 1
elif val in ('n', 'no', 'f', 'false', 'off', '0'):
return 0
else:
raise ValueError(f"invalid truth value {val!r}")