From 6592b419fe8fce88243203758e04e834b19f6b86 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Mon, 10 Aug 2020 11:07:32 +0200 Subject: [PATCH 1/5] Fix versions for python 3.5 and 3.9 --- libbeat/tests/system/requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libbeat/tests/system/requirements.txt b/libbeat/tests/system/requirements.txt index 9bd40616f8f..00eff11c5d9 100644 --- a/libbeat/tests/system/requirements.txt +++ b/libbeat/tests/system/requirements.txt @@ -25,7 +25,6 @@ more-itertools==8.4.0 ordered-set==3.1.1 packaging==20.4 parameterized==0.7.0 -Pillow==7.2.0 pluggy==0.13.1 py==1.9.0 pycodestyle==2.4.0 @@ -45,4 +44,4 @@ toml==0.10.1 urllib3==1.24.2 wcwidth==0.2.5 websocket-client==0.47.0 -zipp==3.1.0 +zipp>=1.2.0,<=3.1.0 From 18b789a1c8b73d1853f0136c9c0b934ba4dc1e2d Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Mon, 10 Aug 2020 11:49:53 +0200 Subject: [PATCH 2/5] Add helper script to check requirements file --- script/check_python_requirements.sh | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 script/check_python_requirements.sh diff --git a/script/check_python_requirements.sh b/script/check_python_requirements.sh new file mode 100755 index 00000000000..932583ba197 --- /dev/null +++ b/script/check_python_requirements.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Helper script to check that packages defined in a requirements.txt +# file can be installed in different Python versions, it checks by +# default the requirements.txt file for libbeat tests. +# +# Usage: check_python_requirements.sh /path/to/requirements.txt +# +# VERSIONS environment variable can be set to a space-separated list +# of versions of python to test with. +# + +set -e + +BEATS_PATH=$(realpath $(dirname ${BASH_SOURCE[0]})/..) + +VERSIONS=${VERSIONS:-3.5 3.6 3.7 3.8 3.9-rc} +REQUIREMENTS=${1:-${BEATS_PATH}/libbeat/tests/system/requirements.txt} + +if [ ! -f $REQUIREMENTS ]; then + echo "Requirements file doesn't exist: $REQUIREMENTS" + exit -1 +fi + +REQUIREMENTS=$(realpath $REQUIREMENTS) + +echo "Versions: $VERSIONS" +echo "Requirements file: $REQUIREMENTS" + +for version in $VERSIONS; do + echo "==== Version: $version" + + docker run -it --rm -v $REQUIREMENTS:/requirements.txt python:$version \ + python -m pip install -q -r /requirements.txt + + echo "==== OK" +done From bc2407f62cf35e4d78366e8a3b2af4844ae451d9 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Mon, 10 Aug 2020 14:07:01 +0200 Subject: [PATCH 3/5] Don't use realpath in the script --- script/check_python_requirements.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/script/check_python_requirements.sh b/script/check_python_requirements.sh index 932583ba197..015be1e826c 100755 --- a/script/check_python_requirements.sh +++ b/script/check_python_requirements.sh @@ -12,7 +12,16 @@ set -e -BEATS_PATH=$(realpath $(dirname ${BASH_SOURCE[0]})/..) +function abspath() { + local path=$1 + if [ -d $path ]; then + cd $path; pwd; cd - > /dev/null + else + echo $(abspath $(dirname $path))/$(basename $path) + fi +} + +BEATS_PATH=$(abspath $(dirname ${BASH_SOURCE[0]})/..) VERSIONS=${VERSIONS:-3.5 3.6 3.7 3.8 3.9-rc} REQUIREMENTS=${1:-${BEATS_PATH}/libbeat/tests/system/requirements.txt} @@ -22,7 +31,7 @@ if [ ! -f $REQUIREMENTS ]; then exit -1 fi -REQUIREMENTS=$(realpath $REQUIREMENTS) +REQUIREMENTS=$(abspath $REQUIREMENTS) echo "Versions: $VERSIONS" echo "Requirements file: $REQUIREMENTS" From 387ac9f2d21d73c6ca507b8936165a0390ccdf19 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Mon, 10 Aug 2020 14:12:31 +0200 Subject: [PATCH 4/5] Quote paths to support paths with spaces --- script/check_python_requirements.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/script/check_python_requirements.sh b/script/check_python_requirements.sh index 015be1e826c..bd6054a3e75 100755 --- a/script/check_python_requirements.sh +++ b/script/check_python_requirements.sh @@ -14,10 +14,10 @@ set -e function abspath() { local path=$1 - if [ -d $path ]; then - cd $path; pwd; cd - > /dev/null + if [ -d "$path" ]; then + cd "$path"; pwd; cd - > /dev/null else - echo $(abspath $(dirname $path))/$(basename $path) + echo $(abspath "$(dirname "$path")")/$(basename "$path") fi } @@ -26,12 +26,12 @@ BEATS_PATH=$(abspath $(dirname ${BASH_SOURCE[0]})/..) VERSIONS=${VERSIONS:-3.5 3.6 3.7 3.8 3.9-rc} REQUIREMENTS=${1:-${BEATS_PATH}/libbeat/tests/system/requirements.txt} -if [ ! -f $REQUIREMENTS ]; then +if [ ! -f "$REQUIREMENTS" ]; then echo "Requirements file doesn't exist: $REQUIREMENTS" exit -1 fi -REQUIREMENTS=$(abspath $REQUIREMENTS) +REQUIREMENTS=$(abspath "$REQUIREMENTS") echo "Versions: $VERSIONS" echo "Requirements file: $REQUIREMENTS" @@ -39,7 +39,7 @@ echo "Requirements file: $REQUIREMENTS" for version in $VERSIONS; do echo "==== Version: $version" - docker run -it --rm -v $REQUIREMENTS:/requirements.txt python:$version \ + docker run -it --rm -v "$REQUIREMENTS":/requirements.txt python:$version \ python -m pip install -q -r /requirements.txt echo "==== OK" From 4624b72ca5e4afe3f385dbd5cc99fafffc49e6ac Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Mon, 10 Aug 2020 14:15:27 +0200 Subject: [PATCH 5/5] More quotes --- script/check_python_requirements.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/check_python_requirements.sh b/script/check_python_requirements.sh index bd6054a3e75..3ba5924a4c6 100755 --- a/script/check_python_requirements.sh +++ b/script/check_python_requirements.sh @@ -21,7 +21,7 @@ function abspath() { fi } -BEATS_PATH=$(abspath $(dirname ${BASH_SOURCE[0]})/..) +BEATS_PATH=$(abspath "$(dirname "${BASH_SOURCE[0]}")"/..) VERSIONS=${VERSIONS:-3.5 3.6 3.7 3.8 3.9-rc} REQUIREMENTS=${1:-${BEATS_PATH}/libbeat/tests/system/requirements.txt}