fix: removed distutils dependency in setup.py per PEP 632

This commit is contained in:
Stephen Sadowski 2022-01-23 19:57:30 -06:00
parent 9d04f24298
commit 768d0e09b5

View File

@ -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