AAP-59874: Update to Python 3.12 (#16208)

* update to Python 3.12

* remove use of utcnow

* switch to timezone.utc

datetime.UTC is an alias of datetime.timezone.utc. if we're doing the double import for datetime it's more straightforward to just import timezone as well and get it directly

* debug python env version issue

* change python version

* pin to SHA and remove debug portion
This commit is contained in:
jessicamack
2026-01-07 11:57:24 -05:00
committed by GitHub
parent 48c7534b57
commit de86b93690
29 changed files with 124 additions and 85 deletions

View File

@@ -1,13 +1,29 @@
import locale
import json
from distutils.util import strtobool
import yaml
from awxkit.cli.utils import colored
from awxkit import config
def strtobool(val):
"""Convert a string representation of truth to true (1) or false (0).
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.
This replaces the deprecated distutils.util.strtobool removed in Python 3.12.
"""
val = val.lower()
if val in ('y', 'yes', 't', 'true', 'on', '1'):
return 1
elif val in ('n', 'no', 'f', 'false', 'off', '0'):
return 0
else:
raise ValueError(f"invalid truth value {val!r}")
def get_config_credentials():
"""Load username and password from config.credentials.default.

View File

@@ -6,10 +6,8 @@ import re
import sys
import yaml
from distutils.util import strtobool
from .custom import CustomAction
from .format import add_output_formatting_arguments
from .format import add_output_formatting_arguments, strtobool
from .resource import DEPRECATED_RESOURCES_REVERSE