Drop python2, python3.6 and 3.7 support
Refstack-client is dropping support of python2 and also all python3 versions above python3.8 Changes: -requirements.txt - added license on python-subunit -setup.cfg - removed python2 and python3 versions below python3.8 - added python3.10 -setup_env - removed all python2 mentions - python3 min version set to 3.8.0 - added parameter l which will force installation of python into ${WORKDIR}/.localpython -tox.ini - removed py27 from envlist, added py38 Change-Id: I6500ed950cb9bc07d87370940b4752e686712c14
This commit is contained in:
parent
23d9f5d7df
commit
54c74fb8e3
@ -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
|
||||
56d259dd78cc9ae974cc5dc24a54dbd8008770e6 (June 2022).
|
||||
|
||||
c. -p option allows to specify python version - python 2.7 (-p 2), 3.8.10 (-p 3)
|
||||
or any specific one by -p X.X.X. Default to python 3.8.10.
|
||||
c. -p option allows to specify python version - 3.8.10 (-p 3)
|
||||
or any equal or above 3.8.0. Default to python 3.8.10.
|
||||
|
||||
d. -q option makes ``refstack-client`` run quitely - if ``.tempest``
|
||||
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
|
||||
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
|
||||
#####
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
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
|
||||
requests>=2.5.2
|
||||
PyYAML>=3.1.0
|
||||
|
@ -14,14 +14,10 @@ classifier =
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.7
|
||||
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.9
|
||||
Programming Language :: Python :: 3.10
|
||||
|
||||
[files]
|
||||
packages =
|
||||
|
68
setup_env
68
setup_env
@ -5,6 +5,7 @@
|
||||
CHECKOUT_POINT=56d259dd78cc9ae974cc5dc24a54dbd8008770e6
|
||||
PY_VERSION="3.8.10"
|
||||
UPPER_CONSTRAINTS_FILE="https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt"
|
||||
LOCAL_INTERPRETER=false
|
||||
|
||||
# Prints help
|
||||
function usage {
|
||||
@ -16,11 +17,14 @@ function usage {
|
||||
echo " -h Print this usage message"
|
||||
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 " -p [ 2 | 3 | X.X.X ] - Uses either python 2.7 (if -p 2), 3.8.10 (if -p 3)"
|
||||
echo " or given specific version (if -p X.X.X). Default to python 3.8.10"
|
||||
echo " -p [ 3 | 3.X.X ] - Uses python 3.8.10 (if -p 3)"
|
||||
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 " -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 " -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}"
|
||||
exit 1
|
||||
}
|
||||
@ -36,18 +40,20 @@ function check_tag {
|
||||
|
||||
# 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
|
||||
c)
|
||||
CHECKOUT_POINT=${OPTARG}
|
||||
;;
|
||||
p)
|
||||
if [ ${OPTARG} == '2' ]; then
|
||||
PY_VERSION="2.7.8"
|
||||
elif [ ${OPTARG} == '3' ]; then
|
||||
if [ ${OPTARG} == '3' ]; then
|
||||
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}
|
||||
else
|
||||
echo "Version of python-${OPTARG} no longer supported."
|
||||
usage
|
||||
fi
|
||||
;;
|
||||
t)
|
||||
@ -62,6 +68,9 @@ while getopts c:p:t:qs:h FLAG; do
|
||||
h) #show help
|
||||
usage
|
||||
;;
|
||||
l) # use local python interpreter
|
||||
LOCAL_INTERPRETER=true
|
||||
;;
|
||||
\?) #unrecognized option - show help
|
||||
echo -e \\n"Option -$OPTARG not allowed."
|
||||
usage
|
||||
@ -146,20 +155,12 @@ cd ${WORKDIR}
|
||||
# Setup binary requirements
|
||||
if [ -n "$(command -v apt-get)" ]; then
|
||||
# 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
|
||||
fi
|
||||
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
|
||||
elif [ -n "$DNF_COMMAND" -a -n "$(command -v ${DNF_COMMAND})" ]; then
|
||||
# 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
|
||||
if [[ ${PY_VERSION::1} == "2" ]]; then
|
||||
sudo ${DNF_COMMAND} -y install python-devel libyaml-devel
|
||||
else
|
||||
# python3 dependencies
|
||||
sudo ${DNF_COMMAND} -y install python3-devel
|
||||
fi
|
||||
# python3 dependencies
|
||||
sudo ${DNF_COMMAND} -y install python3-devel
|
||||
elif [ -n "$(command -v zypper)" ]; then
|
||||
# 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
|
||||
@ -169,9 +170,9 @@ else
|
||||
fi
|
||||
|
||||
# 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)
|
||||
if [ $python_version == $PY_VERSION ]; then
|
||||
if [ $python_version == $PY_VERSION ] && [ ${LOCAL_INTERPRETER} == false ]; then
|
||||
echo "Python $PY_VERSION found!"
|
||||
PYPATH="$sub_pystr"
|
||||
else
|
||||
@ -190,27 +191,16 @@ else
|
||||
PYPATH="${WORKDIR}/.localpython/bin/$sub_pystr"
|
||||
fi
|
||||
|
||||
# Setup virtual environments for refstack-client and tempest
|
||||
VENV_VERSION='16.7.9'
|
||||
wget https://github.com/pypa/virtualenv/archive/${VENV_VERSION}.tar.gz
|
||||
tar xvfz ${VENV_VERSION}.tar.gz
|
||||
rm ${VENV_VERSION}.tar.gz
|
||||
cd virtualenv-${VENV_VERSION}
|
||||
if [ -d ${WORKDIR}/.venv ]; then
|
||||
rm -rf ${WORKDIR}/.venv
|
||||
fi
|
||||
mkdir ${WORKDIR}/.localvirtualenv
|
||||
VENV_VERSION='20.16.7'
|
||||
$PYPATH -m pip install --target=${WORKDIR}/.localvirtualenv virtualenv==${VENV_VERSION}
|
||||
export PYTHONPATH=$(realpath .localvirtualenv):$PYTHONPATH
|
||||
VIRTUALENV=${WORKDIR}/.localvirtualenv/bin/virtualenv
|
||||
|
||||
# Determine python which will run virtualenv.py script
|
||||
if [ -n "$(command -v python3)" ]; then
|
||||
python='python3'
|
||||
else
|
||||
python='python'
|
||||
fi
|
||||
$python virtualenv.py ${WORKDIR}/.venv --python="${PYPATH}"
|
||||
$python virtualenv.py ${TEMPEST_DIR}/.venv --python="${PYPATH}"
|
||||
# Option -S disable import of modules installed in python which are causing errors when creating virtual enviroment
|
||||
$PYPATH -S $VIRTUALENV ${WORKDIR}/.venv --python="${PYPATH}"
|
||||
$PYPATH -S $VIRTUALENV ${TEMPEST_DIR}/.venv --python="${PYPATH}"
|
||||
|
||||
cd ..
|
||||
rm -rf virtualenv-${VENV_VERSION}
|
||||
${WORKDIR}/.venv/bin/python -m pip install -c ${UPPER_CONSTRAINTS_FILE} -e .
|
||||
cd ${TEMPESTCONF_DIR}
|
||||
${WORKDIR}/.venv/bin/python -m pip install -c ${UPPER_CONSTRAINTS_FILE} -e .
|
||||
|
Loading…
Reference in New Issue
Block a user