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

@@ -48,12 +48,12 @@ RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
patch \
postgresql \
postgresql-devel \
python3.11 \
"python3.11-devel" \
"python3.11-pip" \
"python3.11-setuptools" \
"python3.11-packaging" \
"python3.11-psycopg2" \
python3.12 \
"python3.12-devel" \
"python3.12-pip" \
"python3.12-setuptools" \
"python3.12-packaging" \
"python3.12-psycopg2" \
swig \
unzip \
xmlsec1-devel \
@@ -63,7 +63,7 @@ RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
RUN mkdir -p ~/.ssh && chmod 0700 ~/.ssh
RUN ssh-keyscan github.com > ~/.ssh/known_hosts
RUN pip3.11 install -vv build
RUN pip3.12 install -vv build
{% if image_architecture == 'ppc64le' %}
RUN dnf -y update && dnf install -y wget && \
@@ -133,12 +133,12 @@ RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
krb5-workstation \
nginx \
postgresql \
python3.11 \
"python3.11-devel" \
"python3.11-pip*" \
"python3.11-setuptools" \
"python3.11-packaging" \
"python3.11-psycopg2" \
python3.12 \
"python3.12-devel" \
"python3.12-pip*" \
"python3.12-setuptools" \
"python3.12-packaging" \
"python3.12-psycopg2" \
rsync \
rsyslog \
subversion \
@@ -149,7 +149,7 @@ RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
xmlsec1-openssl && \
dnf -y clean all
RUN pip3.11 install -vv virtualenv supervisor dumb-init build
RUN pip3.12 install -vv virtualenv supervisor dumb-init build
RUN rm -rf /root/.cache && rm -rf /tmp/*
@@ -181,8 +181,8 @@ RUN dnf -y install \
unzip && \
npm install -g n && n 16.13.1 && npm install -g npm@8.5.0 && dnf remove -y nodejs
RUN pip3.11 install -vv git+https://github.com/coderanger/supervisor-stdout.git@973ba19967cdaf46d9c1634d1675fc65b9574f6e
RUN pip3.11 install -vv black setuptools-scm build
RUN pip3.12 install -vv git+https://github.com/coderanger/supervisor-stdout.git@973ba19967cdaf46d9c1634d1675fc65b9574f6e
RUN pip3.12 install -vv black setuptools-scm build
# This package randomly fails to download.
# It is nice to have in the dev env, but not necessary.
@@ -251,8 +251,8 @@ ADD tools/scripts/awx-python /usr/bin/awx-python
{% endif %}
{% if (build_dev|bool) or (kube_dev|bool) %}
RUN echo /awx_devel > /var/lib/awx/venv/awx/lib/python3.11/site-packages/awx.egg-link
RUN echo /awx_devel > /var/lib/awx/venv/awx/lib/python3.11/site-packages/awx.pth
RUN echo /awx_devel > /var/lib/awx/venv/awx/lib/python3.12/site-packages/awx.egg-link
RUN echo /awx_devel > /var/lib/awx/venv/awx/lib/python3.12/site-packages/awx.pth
RUN ln -sf /awx_devel/tools/docker-compose/awx-manage /usr/local/bin/awx-manage
RUN ln -sf /awx_devel/tools/scripts/awx-python /usr/bin/awx-python
RUN ln -sf /awx_devel/tools/scripts/rsyslog-4xx-recovery /usr/bin/rsyslog-4xx-recovery
@@ -284,8 +284,8 @@ RUN for dir in \
/var/lib/awx/.local \
/var/lib/awx/venv \
/var/lib/awx/venv/awx/bin \
/var/lib/awx/venv/awx/lib/python3.11 \
/var/lib/awx/venv/awx/lib/python3.11/site-packages \
/var/lib/awx/venv/awx/lib/python3.12 \
/var/lib/awx/venv/awx/lib/python3.12/site-packages \
/var/lib/awx/projects \
/var/lib/awx/rsyslog \
/var/run/awx-rsyslog \

View File

@@ -310,12 +310,12 @@ if __name__ == '__main__':
if events > 0:
for k_id in created_job_ids:
generate_events(events, str(k_id), time_delta)
print(datetime.datetime.utcnow().isoformat())
print(datetime.datetime.now(datetime.UTC).isoformat())
conn.close()
finally:
# restore all indexes
print(datetime.datetime.utcnow().isoformat())
print(datetime.datetime.now(datetime.UTC).isoformat())
print('restoring indexes and constraints (this may take awhile)')
workers = []
@@ -343,4 +343,4 @@ if __name__ == '__main__':
sql = f'ALTER TABLE main_jobevent ADD CONSTRAINT {conname} {condef}'
cleanup(sql)
print(datetime.datetime.utcnow().isoformat())
print(datetime.datetime.now(datetime.UTC).isoformat())