Install python3 packages using bindep in tox ci script
Change-Id: I8507a0f84f6ef8fe5bc91ccad36166df24ee4d27
This commit is contained in:
parent
f2b71f000a
commit
e1a859bb44
|
@ -5,8 +5,8 @@ libffi-dev [platform:dpkg]
|
|||
libffi-devel [platform:rpm]
|
||||
gcc [platform:rpm]
|
||||
gcc [platform:dpkg]
|
||||
python-dev [platform:dpkg]
|
||||
python-devel [platform:rpm]
|
||||
python3 [platform:dpkg]
|
||||
python3 [platform:rpm]
|
||||
python3-dev [platform:dpkg]
|
||||
python3-devel [platform:rpm]
|
||||
openssl-devel [platform:rpm]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
source $(dirname "$0")/activate
|
||||
|
||||
PYTHON_VERSION=${PYTHON_VERSION:-3}
|
||||
PYTHON_VERSION=${PYTHON_VERSION:-}
|
||||
|
||||
|
||||
function python() {
|
||||
|
|
29
tools/ci/tox
29
tools/ci/tox
|
@ -9,6 +9,10 @@ export PYTHON_VERSION=${PYTHON_VERSION:-}
|
|||
TOX_BASE_PYTHON=${PYTHON:-${CI_TOOLS_DIR}/python}
|
||||
TOX_VIRTUAL_ENV=$(realpath "${TOX_VIRTUAL_ENV:-.tox/tox}")
|
||||
|
||||
BINDEP=${BINDEP:-}
|
||||
BINDEP_FILE=${BINDEP_FILE:-$(pwd)/bindep.txt}
|
||||
INSTALL_BINDEPS=${INSTALL_BINDEPS:-sudo yum install -y}
|
||||
|
||||
|
||||
function tox {
|
||||
tox_setup
|
||||
|
@ -41,6 +45,8 @@ function tox_setup {
|
|||
curl https://bootstrap.pypa.io/get-pip.py | tox_python
|
||||
tox_pip install --upgrade setuptools wheel virtualenv tox
|
||||
fi
|
||||
|
||||
tox_install_bindeps
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -76,6 +82,29 @@ function tox_is_active {
|
|||
}
|
||||
|
||||
|
||||
function tox_install_bindeps {
|
||||
local bindep_file=${BINDEP_FILE:-$1}
|
||||
if ! [ -r "${bindep_file}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
local bindep=${BINDEP:-$(which bindep)}
|
||||
if ! [ -x "${bindep}" ]; then
|
||||
tox_pip install bindep
|
||||
bindep=$(which bindep)
|
||||
fi
|
||||
|
||||
# process ${BINDEP_FILE}
|
||||
local missing_packages=( $("${bindep}" -b -f "${bindep_file}") )
|
||||
if [ "${#missing_packages[@]}" != "0" ]; then
|
||||
${INSTALL_BINDEPS} "${missing_packages[@]}"
|
||||
if ! "${bindep}" -f "${bindep_file}"; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [ $(basename "$0") == tox ]; then
|
||||
tox "$@"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue