bat Dateien mit Errorlevel versehen. manage_interpreter.bat vereinfacht. Nur noch eine Umgebungsvar für den Python Interpreter im Netzwerk.
This commit is contained in:
+14
-3
@@ -1,4 +1,15 @@
|
||||
@echo off
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
python %PROJECT_LIB%\create_example.py %*
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
CALL manage_interpreter.bat activate
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Failed to activate Python environment
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%PROJECT%"
|
||||
|
||||
"%VIRTUAL_ENV%\Scripts\python.exe" -m lib.create_example %*
|
||||
set PYTHON_EXIT=%ERRORLEVEL%
|
||||
|
||||
popd
|
||||
CALL manage_interpreter.bat deactivate
|
||||
exit /b %PYTHON_EXIT%
|
||||
|
||||
+14
-3
@@ -1,4 +1,15 @@
|
||||
@echo off
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
python %PROJECT_LIB%\create_numbers.py %*
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
CALL manage_interpreter.bat activate
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Failed to activate Python environment
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%PROJECT%"
|
||||
|
||||
"%VIRTUAL_ENV%\Scripts\python.exe" -m lib.create_numbers %*
|
||||
set PYTHON_EXIT=%ERRORLEVEL%
|
||||
|
||||
popd
|
||||
CALL manage_interpreter.bat deactivate
|
||||
exit /b %PYTHON_EXIT%
|
||||
|
||||
+14
-3
@@ -1,4 +1,15 @@
|
||||
@echo off
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
python %PROJECT_LIB%\drawdxf.py %*
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
CALL manage_interpreter.bat activate
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Failed to activate Python environment
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%PROJECT%"
|
||||
|
||||
"%VIRTUAL_ENV%\Scripts\python.exe" -m lib.drawdxf %*
|
||||
set PYTHON_EXIT=%ERRORLEVEL%
|
||||
|
||||
popd
|
||||
CALL manage_interpreter.bat deactivate
|
||||
exit /b %PYTHON_EXIT%
|
||||
|
||||
+14
-3
@@ -1,4 +1,15 @@
|
||||
@echo off
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
python %PROJECT_LIB%\getpositions.py %*
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
CALL manage_interpreter.bat activate
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Failed to activate Python environment
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%PROJECT%"
|
||||
|
||||
"%VIRTUAL_ENV%\Scripts\python.exe" -m lib.getpositions %*
|
||||
set PYTHON_EXIT=%ERRORLEVEL%
|
||||
|
||||
popd
|
||||
CALL manage_interpreter.bat deactivate
|
||||
exit /b %PYTHON_EXIT%
|
||||
|
||||
+26
-21
@@ -1,30 +1,35 @@
|
||||
@echo off
|
||||
CALL setenv.bat
|
||||
IF DEFINED NETWORK_INTERPRETER_PATH (
|
||||
goto %~1_network
|
||||
|
||||
IF /I "%1"=="activate" GOTO activate
|
||||
IF /I "%1"=="deactivate" GOTO deactivate
|
||||
IF /I "%1"=="activate_interpreter" GOTO activate
|
||||
IF /I "%1"=="deactivate_interpreter" GOTO deactivate
|
||||
GOTO :eof
|
||||
|
||||
|
||||
:activate
|
||||
REM Interpreter wählen
|
||||
IF DEFINED NETWORK_PYTHON (
|
||||
SET PYTHON_EXE=%NETWORK_PYTHON%\python.exe
|
||||
) ELSE (
|
||||
goto %~1_local
|
||||
SET PYTHON_EXE=python
|
||||
)
|
||||
|
||||
:activate_interpreter_local
|
||||
IF NOT EXIST %PROJECT%\.venv CALL %PROJECT_BIN%\install_py.bat
|
||||
CALL %PROJECT%\.venv\Scripts\activate.bat
|
||||
goto :eof
|
||||
REM venv sicherstellen
|
||||
IF NOT EXIST "%PROJECT%\.venv" (
|
||||
"%PYTHON_EXE%" -m venv "%PROJECT%\.venv"
|
||||
)
|
||||
|
||||
:deactivate_interpreter_local
|
||||
deactivate
|
||||
goto :eof
|
||||
REM venv aktivieren
|
||||
CALL "%PROJECT%\.venv\Scripts\activate.bat"
|
||||
|
||||
:activate_interpreter_network
|
||||
SET OLD_PATH=%PATH%
|
||||
SET PATH=%NETWORK_INTERPRETER_PATH%;%PATH%
|
||||
CALL %PROJECT%\.venv\Scripts\activate.bat
|
||||
goto :eof
|
||||
REM Interpreter festnageln
|
||||
SET VIRTUAL_ENV_PYTHON=%PYTHON_EXE%
|
||||
GOTO :eof
|
||||
|
||||
:deactivate_interpreter_network
|
||||
SET PATH=%OLD_PATH%
|
||||
SET OLD_PATH=
|
||||
SET NETWORK_INTERPRETER_PATH=
|
||||
CALL %PROJECT%\.venv\Scripts\deactivate.bat
|
||||
goto :eof
|
||||
|
||||
:deactivate
|
||||
CALL "%PROJECT%\.venv\Scripts\deactivate.bat"
|
||||
SET VIRTUAL_ENV_PYTHON=
|
||||
GOTO :eof
|
||||
|
||||
+14
-3
@@ -1,4 +1,15 @@
|
||||
@echo off
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
python %PROJECT_LIB%\portalexport.py %*
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
CALL manage_interpreter.bat activate
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Failed to activate Python environment
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%PROJECT%"
|
||||
|
||||
"%VIRTUAL_ENV%\Scripts\python.exe" -m lib.portalexport %*
|
||||
set PYTHON_EXIT=%ERRORLEVEL%
|
||||
|
||||
popd
|
||||
CALL manage_interpreter.bat deactivate
|
||||
exit /b %PYTHON_EXIT%
|
||||
|
||||
+14
-3
@@ -1,4 +1,15 @@
|
||||
@echo off
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
python %PROJECT_LIB%\routing.py %*
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
CALL manage_interpreter.bat activate
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Failed to activate Python environment
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%PROJECT%"
|
||||
|
||||
"%VIRTUAL_ENV%\Scripts\python.exe" -m lib.routing %*
|
||||
set PYTHON_EXIT=%ERRORLEVEL%
|
||||
|
||||
popd
|
||||
CALL manage_interpreter.bat deactivate
|
||||
exit /b %PYTHON_EXIT%
|
||||
|
||||
+14
-3
@@ -65,12 +65,23 @@ echo Test-Parameter: %TEST_PARAMS%
|
||||
echo ============================================================================
|
||||
echo.
|
||||
|
||||
REM Wechsle ins Projektverzeichnis und führe run_tests.py aus
|
||||
cd /d "%PROJECT%"
|
||||
python "%PROJECT_LIB%\run_tests.py" %TEST_PARAMS%
|
||||
REM Python-Umgebung aktivieren
|
||||
CALL "%PROJECT_BIN%\manage_interpreter.bat" activate
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Failed to activate Python environment
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Wechsle ins Projektverzeichnis und führe run_tests.py aus
|
||||
pushd "%PROJECT%"
|
||||
|
||||
"%VIRTUAL_ENV%\Scripts\python.exe" -m lib.run_tests %TEST_PARAMS%
|
||||
set TEST_RESULT=%ERRORLEVEL%
|
||||
|
||||
popd
|
||||
REM Python-Umgebung deaktivieren
|
||||
CALL "%PROJECT_BIN%\manage_interpreter.bat" deactivate
|
||||
|
||||
echo.
|
||||
echo ============================================================================
|
||||
if %TEST_RESULT% EQU 0 (
|
||||
|
||||
+10
-6
@@ -4,24 +4,28 @@ REM Calls run_tests.py to execute all tests
|
||||
|
||||
call %~dp0setenv.bat
|
||||
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
CALL manage_interpreter.bat activate
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo Failed to activate the Python interpreter!
|
||||
pause
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
python %PROJECT_LIB%\run_tests.py %*
|
||||
pushd "%PROJECT%"
|
||||
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
"%VIRTUAL_ENV%\Scripts\python.exe" -m lib.run_tests %*
|
||||
set PYTHON_EXIT=%ERRORLEVEL%
|
||||
|
||||
popd
|
||||
CALL manage_interpreter.bat deactivate
|
||||
|
||||
if %PYTHON_EXIT% NEQ 0 (
|
||||
echo.
|
||||
echo Tests failed!
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
exit /B 1
|
||||
) else (
|
||||
echo.
|
||||
echo All tests passed!
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
exit /B 0
|
||||
)
|
||||
+5
-1
@@ -2,7 +2,10 @@
|
||||
REM falls Umlaute in den Pfaden sind:
|
||||
chcp 65001 > nul
|
||||
|
||||
set PROJECT=c:\kabellaengen
|
||||
REM ~dp0 steht für das Verzeichnis, in der diese Datei liegt
|
||||
pushd %~dp0\..
|
||||
|
||||
set PROJECT=%cd%
|
||||
set PROJECT_BIN=%PROJECT%\bin
|
||||
set PROJECT_CFG=%PROJECT%\cfg
|
||||
set PROJECT_DOC=%PROJECT%\doc
|
||||
@@ -32,6 +35,7 @@ if exist "%~dp0_setenv.bat" (
|
||||
|
||||
REM Prüfe ob PATH bereits erweitert wurde
|
||||
set PATH=%PROJECT_BIN%;%PATH%
|
||||
REM set NETWORK_PYTHON=TO_BE_SET
|
||||
|
||||
|
||||
popd
|
||||
|
||||
+11
-1
@@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PROJECT=$HOME/dxf-calculator/kabellaengen
|
||||
# Determine the project directory dynamically
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
export PROJECT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
export PROJECT_BIN="$PROJECT/bin"
|
||||
export PROJECT_CFG="$PROJECT/cfg"
|
||||
export PROJECT_DOC="$PROJECT/doc"
|
||||
@@ -8,6 +10,8 @@ export PROJECT_LIB="$PROJECT/lib"
|
||||
export PROJECT_DATA="$PROJECT/data"
|
||||
export PROJECT_WORK="$PROJECT/work"
|
||||
export PROJECT_TEST="$PROJECT/testdata"
|
||||
export PROJECT_LOG="$PROJECT/logs"
|
||||
export PROJECT_TRANSLATION="$PROJECT/translation"
|
||||
|
||||
# Linux executable instead of Windows .exe
|
||||
export SIVAS_TEILESTAMM="/usr/local/bin/KSbExcelExportSivasTeilestamm"
|
||||
@@ -16,6 +20,9 @@ export SIVAS_EXCEL_EXPORT_DIR="$PROJECT_DATA"
|
||||
# Create directories if they don't exist
|
||||
mkdir -p "$PROJECT/work"
|
||||
mkdir -p "$PROJECT/data"
|
||||
mkdir -p "$PROJECT/logs"
|
||||
mkdir -p "$PROJECT/translation"
|
||||
mkdir -p "$PROJECT/testdata"
|
||||
|
||||
# Samba shares (adjust mount points as needed)
|
||||
export PROJECT_IO_RESULTS=$PROJECT_WORK
|
||||
@@ -24,3 +31,6 @@ export INSTALL_DIR="$HOME/kabeltool"
|
||||
|
||||
# Add project bin to PATH (only if not already added)
|
||||
export PATH="$PROJECT_BIN:$PATH"
|
||||
|
||||
# Network Python interpreter (optional)
|
||||
# export NETWORK_PYTHON=/path/to/network/python
|
||||
|
||||
+14
-3
@@ -1,4 +1,15 @@
|
||||
@echo off
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
python %PROJECT_LIB%\translate.py %*
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
CALL manage_interpreter.bat activate
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Failed to activate Python environment
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%PROJECT%"
|
||||
|
||||
"%VIRTUAL_ENV%\Scripts\python.exe" -m lib.translate %*
|
||||
set PYTHON_EXIT=%ERRORLEVEL%
|
||||
|
||||
popd
|
||||
CALL manage_interpreter.bat deactivate
|
||||
exit /b %PYTHON_EXIT%
|
||||
Reference in New Issue
Block a user