mkpyproject funktioniert jetzt auch ohne python interpreter
This commit is contained in:
+76
-33
@@ -4,44 +4,87 @@ REM mkpyproject.bat - Standard Python Projekt Template erstellen
|
|||||||
REM ================================================================
|
REM ================================================================
|
||||||
REM Verwendung: mkpyproject.bat <projektname> [zielverzeichnis]
|
REM Verwendung: mkpyproject.bat <projektname> [zielverzeichnis]
|
||||||
REM ================================================================
|
REM ================================================================
|
||||||
|
setlocal enableextensions
|
||||||
|
|
||||||
REM Umgebung laden
|
|
||||||
call "%~dp0setenv.bat"
|
call "%~dp0setenv.bat"
|
||||||
|
|
||||||
REM Pruefen ob Umgebung gesetzt wurde
|
set "PROJECT_NAME=%~1"
|
||||||
if not defined PV_LIB (
|
set "TARGET_BASE=%~2"
|
||||||
echo.
|
|
||||||
echo FEHLER: Umgebung konnte nicht geladen werden!
|
if "%PROJECT_NAME%"=="" (
|
||||||
echo setenv.bat hat die Variablen nicht gesetzt.
|
echo FEHLER: Kein Projektname angegeben.
|
||||||
echo.
|
echo Verwendung: mkpyproject.bat ^<projektname^> [zielverzeichnis]
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
REM Pruefen ob Python verfuegbar ist
|
if "%TARGET_BASE%"=="" set "TARGET_BASE=."
|
||||||
py --version >nul 2>&1
|
|
||||||
if errorlevel 1 (
|
REM Grossbuchstaben via PowerShell
|
||||||
python --version >nul 2>&1
|
for /f "delims=" %%i in ('powershell -NoProfile -Command "'%PROJECT_NAME%'.ToUpper()"') do set "PROJECT_UPPER=%%i"
|
||||||
if errorlevel 1 (
|
|
||||||
echo.
|
set "TARGET_DIR=%TARGET_BASE%\%PROJECT_NAME%"
|
||||||
echo ================================================================
|
set "TMPL_DIR=%TOOLS_TEMPLATES%\mkpyproject"
|
||||||
echo FEHLER: Kein Python-Interpreter gefunden!
|
|
||||||
echo ================================================================
|
if exist "%TARGET_DIR%" (
|
||||||
echo.
|
echo FEHLER: Verzeichnis '%TARGET_DIR%' existiert bereits.
|
||||||
echo Weder 'py' noch 'python' konnten ausgefuehrt werden.
|
exit /b 1
|
||||||
echo.
|
|
||||||
echo Bitte sicherstellen, dass Python installiert ist und der
|
|
||||||
echo Pfad zur python.exe in der PATH-Umgebungsvariable enthalten ist.
|
|
||||||
echo.
|
|
||||||
echo 1. Python installieren: https://www.python.org/downloads/
|
|
||||||
echo 2. Bei der Installation "Add Python to PATH" aktivieren
|
|
||||||
echo 3. Oder manuell den Pfad hinzufuegen:
|
|
||||||
echo set PATH=%%PATH%%;C:\Python312
|
|
||||||
echo.
|
|
||||||
echo ================================================================
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
python "%PV_LIB%\mkpyproject.py" %*
|
|
||||||
goto :eof
|
|
||||||
)
|
)
|
||||||
|
|
||||||
py "%PV_LIB%\mkpyproject.py" %*
|
echo ================================================================
|
||||||
|
echo Erstelle Python-Projekt: %PROJECT_NAME%
|
||||||
|
echo Zielverzeichnis: %TARGET_DIR%
|
||||||
|
echo ================================================================
|
||||||
|
|
||||||
|
REM --- Verzeichnisse ---
|
||||||
|
for %%d in (bin cfg data doc examples lib log results tests) do (
|
||||||
|
mkdir "%TARGET_DIR%\%%d"
|
||||||
|
)
|
||||||
|
echo [OK] Verzeichnisse angelegt
|
||||||
|
|
||||||
|
REM --- Umgebungsvariablen fuer PowerShell ---
|
||||||
|
set "MKP_NAME=%PROJECT_NAME%"
|
||||||
|
set "MKP_UPPER=%PROJECT_UPPER%"
|
||||||
|
set "MKP_TARGET=%TARGET_DIR%"
|
||||||
|
set "MKP_TMPL=%TMPL_DIR%"
|
||||||
|
for /f "delims=" %%y in ('powershell -NoProfile -Command "(Get-Date).Year"') do set "MKP_YEAR=%%y"
|
||||||
|
|
||||||
|
REM --- bin/ Skripte ---
|
||||||
|
call :copy_tmpl "bin\setenv.bat"
|
||||||
|
call :copy_tmpl "bin\setenv.sh"
|
||||||
|
call :copy_tmpl "bin\install_py.bat"
|
||||||
|
call :copy_tmpl "bin\install_py.sh"
|
||||||
|
call :copy_tmpl "bin\activate_venv.bat"
|
||||||
|
call :copy_tmpl "bin\activate_venv.sh"
|
||||||
|
call :copy_tmpl "bin\get_cmd.bat"
|
||||||
|
call :copy_tmpl "bin\get_cmd.sh"
|
||||||
|
echo [OK] bin/ Skripte erstellt
|
||||||
|
|
||||||
|
call :copy_tmpl ".gitignore"
|
||||||
|
echo [OK] .gitignore erstellt
|
||||||
|
|
||||||
|
call :copy_tmpl "LICENSE"
|
||||||
|
echo [OK] LICENSE erstellt
|
||||||
|
|
||||||
|
call :copy_tmpl "README.md"
|
||||||
|
echo [OK] README.md erstellt
|
||||||
|
|
||||||
|
call :copy_tmpl "requirements.txt"
|
||||||
|
echo [OK] requirements.txt erstellt
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ================================================================
|
||||||
|
echo FERTIG! Projekt '%PROJECT_NAME%' wurde erstellt.
|
||||||
|
echo ================================================================
|
||||||
|
echo.
|
||||||
|
echo Naechste Schritte:
|
||||||
|
echo Windows: bin\install_py.bat
|
||||||
|
echo Linux: bash bin/install_py.sh
|
||||||
|
echo.
|
||||||
|
endlocal
|
||||||
|
exit /b 0
|
||||||
|
|
||||||
|
:copy_tmpl
|
||||||
|
REM %~1 = relative Pfad (z.B. "bin\setenv.bat")
|
||||||
|
set "MKP_REL=%~1"
|
||||||
|
powershell -NoProfile -Command "$s=Join-Path $env:MKP_TMPL $env:MKP_REL; $d=Join-Path $env:MKP_TARGET $env:MKP_REL; $c=Get-Content $s -Raw -Encoding UTF8; $c=$c -replace '__PROJECT_NAME__',$env:MKP_NAME; $c=$c -replace '__PROJECT_UPPER__',$env:MKP_UPPER; $c=$c -replace '__YEAR__',$env:MKP_YEAR; Set-Content -Path $d -Value $c -NoNewline -Encoding UTF8"
|
||||||
|
exit /b 0
|
||||||
|
|||||||
+17
-10
@@ -4,35 +4,42 @@ REM ================================================================
|
|||||||
REM TOOLS - Umgebungsvariablen Setup
|
REM TOOLS - Umgebungsvariablen Setup
|
||||||
REM ================================================================
|
REM ================================================================
|
||||||
|
|
||||||
|
if defined TOOLS_BIN (
|
||||||
|
echo TOOLS Umgebung bereits gesetzt.
|
||||||
|
goto :show
|
||||||
|
)
|
||||||
|
|
||||||
echo Setting up environment variables for TOOLS ...
|
echo Setting up environment variables for TOOLS ...
|
||||||
|
|
||||||
REM Basis-Projektpfad (absolut)
|
REM Basis-Projektpfad (absolut)
|
||||||
set "PROJECT=c:\tools"
|
set "PROJECT=c:\tools"
|
||||||
|
|
||||||
REM Pfade fuer verschiedene Komponenten
|
REM Pfade fuer verschiedene Komponenten
|
||||||
set "PV_BIN=%PROJECT%\bin"
|
set "TOOLS_BIN=%PROJECT%\bin"
|
||||||
set "PV_LIB=%PROJECT%\lib"
|
set "TOOLS_LIB=%PROJECT%\lib"
|
||||||
|
set "TOOLS_TEMPLATES=%PROJECT%\templates"
|
||||||
|
|
||||||
REM Python-Pfad erweitern (nur wenn noch nicht vorhanden)
|
REM Python-Pfad erweitern (nur wenn noch nicht vorhanden)
|
||||||
echo %PYTHONPATH% | find /i "%PV_LIB%" >nul
|
echo %PYTHONPATH% | find /i "%TOOLS_LIB%" >nul
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
set "PYTHONPATH=%PV_LIB%;%PYTHONPATH%"
|
set "PYTHONPATH=%TOOLS_LIB%;%PYTHONPATH%"
|
||||||
) else (
|
|
||||||
REM Path ist bereits in PYTHONPATH enthalten, nicht erneut hinzufuegen
|
|
||||||
)
|
)
|
||||||
|
|
||||||
REM Ordner erstellen falls sie nicht existieren
|
REM Ordner erstellen falls sie nicht existieren
|
||||||
if not exist "%PV_BIN%" mkdir "%PV_BIN%"
|
if not exist "%TOOLS_BIN%" mkdir "%TOOLS_BIN%"
|
||||||
if not exist "%PV_LIB%" mkdir "%PV_LIB%"
|
if not exist "%TOOLS_LIB%" mkdir "%TOOLS_LIB%"
|
||||||
|
if not exist "%TOOLS_TEMPLATES%" mkdir "%TOOLS_TEMPLATES%"
|
||||||
|
|
||||||
REM Umgebungsvariablen anzeigen
|
REM Umgebungsvariablen anzeigen
|
||||||
|
:show
|
||||||
echo.
|
echo.
|
||||||
echo ================================================================
|
echo ================================================================
|
||||||
echo TOOLS ENVIRONMENT SETUP COMPLETE
|
echo TOOLS ENVIRONMENT SETUP COMPLETE
|
||||||
echo ================================================================
|
echo ================================================================
|
||||||
echo PROJECT = %PROJECT%
|
echo PROJECT = %PROJECT%
|
||||||
echo PV_BIN = %PV_BIN%
|
echo TOOLS_BIN = %TOOLS_BIN%
|
||||||
echo PV_LIB = %PV_LIB%
|
echo TOOLS_LIB = %TOOLS_LIB%
|
||||||
|
echo TOOLS_TEMPLATES = %TOOLS_TEMPLATES%
|
||||||
echo PYTHONPATH = %PYTHONPATH%
|
echo PYTHONPATH = %PYTHONPATH%
|
||||||
echo ================================================================
|
echo ================================================================
|
||||||
echo.
|
echo.
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
# ---> Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
*.so
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
cover/
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
.ropeproject
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
.pyre/
|
||||||
|
.pytype/
|
||||||
|
cython_debug/
|
||||||
|
.pdm.toml
|
||||||
|
__pypackages__/
|
||||||
|
/site-packages
|
||||||
|
/site
|
||||||
|
.ipynb_checkpoints
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# Benutzerdefiniert
|
||||||
|
/data
|
||||||
|
/work
|
||||||
|
/log
|
||||||
|
/results
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) __YEAR__ Michael Stangl, on GitHub mistamichael
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# __PROJECT_NAME__
|
||||||
|
|
||||||
|
> Kurze Projektbeschreibung hier eintragen.
|
||||||
|
|
||||||
|
## Projektstruktur
|
||||||
|
|
||||||
|
__PROJECT_NAME__/
|
||||||
|
bin/ Skripte zur Umgebungsverwaltung
|
||||||
|
setenv.bat/.sh Umgebungsvariablen setzen
|
||||||
|
install_py.bat/.sh venv erstellen + pip install
|
||||||
|
activate_venv.bat/.sh venv aktivieren
|
||||||
|
get_cmd.bat/.sh Shell mit Umgebung oeffnen
|
||||||
|
cfg/ Konfigurationsdateien (INI/JSON)
|
||||||
|
data/ Eingabedaten (nicht im Git)
|
||||||
|
doc/ Dokumentation
|
||||||
|
examples/ Beispieldateien
|
||||||
|
lib/ Python-Quellcode / Bibliothek
|
||||||
|
log/ Log-Dateien (nicht im Git)
|
||||||
|
results/ Ergebnisse / Ausgaben (nicht im Git)
|
||||||
|
tests/ Unit Tests
|
||||||
|
.gitignore
|
||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
|
requirements.txt
|
||||||
|
|
||||||
|
## Umgebungsvariablen
|
||||||
|
|
||||||
|
| Variable | Beschreibung |
|
||||||
|
|----------------|---------------------------|
|
||||||
|
| `PROJECT` | Wurzelverzeichnis |
|
||||||
|
| `PV_BIN` | Skriptverzeichnis |
|
||||||
|
| `PV_LIB` | Python-Quellcode |
|
||||||
|
| `PV_CFG` | Konfigurationsdateien |
|
||||||
|
| `PV_DATA` | Eingabedaten |
|
||||||
|
| `PV_LOG` | Log-Dateien |
|
||||||
|
| `PV_RESULTS` | Ergebnisse |
|
||||||
|
| `PV_EXAMPLES` | Beispieldateien |
|
||||||
|
| `PYTHONPATH` | Erweitert um `PV_LIB` |
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Voraussetzungen
|
||||||
|
|
||||||
|
- Python 3.10 oder hoeher
|
||||||
|
|
||||||
|
### Setup (Windows)
|
||||||
|
|
||||||
|
bin\install_py.bat
|
||||||
|
|
||||||
|
### Setup (Linux / macOS)
|
||||||
|
|
||||||
|
bash bin/install_py.sh
|
||||||
|
|
||||||
|
## Nutzung
|
||||||
|
|
||||||
|
### Umgebung setzen
|
||||||
|
|
||||||
|
bin\setenv.bat # Windows
|
||||||
|
source bin/setenv.sh # Linux / macOS
|
||||||
|
|
||||||
|
### Shell mit gesetzten Variablen oeffnen
|
||||||
|
|
||||||
|
bin\get_cmd.bat # Windows
|
||||||
|
source bin/get_cmd.sh # Linux / macOS
|
||||||
|
|
||||||
|
### venv aktivieren
|
||||||
|
|
||||||
|
bin\activate_venv.bat # Windows
|
||||||
|
source bin/activate_venv.sh # Linux / macOS
|
||||||
|
|
||||||
|
## Lizenz
|
||||||
|
|
||||||
|
MIT License - siehe LICENSE
|
||||||
|
|
||||||
|
## Autor
|
||||||
|
|
||||||
|
Michael Stangl (GitHub: mistamichael)
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
@echo off
|
||||||
|
REM ================================================================
|
||||||
|
REM __PROJECT_UPPER__ - Python Virtual Environment aktivieren
|
||||||
|
REM ================================================================
|
||||||
|
|
||||||
|
call "%~dp0setenv.bat"
|
||||||
|
|
||||||
|
if not exist "%PROJECT%\.venv" (
|
||||||
|
echo FEHLER: Virtual environment nicht gefunden.
|
||||||
|
echo Bitte zuerst bin\install_py.bat ausfuehren.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
call "%PROJECT%\.venv\Scripts\activate.bat"
|
||||||
|
echo Virtuelle Umgebung aktiviert.
|
||||||
|
echo Python-Version:
|
||||||
|
python --version
|
||||||
|
echo.
|
||||||
|
echo Installierte Pakete:
|
||||||
|
pip list
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ================================================================
|
||||||
|
# __PROJECT_UPPER__ - Python Virtual Environment aktivieren
|
||||||
|
# ================================================================
|
||||||
|
# Dieses Skript muss gesourct werden: source bin/activate_venv.sh
|
||||||
|
# ================================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "$SCRIPT_DIR/setenv.sh"
|
||||||
|
|
||||||
|
if [ ! -d "$PROJECT/.venv" ]; then
|
||||||
|
echo "FEHLER: Virtual environment nicht gefunden."
|
||||||
|
echo "Bitte zuerst bin/install_py.sh ausfuehren."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$PROJECT/.venv/bin/activate"
|
||||||
|
echo "Virtuelle Umgebung aktiviert."
|
||||||
|
echo "Python-Version:"
|
||||||
|
python --version
|
||||||
|
echo ""
|
||||||
|
echo "Installierte Pakete:"
|
||||||
|
pip list
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
@echo off
|
||||||
|
REM ================================================================
|
||||||
|
REM __PROJECT_UPPER__ - Shell mit gesetzten Umgebungsvariablen oeffnen
|
||||||
|
REM ================================================================
|
||||||
|
|
||||||
|
call "%~dp0setenv.bat"
|
||||||
|
start cmd /k "echo __PROJECT_UPPER__ Umgebung aktiv. && echo PROJECT=%PROJECT%"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ================================================================
|
||||||
|
# __PROJECT_UPPER__ - Shell mit gesetzten Umgebungsvariablen oeffnen
|
||||||
|
# ================================================================
|
||||||
|
# Verwendung: source bin/get_cmd.sh
|
||||||
|
# ================================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "$SCRIPT_DIR/setenv.sh"
|
||||||
|
|
||||||
|
exec "$SHELL"
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
@echo off
|
||||||
|
REM ================================================================
|
||||||
|
REM __PROJECT_UPPER__ - Python Virtual Environment einrichten
|
||||||
|
REM ================================================================
|
||||||
|
|
||||||
|
call "%~dp0setenv.bat"
|
||||||
|
|
||||||
|
if not exist "%PROJECT%\.venv" (
|
||||||
|
echo Initialisiere Python virtual environment...
|
||||||
|
py -m venv "%PROJECT%\.venv" --upgrade-deps
|
||||||
|
echo Erfolgreich.
|
||||||
|
|
||||||
|
call "%PROJECT%\.venv\Scripts\activate.bat"
|
||||||
|
echo Installiere erforderliche Python Packages...
|
||||||
|
pip install -r "%PROJECT%\requirements.txt" -q
|
||||||
|
echo Erfolgreich.
|
||||||
|
deactivate
|
||||||
|
) else (
|
||||||
|
echo Erforderliche Python Packages bereits installiert!
|
||||||
|
)
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ================================================================
|
||||||
|
# __PROJECT_UPPER__ - Python Virtual Environment einrichten
|
||||||
|
# ================================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "$SCRIPT_DIR/setenv.sh"
|
||||||
|
|
||||||
|
if [ ! -d "$PROJECT/.venv" ]; then
|
||||||
|
echo "Initialisiere Python virtual environment..."
|
||||||
|
python3 -m venv "$PROJECT/.venv" --upgrade-deps
|
||||||
|
echo "Erfolgreich."
|
||||||
|
|
||||||
|
source "$PROJECT/.venv/bin/activate"
|
||||||
|
echo "Installiere erforderliche Python Packages..."
|
||||||
|
pip install -r "$PROJECT/requirements.txt" -q
|
||||||
|
echo "Erfolgreich."
|
||||||
|
deactivate
|
||||||
|
else
|
||||||
|
echo "Erforderliche Python Packages bereits installiert!"
|
||||||
|
fi
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
REM ================================================================
|
||||||
|
REM __PROJECT_UPPER__ - Umgebungsvariablen Setup
|
||||||
|
REM ================================================================
|
||||||
|
|
||||||
|
if defined PV_BIN (
|
||||||
|
echo __PROJECT_UPPER__ Umgebung bereits gesetzt.
|
||||||
|
goto :show
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Setting up environment variables for __PROJECT_UPPER__ ...
|
||||||
|
|
||||||
|
REM Basis-Projektpfad (aktueller Ordner)
|
||||||
|
set "PROJECT=%~dp0.."
|
||||||
|
if "%PROJECT:~-6%"=="bin\.." set "PROJECT=%PROJECT:~0,-6%"
|
||||||
|
if "%PROJECT:~-1%"=="\" set "PROJECT=%PROJECT:~0,-1%"
|
||||||
|
|
||||||
|
REM Pfade fuer verschiedene Komponenten
|
||||||
|
set "PV_BIN=%PROJECT%\bin"
|
||||||
|
set "PV_LIB=%PROJECT%\lib"
|
||||||
|
set "PV_DATA=%PROJECT%\data"
|
||||||
|
set "PV_CFG=%PROJECT%\cfg"
|
||||||
|
set "PV_LOG=%PROJECT%\log"
|
||||||
|
set "PV_TESTS=%PROJECT%\tests"
|
||||||
|
set "PV_RESULTS=%PROJECT%\results"
|
||||||
|
set "PV_EXAMPLES=%PROJECT%\examples"
|
||||||
|
|
||||||
|
REM Python-Pfad erweitern (nur wenn noch nicht vorhanden)
|
||||||
|
echo %PYTHONPATH% | find /i "%PV_LIB%" >nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
set "PYTHONPATH=%PV_LIB%;%PYTHONPATH%"
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Ordner erstellen falls sie nicht existieren
|
||||||
|
if not exist "%PV_BIN%" mkdir "%PV_BIN%"
|
||||||
|
if not exist "%PV_CFG%" mkdir "%PV_CFG%"
|
||||||
|
if not exist "%PV_LIB%" mkdir "%PV_LIB%"
|
||||||
|
if not exist "%PV_DATA%" mkdir "%PV_DATA%"
|
||||||
|
if not exist "%PV_LOG%" mkdir "%PV_LOG%"
|
||||||
|
if not exist "%PV_RESULTS%" mkdir "%PV_RESULTS%"
|
||||||
|
if not exist "%PV_EXAMPLES%" mkdir "%PV_EXAMPLES%"
|
||||||
|
|
||||||
|
REM Umgebungsvariablen anzeigen
|
||||||
|
:show
|
||||||
|
echo.
|
||||||
|
echo ================================================================
|
||||||
|
echo __PROJECT_UPPER__ ENVIRONMENT SETUP COMPLETE
|
||||||
|
echo ================================================================
|
||||||
|
echo PROJECT = %PROJECT%
|
||||||
|
echo PV_BIN = %PV_BIN%
|
||||||
|
echo PV_CFG = %PV_CFG%
|
||||||
|
echo PV_LIB = %PV_LIB%
|
||||||
|
echo PV_DATA = %PV_DATA%
|
||||||
|
echo PV_RESULTS = %PV_RESULTS%
|
||||||
|
echo PV_LOG = %PV_LOG%
|
||||||
|
echo PV_EXAMPLES = %PV_EXAMPLES%
|
||||||
|
echo PYTHONPATH = %PYTHONPATH%
|
||||||
|
echo ================================================================
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM Optionally keep window open
|
||||||
|
if "%1"=="--keep-open" pause
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ================================================================
|
||||||
|
# __PROJECT_UPPER__ - Umgebungsvariablen Setup
|
||||||
|
# ================================================================
|
||||||
|
# Dieses Skript muss gesourct werden: source bin/setenv.sh
|
||||||
|
# ================================================================
|
||||||
|
|
||||||
|
echo "Setting up environment variables for __PROJECT_UPPER__ ..."
|
||||||
|
|
||||||
|
# Basis-Projektpfad (uebergeordnetes Verzeichnis von bin/)
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
export PROJECT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||||
|
|
||||||
|
# Pfade fuer verschiedene Komponenten
|
||||||
|
export PV_BIN="$PROJECT/bin"
|
||||||
|
export PV_LIB="$PROJECT/lib"
|
||||||
|
export PV_DATA="$PROJECT/data"
|
||||||
|
export PV_CFG="$PROJECT/cfg"
|
||||||
|
export PV_LOG="$PROJECT/log"
|
||||||
|
export PV_TESTS="$PROJECT/tests"
|
||||||
|
export PV_RESULTS="$PROJECT/results"
|
||||||
|
export PV_EXAMPLES="$PROJECT/examples"
|
||||||
|
|
||||||
|
# Python-Pfad erweitern (nur wenn noch nicht vorhanden)
|
||||||
|
if [[ ":$PYTHONPATH:" != *":$PV_LIB:"* ]]; then
|
||||||
|
export PYTHONPATH="$PV_LIB:$PYTHONPATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ordner erstellen falls sie nicht existieren
|
||||||
|
mkdir -p "$PV_BIN" "$PV_CFG" "$PV_LIB" "$PV_DATA" "$PV_LOG" "$PV_RESULTS" "$PV_EXAMPLES"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "================================================================"
|
||||||
|
echo "__PROJECT_UPPER__ ENVIRONMENT SETUP COMPLETE"
|
||||||
|
echo "================================================================"
|
||||||
|
echo "PROJECT = $PROJECT"
|
||||||
|
echo "PV_BIN = $PV_BIN"
|
||||||
|
echo "PV_CFG = $PV_CFG"
|
||||||
|
echo "PV_LIB = $PV_LIB"
|
||||||
|
echo "PV_DATA = $PV_DATA"
|
||||||
|
echo "PV_RESULTS = $PV_RESULTS"
|
||||||
|
echo "PV_LOG = $PV_LOG"
|
||||||
|
echo "PV_EXAMPLES = $PV_EXAMPLES"
|
||||||
|
echo "PYTHONPATH = $PYTHONPATH"
|
||||||
|
echo "================================================================"
|
||||||
|
echo ""
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# Python-Abhaengigkeiten
|
||||||
|
# Installieren mit: pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Beispiel-Abhaengigkeiten - anpassen nach Bedarf:
|
||||||
|
# pydantic >= 2.0.0
|
||||||
|
# pytest >= 9.0.0
|
||||||
Reference in New Issue
Block a user