Skip to content

Commit

Permalink
Remove need for distutils.util (distutils now deprecated) (#99)
Browse files Browse the repository at this point in the history
* Use setuptools to provide distutils.util (distutils deprecated w/ python >=3.12)

* Improved implementation - no need for setuptools either
  • Loading branch information
cdtomkins authored Dec 31, 2024
1 parent e1d67d1 commit 5fff525
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Development Tasks."""

from distutils.util import strtobool
from time import sleep
import os
import toml
Expand All @@ -19,7 +18,14 @@ def is_truthy(arg):
"""
if isinstance(arg, bool):
return arg
return bool(strtobool(arg))

val = str(arg).lower()
if val in ("y", "yes", "t", "true", "on", "1"):
return True
elif val in ("n", "no", "f", "false", "off", "0"):
return False
else:
raise ValueError(f"Invalid truthy value: `{arg}`")


# Use pyinvoke configuration for default values, see http://docs.pyinvoke.org/en/stable/concepts/configuration.html
Expand Down

0 comments on commit 5fff525

Please sign in to comment.