diff --git a/setup.py b/setup.py index ea6f285a..4f289673 100644 --- a/setup.py +++ b/setup.py @@ -6,12 +6,25 @@ import os import re import sys -from distutils.util import strtobool - from setuptools import find_packages, setup from setuptools.command.test import test as TestCommand +def strtobool(query: str) -> bool: + """ + reimplement strtobool per PEP 632 and python 3.12 deprecation + + 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. + """ + if query.lower() in ["y", "yes", "t", "true", "on", "1"]: + return True + elif query.lower() in ["n", "no", "f", "false", "off", "0"]: + return False + else: + raise ValueError + + class PyTest(TestCommand): """ Provide a Test runner to be used from setup.py to run unit tests