Merge "Drop python2, python3.6 and 3.7 support"

This commit is contained in:
Zuul 2023-02-07 15:34:41 +00:00 committed by Gerrit Code Review
commit 6d56d3372e
5 changed files with 38 additions and 48 deletions

View File

@ -29,8 +29,8 @@ We've created an "easy button" for Ubuntu, Centos, RHEL and openSUSE.
By default, Tempest 31.1.0 will be installed from commit By default, Tempest 31.1.0 will be installed from commit
56d259dd78cc9ae974cc5dc24a54dbd8008770e6 (June 2022). 56d259dd78cc9ae974cc5dc24a54dbd8008770e6 (June 2022).
c. -p option allows to specify python version - python 2.7 (-p 2), 3.8.10 (-p 3) c. -p option allows to specify python version - 3.8.10 (-p 3)
or any specific one by -p X.X.X. Default to python 3.8.10. or any equal or above 3.8.0. Default to python 3.8.10.
d. -q option makes ``refstack-client`` run quitely - if ``.tempest`` d. -q option makes ``refstack-client`` run quitely - if ``.tempest``
directory exists ``refstack-client`` is considered as installed. directory exists ``refstack-client`` is considered as installed.
@ -38,6 +38,10 @@ We've created an "easy button" for Ubuntu, Centos, RHEL and openSUSE.
e. -s option makes ``refstack-client`` use ``python-tempestconf`` from the e. -s option makes ``refstack-client`` use ``python-tempestconf`` from the
given source (path) - used when running f.e. in Zuul. given source (path) - used when running f.e. in Zuul.
f. -l option makes ``refstack-client`` install ``python`` in directory ``./localpython``.
If option -l is not used and version of ``python`` specified by option -p is equal to
global version of python, script will use this version of ``python``.
Usage Usage
##### #####

View File

@ -1,5 +1,5 @@
pbr!=2.1.0,>=2.0.0 # Apache-2.0 pbr!=2.1.0,>=2.0.0 # Apache-2.0
python-subunit>=0.0.18 python-subunit>=0.0.18 # BSD/Apache-2.0
cryptography>=1.0,!=1.3.0 # BSD/Apache-2.0 cryptography>=1.0,!=1.3.0 # BSD/Apache-2.0
requests>=2.5.2 requests>=2.5.2
PyYAML>=3.1.0 PyYAML>=3.1.0

View File

@ -14,14 +14,10 @@ classifier =
License :: OSI Approved :: Apache Software License License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux Operating System :: POSIX :: Linux
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
[files] [files]
packages = packages =

View File

@ -5,6 +5,7 @@
CHECKOUT_POINT=56d259dd78cc9ae974cc5dc24a54dbd8008770e6 CHECKOUT_POINT=56d259dd78cc9ae974cc5dc24a54dbd8008770e6
PY_VERSION="3.8.10" PY_VERSION="3.8.10"
UPPER_CONSTRAINTS_FILE="https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt" UPPER_CONSTRAINTS_FILE="https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt"
LOCAL_INTERPRETER=false
# Prints help # Prints help
function usage { function usage {
@ -16,11 +17,14 @@ function usage {
echo " -h Print this usage message" echo " -h Print this usage message"
echo " -c Tempest test runner commit. You can specify SHA or branch here" echo " -c Tempest test runner commit. You can specify SHA or branch here"
echo " If no commit or tag is specified, tempest will be install from commit" echo " If no commit or tag is specified, tempest will be install from commit"
echo " -p [ 2 | 3 | X.X.X ] - Uses either python 2.7 (if -p 2), 3.8.10 (if -p 3)" echo " -p [ 3 | 3.X.X ] - Uses python 3.8.10 (if -p 3)"
echo " or given specific version (if -p X.X.X). Default to python 3.8.10" echo " or given specific version (3.8 and higher, if -p 3.X.X). Default to python 3.8.10"
echo " -q Run quietly. If .tempest folder exists, refstack-client is considered as installed" echo " -q Run quietly. If .tempest folder exists, refstack-client is considered as installed"
echo " -s Use python-tempestconf from the given source (path), used when running f.e. in Zuul" echo " -s Use python-tempestconf from the given source (path), used when running f.e. in Zuul"
echo " -t Tempest test runner tag. You can specify tag here" echo " -t Tempest test runner tag. You can specify tag here"
echo " -l Force the installation of python version specified by -p (default 3.8.10) into"
echo " the ./localpython file. If parameter -l is false and version of python specified by"
echo " parameter -p is installed in the enviroment, script will use this interpreter."
echo " ${CHECKOUT_POINT}" echo " ${CHECKOUT_POINT}"
exit 1 exit 1
} }
@ -36,18 +40,20 @@ function check_tag {
# By default tempest uses commit ${CHECKOUT_POINT} # By default tempest uses commit ${CHECKOUT_POINT}
while getopts c:p:t:qs:h FLAG; do while getopts c:p:t:qs:hl FLAG; do
case ${FLAG} in case ${FLAG} in
c) c)
CHECKOUT_POINT=${OPTARG} CHECKOUT_POINT=${OPTARG}
;; ;;
p) p)
if [ ${OPTARG} == '2' ]; then if [ ${OPTARG} == '3' ]; then
PY_VERSION="2.7.8"
elif [ ${OPTARG} == '3' ]; then
PY_VERSION=${PY_VERSION} PY_VERSION=${PY_VERSION}
else elif [[ ${OPTARG} =~ ^3.([8-9]|[1-9][0-9]).([0-9]|[1-9][0-9])$ ]]; then
# minimal version of python -> 3.8.0
PY_VERSION=${OPTARG} PY_VERSION=${OPTARG}
else
echo "Version of python-${OPTARG} no longer supported."
usage
fi fi
;; ;;
t) t)
@ -62,6 +68,9 @@ while getopts c:p:t:qs:h FLAG; do
h) #show help h) #show help
usage usage
;; ;;
l) # use local python interpreter
LOCAL_INTERPRETER=true
;;
\?) #unrecognized option - show help \?) #unrecognized option - show help
echo -e \\n"Option -$OPTARG not allowed." echo -e \\n"Option -$OPTARG not allowed."
usage usage
@ -146,20 +155,12 @@ cd ${WORKDIR}
# Setup binary requirements # Setup binary requirements
if [ -n "$(command -v apt-get)" ]; then if [ -n "$(command -v apt-get)" ]; then
# For apt-get-based Linux distributions (Ubuntu, Debian) # For apt-get-based Linux distributions (Ubuntu, Debian)
if [[ ${PY_VERSION::1} == "2" ]]; then
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install curl wget tar unzip python-dev build-essential libssl-dev libxslt-dev libsasl2-dev libffi-dev libbz2-dev libyaml-dev
else
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install curl wget tar unzip python3-dev build-essential libssl-dev libxslt-dev libsasl2-dev libffi-dev libbz2-dev libyaml-dev sudo DEBIAN_FRONTEND=noninteractive apt-get -y install curl wget tar unzip python3-dev build-essential libssl-dev libxslt-dev libsasl2-dev libffi-dev libbz2-dev libyaml-dev
fi
elif [ -n "$DNF_COMMAND" -a -n "$(command -v ${DNF_COMMAND})" ]; then elif [ -n "$DNF_COMMAND" -a -n "$(command -v ${DNF_COMMAND})" ]; then
# For yum/dnf-based distributions (RHEL, Centos) # For yum/dnf-based distributions (RHEL, Centos)
sudo ${DNF_COMMAND} -y install curl wget tar unzip make gcc gcc-c++ libffi-devel libxml2-devel bzip2-devel libxslt-devel openssl-devel sudo ${DNF_COMMAND} -y install curl wget tar unzip make gcc gcc-c++ libffi-devel libxml2-devel bzip2-devel libxslt-devel openssl-devel
if [[ ${PY_VERSION::1} == "2" ]]; then
sudo ${DNF_COMMAND} -y install python-devel libyaml-devel
else
# python3 dependencies # python3 dependencies
sudo ${DNF_COMMAND} -y install python3-devel sudo ${DNF_COMMAND} -y install python3-devel
fi
elif [ -n "$(command -v zypper)" ]; then elif [ -n "$(command -v zypper)" ]; then
# For zypper-based distributions (openSUSE, SELS) # For zypper-based distributions (openSUSE, SELS)
sudo zypper --non-interactive install curl wget tar unzip make python-devel.x86_64 gcc gcc-c++ libffi-devel libxml2-devel zlib-devel libxslt-devel libopenssl-devel python-xml libyaml-devel sudo zypper --non-interactive install curl wget tar unzip make python-devel.x86_64 gcc gcc-c++ libffi-devel libxml2-devel zlib-devel libxslt-devel libopenssl-devel python-xml libyaml-devel
@ -169,9 +170,9 @@ else
fi fi
# Build local python interpreter if needed # Build local python interpreter if needed
sub_pystr="python$(echo $PY_VERSION | cut -c 1-3)" sub_pystr="python$(echo $PY_VERSION | grep -o '3.[0-9]\+')"
python_version=$($sub_pystr -V | cut -d " " -f 2) python_version=$($sub_pystr -V | cut -d " " -f 2)
if [ $python_version == $PY_VERSION ]; then if [ $python_version == $PY_VERSION ] && [ ${LOCAL_INTERPRETER} == false ]; then
echo "Python $PY_VERSION found!" echo "Python $PY_VERSION found!"
PYPATH="$sub_pystr" PYPATH="$sub_pystr"
else else
@ -190,27 +191,16 @@ else
PYPATH="${WORKDIR}/.localpython/bin/$sub_pystr" PYPATH="${WORKDIR}/.localpython/bin/$sub_pystr"
fi fi
# Setup virtual environments for refstack-client and tempest mkdir ${WORKDIR}/.localvirtualenv
VENV_VERSION='16.7.9' VENV_VERSION='20.16.7'
wget https://github.com/pypa/virtualenv/archive/${VENV_VERSION}.tar.gz $PYPATH -m pip install --target=${WORKDIR}/.localvirtualenv virtualenv==${VENV_VERSION}
tar xvfz ${VENV_VERSION}.tar.gz export PYTHONPATH=$(realpath .localvirtualenv):$PYTHONPATH
rm ${VENV_VERSION}.tar.gz VIRTUALENV=${WORKDIR}/.localvirtualenv/bin/virtualenv
cd virtualenv-${VENV_VERSION}
if [ -d ${WORKDIR}/.venv ]; then
rm -rf ${WORKDIR}/.venv
fi
# Determine python which will run virtualenv.py script # Option -S disable import of modules installed in python which are causing errors when creating virtual enviroment
if [ -n "$(command -v python3)" ]; then $PYPATH -S $VIRTUALENV ${WORKDIR}/.venv --python="${PYPATH}"
python='python3' $PYPATH -S $VIRTUALENV ${TEMPEST_DIR}/.venv --python="${PYPATH}"
else
python='python'
fi
$python virtualenv.py ${WORKDIR}/.venv --python="${PYPATH}"
$python virtualenv.py ${TEMPEST_DIR}/.venv --python="${PYPATH}"
cd ..
rm -rf virtualenv-${VENV_VERSION}
${WORKDIR}/.venv/bin/python -m pip install -c ${UPPER_CONSTRAINTS_FILE} -e . ${WORKDIR}/.venv/bin/python -m pip install -c ${UPPER_CONSTRAINTS_FILE} -e .
cd ${TEMPESTCONF_DIR} cd ${TEMPESTCONF_DIR}
${WORKDIR}/.venv/bin/python -m pip install -c ${UPPER_CONSTRAINTS_FILE} -e . ${WORKDIR}/.venv/bin/python -m pip install -c ${UPPER_CONSTRAINTS_FILE} -e .

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = pep8,py3,py27 envlist = pep8,py3,py38
minversion = 3.18 minversion = 3.18
skipsdist = True skipsdist = True