:: Generated by vinca http://github.com/RoboStack/vinca.
:: DO NOT EDIT!
setlocal

set "PYTHONPATH=%LIBRARY_PREFIX%\lib\site-packages;%SP_DIR%"

:: Rattler-build will not set the SRC_DIR anymore so we set it through templating
set "SRC_DIR=@SRC_DIR@"

pushd %SRC_DIR%
set "PKG_NAME_SHORT=%PKG_NAME:*ros-@DISTRO@-=%"
set "PKG_NAME_SHORT=%PKG_NAME_SHORT:-=_%"

:: If there is a setup.cfg that contains install-scripts then use pip to install
findstr install[-_]scripts setup.cfg
if "%errorlevel%" == "0" (
    %PYTHON% setup.py install --single-version-externally-managed --record=files.txt ^
        --prefix=%LIBRARY_PREFIX% ^
        --install-lib=%SP_DIR% ^
         --install-scripts=%LIBRARY_PREFIX%\lib\%PKG_NAME_SHORT%
) else (
    %PYTHON% setup.py install --single-version-externally-managed --record=files.txt ^
        --prefix=%LIBRARY_PREFIX% ^
        --install-lib=%SP_DIR% ^
        --install-scripts=%LIBRARY_PREFIX%\bin
)

:: Cleanup build artifacts
for /d %%d in (*.egg-info) do rmdir /s /q "%%d" 2>nul
if exist build rmdir /s /q build 2>nul
if exist files.txt del /q files.txt 2>nul


if errorlevel 1 exit 1
