From 9f41936861e79496acb8e2bfe607db4547d2de2c Mon Sep 17 00:00:00 2001 From: Stephen Sadowski Date: Sun, 23 Jan 2022 19:57:30 -0600 Subject: [PATCH] fix: removed distutils dependency in setup.py per PEP 632 --- setup.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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