mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 23:37:39 -02:30
Fix requirement for python3.12 (#16215)
* Fix pip version constraint for Python 3.12 compatibility Remove outdated pip<22.0 constraint that was a workaround for pip-tools#1558. This issue was fixed in pip-tools 6.5.0+ and the old constraint breaks Python 3.12 where pkgutil.ImpImporter was removed. * Update requirements.txt * Fix license file inconsistencies with requirements - Rename awx-plugins.interfaces.txt to awx-plugins-interfaces.txt to match the package name in requirements - Remove backports-tarfile.txt and importlib-resources.txt as these packages are no longer in requirements * Fix updater.sh for pip 25.3 normalized output format Changes to requirements_git.txt: - Update to PEP 440 format (name @ git+url) to match pip-compile output - Normalize package names (hyphens instead of dots/underscores) - Sort extras alphabetically with hyphens (e.g., jwt-consumer not jwt_consumer) - Add documentation explaining format requirements Changes to updater.sh: - Escape BRE regex metacharacters in sed pattern to handle brackets in extras - Change sed delimiter from ! to | to avoid conflict with comment text - Add explicit return statements to functions - Assign positional parameters to local variables - Redirect error messages to stderr - Replace backticks with $() for command substitution - Pin pip to version 25.3 requirements.txt regenerated via updater.sh * Normalize package names in requirements.in to match pip output - prometheus_client -> prometheus-client - setuptools_scm -> setuptools-scm - dispatcherd[pg_notify] -> dispatcherd[pg-notify] PEP 503 specifies that package names should use hyphens. * Fix license files to match normalized package names - Remove awx_plugins.interfaces.txt (duplicate of awx-plugins-interfaces.txt) - Rename system-certifi.txt to certifi.txt to match package name
This commit is contained in:
@@ -11,32 +11,39 @@ sanitize_git="1"
|
||||
_cleanup() {
|
||||
cd /
|
||||
test "${KEEP_TMP:-0}" = 1 || rm -rf "${_tmp}"
|
||||
return 0
|
||||
}
|
||||
|
||||
generate_requirements() {
|
||||
venv="`pwd`/venv"
|
||||
echo $venv
|
||||
local input_reqs="$1"
|
||||
venv="$(pwd)/venv"
|
||||
echo "$venv"
|
||||
/usr/bin/python3.12 -m venv "${venv}"
|
||||
# shellcheck disable=SC1090
|
||||
source ${venv}/bin/activate
|
||||
source "${venv}/bin/activate"
|
||||
|
||||
# FIXME: https://github.com/jazzband/pip-tools/issues/1558
|
||||
${venv}/bin/python3 -m pip install -U 'pip<22.0' pip-tools
|
||||
# pip version must match the version used in AWX venv (see README.md UPGRADE BLOCKERs)
|
||||
"${venv}/bin/python3" -m pip install -U 'pip==25.3' pip-tools
|
||||
|
||||
${pip_compile} $1 --output-file requirements.txt
|
||||
${pip_compile} ${input_reqs} --output-file requirements.txt
|
||||
# consider the git requirements for purposes of resolving deps
|
||||
# Then comment out any git+ lines from requirements.txt
|
||||
if [[ "$sanitize_git" == "1" ]] ; then
|
||||
while IFS= read -r line; do
|
||||
if [[ $line != \#* ]]; then # ignore lines which are already comments
|
||||
# Escape regex special characters for the search pattern
|
||||
# Only escape BRE metacharacters: . * ^ $ [ \
|
||||
escaped_pattern=$(printf '%s\n' "${line%#*}" | sed 's/[[\.*^$]/\\&/g')
|
||||
# Add # to the start of any line matched
|
||||
sed -i "s!^.*${line%#*}!# ${line%#*} # git requirements installed separately!g" requirements.txt
|
||||
sed -i "s|^.*${escaped_pattern}|# ${line%#*} # git requirements installed separately|g" requirements.txt
|
||||
fi
|
||||
done < "${requirements_git}"
|
||||
fi;
|
||||
return 0
|
||||
}
|
||||
|
||||
main() {
|
||||
local command="${1:-}"
|
||||
base_dir=$(pwd)
|
||||
dest_requirements="${requirements}"
|
||||
input_requirements="${requirements_in} ${requirements_git}"
|
||||
@@ -45,7 +52,7 @@ main() {
|
||||
|
||||
trap _cleanup INT TERM EXIT
|
||||
|
||||
case $1 in
|
||||
case "${command}" in
|
||||
"run")
|
||||
NEEDS_HELP=0
|
||||
;;
|
||||
@@ -63,9 +70,9 @@ main() {
|
||||
NEEDS_HELP=1
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "ERROR: Parameter $1 not valid"
|
||||
echo ""
|
||||
echo "" >&2
|
||||
echo "ERROR: Parameter ${command} not valid" >&2
|
||||
echo "" >&2
|
||||
NEEDS_HELP=1
|
||||
;;
|
||||
esac
|
||||
@@ -86,13 +93,13 @@ main() {
|
||||
fi
|
||||
|
||||
if [[ ! -d /awx_devel ]] ; then
|
||||
echo "This script should be run inside the awx container"
|
||||
echo "This script should be run inside the awx container" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! -z "$(tail -c 1 "${requirements_git}")" ]]
|
||||
then
|
||||
echo "No newline at end of ${requirements_git}, please add one"
|
||||
echo "No newline at end of ${requirements_git}, please add one" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
@@ -105,6 +112,7 @@ main() {
|
||||
cat requirements.txt | sed "s:$base_dir:/awx_devel/requirements:" > "${dest_requirements}"
|
||||
|
||||
_cleanup
|
||||
return 0
|
||||
}
|
||||
|
||||
# set EVAL=1 in case you want to source this script
|
||||
|
||||
Reference in New Issue
Block a user