Removed Python 2 from default builds.

This commit is contained in:
Axel 2020-09-02 15:19:07 +02:00 committed by bernat
parent 2829e63f1b
commit 172d947ed8
5 changed files with 72 additions and 140 deletions

10
Jenkinsfile vendored
View File

@ -43,7 +43,7 @@ pipeline
{
steps
{
sh 'make setup ARGS="--python3-version=3.7"'
sh 'make setup ARGS="--python-version=3.7"'
}
}
stage('ubuntu build')
@ -51,7 +51,7 @@ pipeline
steps
{
sh 'make LibCarla'
sh 'make PythonAPI ARGS="--python3-version=3.7"'
sh 'make PythonAPI ARGS="--python-version=3.7"'
sh 'make CarlaUE4Editor'
sh 'make examples'
}
@ -68,7 +68,7 @@ pipeline
{
steps
{
sh 'make check ARGS="--all --xml --python3-version=3.7"'
sh 'make check ARGS="--all --xml --python-version=3.7"'
}
post
{
@ -90,8 +90,8 @@ pipeline
{
steps
{
sh 'make package ARGS="--python3-version=3.7"'
sh 'make package ARGS="--packages=AdditionalMaps --clean-intermediate --python3-version=3.7"'
sh 'make package ARGS="--python-version=3.7"'
sh 'make package ARGS="--packages=AdditionalMaps --clean-intermediate --python-version=3.7"'
sh 'make examples ARGS="localhost 3654"'
}
post

View File

@ -11,42 +11,35 @@ export CXX=clang++-8
DOC_STRING="Build and package CARLA Python API."
USAGE_STRING="Usage: $0 [-h|--help] [--rebuild] [--py2] [--py3] [--clean] [--python3-version=VERSION]"
USAGE_STRING="Usage: $0 [-h|--help] [--rebuild] [--clean] [--python-version=VERSION]"
REMOVE_INTERMEDIATE=false
BUILD_FOR_PYTHON2=false
BUILD_FOR_PYTHON3=false
BUILD_RSS_VARIANT=false
BUILD_PYTHONAPI=true
OPTS=`getopt -o h --long help,rebuild,py2,py3,clean,rss,python3-version:,packages:,clean-intermediate,all,xml, -n 'parse-options' -- "$@"`
OPTS=`getopt -o h --long help,rebuild,clean,rss,python-version:,packages:,clean-intermediate,all,xml, -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
eval set -- "$OPTS"
PY3_VERSION=3
PY_VERSION=3
while [[ $# -gt 0 ]]; do
case "$1" in
--rebuild )
REMOVE_INTERMEDIATE=true;
BUILD_FOR_PYTHON2=true;
BUILD_FOR_PYTHON3=true;
BUILD_PYTHONAPI=true;
shift ;;
--py2 )
BUILD_FOR_PYTHON2=true;
shift ;;
--py3 )
BUILD_FOR_PYTHON3=true;
shift ;;
--python3-version )
PY3_VERSION="$2"
--python-version )
PY_VERSION="$2"
shift 2 ;;
--rss )
BUILD_RSS_VARIANT=true;
shift ;;
--clean )
REMOVE_INTERMEDIATE=true;
BUILD_PYTHONAPI=false;
shift ;;
-h | --help )
echo "$DOC_STRING"
@ -58,7 +51,7 @@ while [[ $# -gt 0 ]]; do
esac
done
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_FOR_PYTHON2} || ${BUILD_FOR_PYTHON3} ; }; then
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_PYTHONAPI} ; }; then
fatal_error "Nothing selected to be done."
fi
@ -87,19 +80,11 @@ if ${BUILD_RSS_VARIANT} ; then
export BUILD_RSS_VARIANT=${BUILD_RSS_VARIANT}
fi
if ${BUILD_FOR_PYTHON2} ; then
log "Building Python API for Python 2."
/usr/bin/env python2 setup.py bdist_egg
fi
if ${BUILD_FOR_PYTHON3} ; then
if ${BUILD_PYTHONAPI} ; then
log "Building Python API for Python 3."
/usr/bin/env python${PY3_VERSION} setup.py bdist_egg
/usr/bin/env python${PY_VERSION} setup.py bdist_egg
fi

View File

@ -9,7 +9,7 @@ source $(dirname "$0")/Environment.sh
DOC_STRING="Run unit tests."
USAGE_STRING=$(cat <<- END
Usage: $0 [-h|--help] [--gdb] [--xml] [--gtest_args=ARGS]
Usage: $0 [-h|--help] [--gdb] [--xml] [--gtest_args=ARGS] [--python-version=VERSION]
Then either ran all the tests
@ -18,7 +18,6 @@ Then either ran all the tests
Or choose one or more of the following
[--libcarla-release] [--libcarla-debug]
[--python-api-2] [--python-api-3]
[--benchmark]
You can also set the command-line arguments passed to GTest on a ".gtest"
@ -35,19 +34,17 @@ XML_OUTPUT=false
GTEST_ARGS=`sed -e 's/#.*$//g' ${CARLA_ROOT_FOLDER}/.gtest | sed -e '/^[[:space:]]*$/!s/^/--/g' | sed -e ':a;N;$!ba;s/\n/ /g'`
LIBCARLA_RELEASE=false
LIBCARLA_DEBUG=false
PYTHON_API_2=false
PYTHON_API_3=false
SMOKE_TESTS_2=false
SMOKE_TESTS_3=false
SMOKE_TESTS=false
PYTHON_API=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,python3-version:, -n 'parse-options' -- "$@"`
OPTS=`getopt -o h --long help,gdb,xml,gtest_args:,all,libcarla-release,libcarla-debug,python-api,smoke,benchmark,python-version:, -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
eval set -- "$OPTS"
PY3_VERSION=3
PY_VERSION=3
while [[ $# -gt 0 ]]; do
case "$1" in
@ -65,8 +62,7 @@ while [[ $# -gt 0 ]]; do
--all )
LIBCARLA_RELEASE=true;
LIBCARLA_DEBUG=true;
PYTHON_API_2=true;
PYTHON_API_3=true;
PYTHON_API=true;
shift ;;
--libcarla-release )
LIBCARLA_RELEASE=true;
@ -74,25 +70,19 @@ while [[ $# -gt 0 ]]; do
--libcarla-debug )
LIBCARLA_DEBUG=true;
shift ;;
--python-api-2 )
PYTHON_API_2=true;
--smoke )
SMOKE_TESTS=true;
shift ;;
--python-api-3 )
PYTHON_API_3=true;
shift ;;
--smoke-2 )
SMOKE_TESTS_2=true;
shift ;;
--smoke-3 )
SMOKE_TESTS_3=true;
--python-api )
PYTHON_API=true;
shift ;;
--benchmark )
LIBCARLA_RELEASE=true;
RUN_BENCHMARK=true;
GTEST_ARGS="--gtest_filter=benchmark*";
shift ;;
--python3-version )
PY3_VERSION="$2"
--python-version )
PY_VERSION="$2"
shift 2 ;;
-h | --help )
echo "$DOC_STRING"
@ -104,7 +94,7 @@ while [[ $# -gt 0 ]]; do
esac
done
if ! { ${LIBCARLA_RELEASE} || ${LIBCARLA_DEBUG} || ${PYTHON_API_2} || ${PYTHON_API_3} || ${SMOKE_TESTS_2} || ${SMOKE_TESTS_3}; }; then
if ! { ${LIBCARLA_RELEASE} || ${LIBCARLA_DEBUG} || ${PYTHON_API} || ${SMOKE_TESTS}; }; then
fatal_error "Nothing selected to be done."
fi
@ -186,23 +176,11 @@ else
EXTRA_ARGS=
fi
if ${PYTHON_API_2} ; then
log "Running Python API for Python 2 unit tests."
/usr/bin/env python2 -m nose2 ${EXTRA_ARGS}
if ${XML_OUTPUT} ; then
mv test-results.xml ${CARLA_TEST_RESULTS_FOLDER}/python-api-2.xml
fi
fi
if ${PYTHON_API_3} ; then
if ${PYTHON_API} ; then
log "Running Python API for Python 3 unit tests."
/usr/bin/env python${PY3_VERSION} -m nose2 ${EXTRA_ARGS}
/usr/bin/env python${PY_VERSION} -m nose2 ${EXTRA_ARGS}
if ${XML_OUTPUT} ; then
mv test-results.xml ${CARLA_TEST_RESULTS_FOLDER}/python-api-3.xml
@ -231,23 +209,11 @@ else
EXTRA_ARGS=
fi
if ${SMOKE_TESTS_2} ; then
log "Running smoke tests for Python 2."
/usr/bin/env python2 -m nose2 ${EXTRA_ARGS}
if ${XML_OUTPUT} ; then
mv test-results.xml ${CARLA_TEST_RESULTS_FOLDER}/smoke-tests-2.xml
fi
fi
if ${SMOKE_TESTS_3} ; then
if ${SMOKE_TESTS} ; then
log "Running smoke tests for Python 3."
/usr/bin/env python${PY3_VERSION} -m nose2 ${EXTRA_ARGS}
/usr/bin/env python${PY_VERSION} -m nose2 ${EXTRA_ARGS}
if ${XML_OUTPUT} ; then
mv test-results.xml ${CARLA_TEST_RESULTS_FOLDER}/smoke-tests-3.xml

View File

@ -58,20 +58,20 @@ check.LibCarla.release: LibCarla.release
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --libcarla-release $(ARGS)
check.PythonAPI: PythonAPI
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --python-api-2 --python-api-3 $(ARGS)
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --python-api $(ARGS)
check.PythonAPI.2: PythonAPI.2
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --python-api-2 $(ARGS)
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --python-api --python-version=2 $(ARGS)
check.PythonAPI.3: PythonAPI.3
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --python-api-3 $(ARGS)
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --python-api --python-version=3 $(ARGS)
benchmark: LibCarla.release
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --benchmark $(ARGS)
@cat profiler.csv
smoke_tests:
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --smoke-2 --smoke-3 $(ARGS)
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --smoke $(ARGS)
examples:
@for D in ${CARLA_EXAMPLES_FOLDER}/*; do [ -d "$${D}" ] && make -C $${D} build; done
@ -84,28 +84,28 @@ CarlaUE4Editor: LibCarla.server.release
.PHONY: PythonAPI
PythonAPI: LibCarla.client.release osm2odr
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --py3 $(ARGS)
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh $(ARGS)
PythonAPI.2: LibCarla.client.release osm2odr
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --python-version=2
PythonAPI.3: LibCarla.client.release osm2odr
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py3 $(ARGS)
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --python-version=3
PythonAPI.rebuild: LibCarla.client.release osm2odr
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --rebuild $(ARGS)
PythonAPI.rss: LibCarla.client.rss.release osm2odr
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --py3 --rss $(ARGS)
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --rss $(ARGS)
PythonAPI.rss.2: LibCarla.client.rss.release osm2odr
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --rss
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --python-version=2 --rss
PythonAPI.rss.3: LibCarla.client.rss.release osm2odr
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py3 --rss $(ARGS)
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --python-version=3 --rss
PythonAPI.rss.rebuild: LibCarla.client.rss.release osm2odr
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --rebuild --rss
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --rebuild --rss $(ARGS)
PythonAPI.docs:
@python PythonAPI/docs/doc_gen.py

View File

@ -6,20 +6,20 @@
DOC_STRING="Download and install the required libraries for carla."
USAGE_STRING="Usage: $0 [--python3-version=VERSION]"
USAGE_STRING="Usage: $0 [--python-version=VERSION]"
OPTS=`getopt -o h --long help,rebuild,py2,py3,clean,rss,python3-version:,packages:,clean-intermediate,all,xml -n 'parse-options' -- "$@"`
OPTS=`getopt -o h --long help,rebuild,clean,rss,python-version:,packages:,clean-intermediate,all,xml -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
eval set -- "$OPTS"
PY3_VERSION=3
PY_VERSION=3
while [[ $# -gt 0 ]]; do
case "$1" in
--python3-version )
PY3_VERSION="$2";
--python-version )
PY_VERSION="$2";
shift 2 ;;
-h | --help )
echo "$DOC_STRING"
@ -106,10 +106,19 @@ BOOST_BASENAME="boost-${BOOST_VERSION}-${CXX_TAG}"
BOOST_INCLUDE=${PWD}/${BOOST_BASENAME}-install/include
BOOST_LIBPATH=${PWD}/${BOOST_BASENAME}-install/lib
if [[ -d "${BOOST_BASENAME}-install" ]] ; then
log "${BOOST_BASENAME} already installed."
else
SHOULD_BUILD_BOOST=true
PYTHON_VERSION=$(/usr/bin/env python${PY_VERSION} -V)
LIB_NAME=${PYTHON_VERSION:7:3}
LIB_NAME=${LIB_NAME//.}
if [[ -d "${BOOST_BASENAME}-install" ]] ; then
if [ -f "${BOOST_BASENAME}-install/lib/libboost_python${LIB_NAME}.a" ] ; then
SHOULD_BUILD_BOOST=false
log "${BOOST_BASENAME} already installed."
fi
fi
if { ${SHOULD_BUILD_BOOST} ; } ; then
rm -Rf ${BOOST_BASENAME}-source
BOOST_PACKAGE_BASENAME=boost_${BOOST_VERSION//./_}
@ -122,7 +131,7 @@ else
wget "https://carla-releases.s3.eu-west-3.amazonaws.com/Backup/${BOOST_PACKAGE_BASENAME}.tar.gz" || true
fi
log "Extracting boost for Python 2."
log "Extracting boost for Python ${PY_VERSION}."
tar -xzf ${BOOST_PACKAGE_BASENAME}.tar.gz
mkdir -p ${BOOST_BASENAME}-install/include
mv ${BOOST_PACKAGE_BASENAME} ${BOOST_BASENAME}-source
@ -136,53 +145,19 @@ else
BOOST_TOOLSET="clang-8.0"
BOOST_CFLAGS="-fPIC -std=c++14 -DBOOST_ERROR_CODE_HEADER_ONLY"
py2="/usr/bin/env python2"
py2_root=`${py2} -c "import sys; print(sys.prefix)"`
pyv=`$py2 -c "import sys;x='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(x)";`
./bootstrap.sh \
--with-toolset=clang \
--prefix=../boost-install \
--with-libraries=python,filesystem,system,program_options \
--with-python=${py2} --with-python-root=${py2_root}
if ${TRAVIS} ; then
echo "using python : ${pyv} : ${py2_root}/bin/python2 ;" > ${HOME}/user-config.jam
else
echo "using python : ${pyv} : ${py2_root}/bin/python2 ;" > project-config.jam
fi
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} stage release
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} install
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} --clean-all
# Get rid of python2 build artifacts completely & do a clean build for python3
popd >/dev/null
rm -Rf ${BOOST_BASENAME}-source
log "Extracting boost for Python 3."
tar -xzf ${BOOST_PACKAGE_BASENAME}.tar.gz
mkdir -p ${BOOST_BASENAME}-install/include
mv ${BOOST_PACKAGE_BASENAME} ${BOOST_BASENAME}-source
# Boost patch for exception handling
cp "${CARLA_BUILD_FOLDER}/../Util/BoostFiles/rational.hpp" "${BOOST_BASENAME}-source/boost/rational.hpp"
cp "${CARLA_BUILD_FOLDER}/../Util/BoostFiles/read.hpp" "${BOOST_BASENAME}-source/boost/geometry/io/wkt/read.hpp"
# ---
pushd ${BOOST_BASENAME}-source >/dev/null
py3="/usr/bin/env python${PY3_VERSION}"
py3="/usr/bin/env python${PY_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 \
--with-toolset=clang \
--prefix=../boost-install \
--with-libraries=python \
--with-libraries=python,filesystem,system,program_options \
--with-python=${py3} --with-python-root=${py3_root}
if ${TRAVIS} ; then
echo "using python : ${pyv} : ${py3_root}/bin/python${PY3_VERSION} ;" > ${HOME}/user-config.jam
echo "using python : ${pyv} : ${py3_root}/bin/python${PY_VERSION} ;" > ${HOME}/user-config.jam
else
echo "using python : ${pyv} : ${py3_root}/bin/python${PY3_VERSION} ;" > project-config.jam
echo "using python : ${pyv} : ${py3_root}/bin/python${PY_VERSION} ;" > project-config.jam
fi
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} stage release
@ -198,6 +173,12 @@ else
cp "${CARLA_BUILD_FOLDER}/../Util/BoostFiles/read.hpp" "${BOOST_BASENAME}-install/include/boost/geometry/io/wkt/read.hpp"
# ---
# Install boost dependencies
mkdir -p "${LIBCARLA_INSTALL_CLIENT_FOLDER}/include/system"
mkdir -p "${LIBCARLA_INSTALL_CLIENT_FOLDER}/lib"
cp -rf ${BOOST_BASENAME}-install/include/* ${LIBCARLA_INSTALL_CLIENT_FOLDER}/include/system
cp -rf ${BOOST_BASENAME}-install/lib/* ${LIBCARLA_INSTALL_CLIENT_FOLDER}/lib
fi
unset BOOST_BASENAME