diff --git a/Jenkinsfile b/Jenkinsfile index 00c6691b3..0bc4dfc3b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,8 +43,7 @@ pipeline { steps { - sh '. /home/jenkins/.venv/bin/activate' - sh 'make setup' + sh 'make setup ARGS="--py3-version 3.7"' } } stage('ubuntu build') @@ -52,7 +51,7 @@ pipeline steps { sh 'make LibCarla' - sh 'make PythonAPI' + sh 'make PythonAPI ARGS="--py3-version 3.7"' sh 'make CarlaUE4Editor' sh 'make examples' } @@ -69,7 +68,7 @@ pipeline { steps { - sh 'make check ARGS="--all --xml"' + sh 'make check ARGS="--all --xml --py3-version 3.7"' } post { @@ -91,7 +90,7 @@ pipeline { steps { - sh 'make package' + sh 'make package ARGS="--py3-version 3.7"' sh 'make package ARGS="--packages=AdditionalMaps --clean-intermediate"' sh 'make examples ARGS="localhost 3654"' } diff --git a/Util/BuildTools/BuildPythonAPI.sh b/Util/BuildTools/BuildPythonAPI.sh index 1c04f3970..71383c70a 100755 --- a/Util/BuildTools/BuildPythonAPI.sh +++ b/Util/BuildTools/BuildPythonAPI.sh @@ -18,12 +18,14 @@ BUILD_FOR_PYTHON2=false BUILD_FOR_PYTHON3=false BUILD_RSS_VARIANT=false -OPTS=`getopt -o h --long help,rebuild,py2,py3,clean,rss -n 'parse-options' -- "$@"` +OPTS=`getopt -o h --long help,rebuild,py2,py3,clean,rss,py3-version -n 'parse-options' -- "$@"` if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi eval set -- "$OPTS" +PY3_VERSION=3 + while true; do case "$1" in --rebuild ) @@ -37,6 +39,10 @@ while true; do --py3 ) BUILD_FOR_PYTHON3=true; shift ;; + --py3-version ) + PY3_VERSION="$3"; + shift + shift ;; --rss ) BUILD_RSS_VARIANT=true; shift ;; @@ -53,7 +59,7 @@ while true; do esac done -if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_FOR_PYTHON2} || ${BUILD_FOR_PYTHON3}; }; then +if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_FOR_PYTHON2} || ${BUILD_FOR_PYTHON3} ; }; then fatal_error "Nothing selected to be done." fi @@ -94,7 +100,7 @@ if ${BUILD_FOR_PYTHON3} ; then log "Building Python API for Python 3." - /usr/bin/env python3 setup.py bdist_egg + /usr/bin/env python${PY3_VERSION} setup.py bdist_egg fi diff --git a/Util/BuildTools/Check.sh b/Util/BuildTools/Check.sh index 7e7e30d67..c1a095abc 100755 --- a/Util/BuildTools/Check.sh +++ b/Util/BuildTools/Check.sh @@ -41,12 +41,14 @@ SMOKE_TESTS_2=false SMOKE_TESTS_3=false RUN_BENCHMARK=false -OPTS=`getopt -o h --long help,gdb,xml,gtest_args:,all,libcarla-release,libcarla-debug,python-api-2,python-api-3,smoke-2,smoke-3,benchmark -n 'parse-options' -- "$@"` +OPTS=`getopt -o h --long help,gdb,xml,gtest_args:,all,libcarla-release,libcarla-debug,python-api-2,python-api-3,smoke-2,smoke-3,benchmark,py3-version -n 'parse-options' -- "$@"` if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi eval set -- "$OPTS" +PY3_VERSION=3 + while true; do case "$1" in --gdb ) @@ -89,6 +91,10 @@ while true; do RUN_BENCHMARK=true; GTEST_ARGS="--gtest_filter=benchmark*"; shift ;; + --py3-version ) + PY3_VERSION="$3" + shift + shift ;; -h | --help ) echo "$DOC_STRING" echo -e "$USAGE_STRING" @@ -197,7 +203,7 @@ if ${PYTHON_API_3} ; then log "Running Python API for Python 3 unit tests." - /usr/bin/env python3 -m nose2 ${EXTRA_ARGS} + /usr/bin/env python${PY3_VERSION} -m nose2 ${EXTRA_ARGS} if ${XML_OUTPUT} ; then mv test-results.xml ${CARLA_TEST_RESULTS_FOLDER}/python-api-3.xml @@ -242,7 +248,7 @@ if ${SMOKE_TESTS_3} ; then log "Running smoke tests for Python 3." - /usr/bin/env python3 -m nose2 ${EXTRA_ARGS} + /usr/bin/env python${PY3_VERSION} -m nose2 ${EXTRA_ARGS} if ${XML_OUTPUT} ; then mv test-results.xml ${CARLA_TEST_RESULTS_FOLDER}/smoke-tests-3.xml diff --git a/Util/BuildTools/Linux.mk b/Util/BuildTools/Linux.mk index 781aa848f..5c7d12057 100644 --- a/Util/BuildTools/Linux.mk +++ b/Util/BuildTools/Linux.mk @@ -84,25 +84,25 @@ CarlaUE4Editor: LibCarla.server.release .PHONY: PythonAPI PythonAPI: LibCarla.client.release osm2odr - @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --py3 + @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --py3 $(ARGS) PythonAPI.2: LibCarla.client.release osm2odr @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 PythonAPI.3: LibCarla.client.release osm2odr - @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py3 + @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py3 $(ARGS) PythonAPI.rebuild: LibCarla.client.release osm2odr @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --rebuild PythonAPI.rss: LibCarla.client.rss.release osm2odr - @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --py3 --rss + @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --py3 --rss $(ARGS) PythonAPI.rss.2: LibCarla.client.rss.release osm2odr @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --rss PythonAPI.rss.3: LibCarla.client.rss.release osm2odr - @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py3 --rss + @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py3 --rss $(ARGS) PythonAPI.rss.rebuild: LibCarla.client.rss.release osm2odr @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --rebuild --rss @@ -140,7 +140,7 @@ plugins: @${CARLA_BUILD_TOOLS_FOLDER}/Plugins.sh $(ARGS) setup: - @${CARLA_BUILD_TOOLS_FOLDER}/Setup.sh + @${CARLA_BUILD_TOOLS_FOLDER}/Setup.sh $(ARGS) ad-rss: @${CARLA_BUILD_TOOLS_FOLDER}/Ad-rss.sh diff --git a/Util/BuildTools/Package.sh b/Util/BuildTools/Package.sh index 2a7d6392d..508bbb8bc 100755 --- a/Util/BuildTools/Package.sh +++ b/Util/BuildTools/Package.sh @@ -16,7 +16,7 @@ DO_CLEAN_INTERMEDIATE=false PROPS_MAP_NAME=PropsMap PACKAGE_CONFIG=Shipping -OPTS=`getopt -o h --long help,config:,no-zip,clean-intermediate,packages: -n 'parse-options' -- "$@"` +OPTS=`getopt -o h --long help,config:,no-zip,clean-intermediate,packages,py3-version: -n 'parse-options' -- "$@"` if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi diff --git a/Util/BuildTools/Setup.sh b/Util/BuildTools/Setup.sh index cdbc62949..31e33864b 100755 --- a/Util/BuildTools/Setup.sh +++ b/Util/BuildTools/Setup.sh @@ -1,5 +1,22 @@ #! /bin/bash +# ============================================================================== +# -- Parse arguments ----------------------------------------------------------- +# ============================================================================== + +PY3_VERSION=3 + +while true; do + case "$1" in + --py3-version ) + PY3_VERSION="$2"; + shift + shift ;; + * ) + break ;; + esac +done + # ============================================================================== # -- Set up environment -------------------------------------------------------- # ============================================================================== @@ -139,7 +156,7 @@ else pushd ${BOOST_BASENAME}-source >/dev/null - py3="/usr/bin/env python3" + py3="/usr/bin/env python${PY3_VERSION}" py3_root=`${py3} -c "import sys; print(sys.prefix)"` pyv=`$py3 -c "import sys;x='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(x)";` ./bootstrap.sh \ @@ -149,9 +166,9 @@ else --with-python=${py3} --with-python-root=${py3_root} if ${TRAVIS} ; then - echo "using python : ${pyv} : ${py3_root}/bin/python3 ;" > ${HOME}/user-config.jam + echo "using python : ${pyv} : ${py3_root}/bin/python${PY3_VERSION} ;" > ${HOME}/user-config.jam else - echo "using python : ${pyv} : ${py3_root}/bin/python3 ;" > project-config.jam + echo "using python : ${pyv} : ${py3_root}/bin/python${PY3_VERSION} ;" > project-config.jam fi ./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} stage release