Remove python api deprecated ue4 build system (#7459)

This commit is contained in:
Xavier Solé Nogués 2024-04-17 15:19:41 +02:00 committed by GitHub
parent e88726ad17
commit 751dee75d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 281 deletions

View File

@ -1,158 +0,0 @@
@echo off
setlocal
rem BAT script that creates the client python api of LibCarla (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set FILE_N=-[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
rem ============================================================================
rem -- Parse arguments ---------------------------------------------------------
rem ============================================================================
set DOC_STRING=Build and package CARLA Python API.
set "USAGE_STRING=Usage: %FILE_N% [-h^|--help] [--rebuild] [--clean]"
set REMOVE_INTERMEDIATE=false
set BUILD_FOR_PYTHON2=false
set BUILD_FOR_PYTHON3=false
:arg-parse
if not "%1"=="" (
if "%1"=="--rebuild" (
set REMOVE_INTERMEDIATE=true
rem We don't provide support for py2 right now
set BUILD_FOR_PYTHON2=false
set BUILD_FOR_PYTHON3=true
)
if "%1"=="--py2" (
set BUILD_FOR_PYTHON2=true
)
if "%1"=="--py3" (
set BUILD_FOR_PYTHON3=true
)
if "%1"=="--clean" (
set REMOVE_INTERMEDIATE=true
)
if "%1"=="-h" (
echo %DOC_STRING%
echo %USAGE_STRING%
GOTO :eof
)
if "%1"=="--help" (
echo %DOC_STRING%
echo %USAGE_STRING%
GOTO :eof
)
shift
goto :arg-parse
)
set PYTHON_LIB_PATH=%ROOT_PATH:/=\%PythonAPI\carla\
if %REMOVE_INTERMEDIATE% == false (
if %BUILD_FOR_PYTHON3% == false (
if %BUILD_FOR_PYTHON2% == false (
echo Nothing selected to be done.
goto :eof
)
)
)
if %REMOVE_INTERMEDIATE% == true (
rem Remove directories
for %%G in (
"%PYTHON_LIB_PATH%build",
"%PYTHON_LIB_PATH%dist",
"%PYTHON_LIB_PATH%source\carla.egg-info"
) do (
if exist %%G (
echo %FILE_N% Cleaning %%G
rmdir /s/q %%G
)
)
if %BUILD_FOR_PYTHON3% == false (
if %BUILD_FOR_PYTHON2% == false (
goto good_exit
)
)
)
cd "%PYTHON_LIB_PATH%"
rem if exist "%PYTHON_LIB_PATH%dist" goto already_installed
rem ============================================================================
rem -- Check for py ------------------------------------------------------------
rem ============================================================================
where py 1>nul
if %errorlevel% neq 0 goto error_py
rem Build for Python 2
rem
if %BUILD_FOR_PYTHON2%==true (
goto py2_not_supported
)
rem Build for Python 3
rem
if %BUILD_FOR_PYTHON3%==true (
echo Building Python API for Python 3.
py -3 setup.py bdist_egg bdist_wheel
if %errorlevel% neq 0 goto error_build_wheel
)
goto success
rem ============================================================================
rem -- Messages and Errors -----------------------------------------------------
rem ============================================================================
:success
echo.
if %BUILD_FOR_PYTHON3%==true echo %FILE_N% Carla lib for python has been successfully installed in "%PYTHON_LIB_PATH%dist"!
goto good_exit
:already_installed
echo.
echo %FILE_N% [ERROR] Already installed in "%PYTHON_LIB_PATH%dist"
goto good_exit
:py2_not_supported
echo.
echo %FILE_N% [ERROR] Python 2 is not currently suported in Windows.
goto bad_exit
:error_py
echo.
echo %FILE_N% [ERROR] An error ocurred while executing the py.
echo %FILE_N% [ERROR] Possible causes:
echo %FILE_N% [ERROR] - Make sure "py" is installed.
echo %FILE_N% [ERROR] - py = python launcher. This utility is bundled with Python installation but not installed by default.
echo %FILE_N% [ERROR] - Make sure it is available on your Windows "py".
goto bad_exit
:error_build_wheel
echo.
echo %FILE_N% [ERROR] An error occurred while building the wheel file.
goto bad_exit
:good_exit
endlocal
exit /b 0
:bad_exit
endlocal
exit /b %errorlevel%

View File

@ -1,123 +0,0 @@
#! /bin/bash
# ==============================================================================
# -- Parse arguments -----------------------------------------------------------
# ==============================================================================
DOC_STRING="Build and package CARLA Python API."
USAGE_STRING="Usage: $0 [-h|--help] [--rebuild] [--clean] [--python-version=VERSION] [--target-wheel-platform=PLATFORM]"
REMOVE_INTERMEDIATE=false
BUILD_RSS_VARIANT=false
BUILD_PYTHONAPI=true
OPTS=`getopt -o h --long help,config:,rebuild,clean,rss,carsim,python-version:,target-wheel-platform:,packages:,clean-intermediate,all,xml,target-archive:, -n 'parse-options' -- "$@"`
eval set -- "$OPTS"
PY_VERSION_LIST=3
TARGET_WHEEL_PLATFORM=
while [[ $# -gt 0 ]]; do
case "$1" in
--rebuild )
REMOVE_INTERMEDIATE=true;
BUILD_PYTHONAPI=true;
shift ;;
--python-version )
PY_VERSION_LIST="$2"
shift 2 ;;
--target-wheel-platform )
TARGET_WHEEL_PLATFORM="$2"
shift 2 ;;
--rss )
BUILD_RSS_VARIANT=true;
shift ;;
--clean )
REMOVE_INTERMEDIATE=true;
BUILD_PYTHONAPI=false;
shift ;;
-h | --help )
echo "$DOC_STRING"
echo "$USAGE_STRING"
exit 1
;;
* )
shift ;;
esac
done
export CC="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang"
export CXX="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang++"
export PATH="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin:$PATH"
source $(dirname "$0")/Environment.sh
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_PYTHONAPI} ; }; then
fatal_error "Nothing selected to be done."
fi
# Convert comma-separated string to array of unique elements.
IFS="," read -r -a PY_VERSION_LIST <<< "${PY_VERSION_LIST}"
pushd "${CARLA_PYTHONAPI_SOURCE_FOLDER}" >/dev/null
# ==============================================================================
# -- Clean intermediate files --------------------------------------------------
# ==============================================================================
if ${REMOVE_INTERMEDIATE} ; then
log "Cleaning intermediate files and folders."
rm -Rf build dist source/carla.egg-info
find source -name "*.so" -delete
find source -name "__pycache__" -type d -exec rm -r "{}" \;
fi
# ==============================================================================
# -- Build API -----------------------------------------------------------------
# ==============================================================================
if ${BUILD_RSS_VARIANT} ; then
export BUILD_RSS_VARIANT=${BUILD_RSS_VARIANT}
fi
if ${BUILD_PYTHONAPI} ; then
# Add patchelf to the path. Auditwheel relies on patchelf to repair ELF files.
export PATH="${LIBCARLA_INSTALL_CLIENT_FOLDER}/bin:${PATH}"
CODENAME=$(cat /etc/os-release | grep VERSION_CODENAME)
if [[ ! -z ${TARGET_WHEEL_PLATFORM} ]] && [[ ${CODENAME#*=} != "bionic" ]] ; then
log "A target platform has been specified but you are not using a compatible linux distribution. The wheel repair step will be skipped"
TARGET_WHEEL_PLATFORM=
fi
for PY_VERSION in ${PY_VERSION_LIST[@]} ; do
log "Building Python API for Python ${PY_VERSION}."
if [[ -z ${TARGET_WHEEL_PLATFORM} ]] ; then
/usr/bin/env python${PY_VERSION} setup.py bdist_egg bdist_wheel --dist-dir dist/.tmp
cp dist/.tmp/$(ls dist/.tmp | grep .whl) dist
else
/usr/bin/env python${PY_VERSION} setup.py bdist_egg bdist_wheel --dist-dir dist/.tmp --plat ${TARGET_WHEEL_PLATFORM}
/usr/bin/env python3 -m auditwheel repair --plat ${TARGET_WHEEL_PLATFORM} --wheel-dir dist dist/.tmp/$(ls dist/.tmp | grep .whl)
fi
rm -rf dist/.tmp
done
fi
# ==============================================================================
# -- ...and we are done --------------------------------------------------------
# ==============================================================================
popd >/dev/null
log "Success!"