From ce97cae61a4d1c714bac769de34d79662d71ab93 Mon Sep 17 00:00:00 2001 From: Christian Beiwinkel Date: Fri, 21 Jun 2024 18:06:03 +0200 Subject: [PATCH] distutils removed from standard lib --- valhalla/valhalla_build_config.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/valhalla/valhalla_build_config.py b/valhalla/valhalla_build_config.py index 3254812..44eae79 100644 --- a/valhalla/valhalla_build_config.py +++ b/valhalla/valhalla_build_config.py @@ -1,10 +1,20 @@ #!/usr/bin/env python3 from argparse import ArgumentParser, ArgumentTypeError, ArgumentDefaultsHelpFormatter -from distutils.util import strtobool import json from typing import List, Union + +def strtobool(value): + lower = str(value).lower() + if lower in {'y', 'yes', 't', 'true', 'on', '1'}: + return True + elif lower in {'n', 'no', 'f', 'false', 'off', '0'}: + return False + else: + raise ValueError('"{}" is not a valid bool value'.format(value)) + + class Optional: def __init__(self, t=None): self.type = t