Use setenv in launcher scripts, add requirements.txt and missing .sh scripts

platz.bat/platz.sh now derive PLATZ via setenv instead of hardcoded
paths, matching the Standard Programm Template already applied to
setenv/install_py/activate_venv/get_cmd. Added the missing .sh
counterparts to those .bat scripts, an empty requirements.txt for
install_py to install (project only uses the stdlib), and ignore
entries for .venv/, out/, .vscode/, *.swp.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Michael Stangl
2026-07-09 11:57:05 +02:00
parent bd87b3df46
commit e8911df7e9
16 changed files with 246 additions and 66 deletions
+21 -12
View File
@@ -13,22 +13,31 @@ result to text/CSV output files.
**This is Python 2 code** (print statements, `ConfigParser`, `sets.Set`, `UserList`,
`string.split`, old-style `raise Exception, "msg"`, `xrange`, `dict.has_key`,
`dict.iteritems`). It will not run under Python 3 without a 2to3-style port. There is no
`requirements.txt`, build system, test suite, or linter configured in this repo — a Python 2
interpreter with only the standard library is sufficient to run it.
build system, test suite, or linter configured in this repo. `requirements.txt` exists but
is empty/commented — everything used is standard library — it's there only so
`bin/install_py.*` has something to install into the `.venv`.
## Running the program
Entry point is `libs/platz.py`, invoked via the wrapper scripts in `bin/`, which set up
environment variables and `PYTHONPATH` before calling it — the scripts never take a script
argument, they just launch `platz.py`:
Entry point is `libs/platz.py`, invoked via the scripts in `bin/` (each provided as a
`.bat`/`.sh` pair, following the "Standard Programm Template" convention — see
`~/.claude/CLAUDE.md` for the template rules):
- `bin/run` (bash, for Linux/macOS) — hardcodes `PLATZ=/Users/sm/develop/python/platz`
- `bin/run.bat` (Windows) — hardcodes `PLATZ=h:\develop\python\platz` and a Python 2.4 interpreter path
Both scripts set `PLATZ_CFG`, `PLATZ_LIBS`, `PLATZ_WORK` and add `PLATZ_LIBS` to
`PYTHONPATH`, then run `python $PLATZ_LIBS/platz.py`. **The hardcoded paths at the top of
these scripts must be edited to match wherever this repo is actually checked out** before
they will work.
- `bin/setenv.bat` / `bin/setenv.sh` — derives `PLATZ` from the script's own location (no
path editing needed), sets `PLATZ_BIN`, `PLATZ_CFG`, `PLATZ_LIBS`, `PLATZ_WORK`,
`PLATZ_IN`, `PLATZ_OUT`, adds `PLATZ_LIBS` to `PYTHONPATH` (idempotently), and creates
missing folders. Sourced by every other script; not normally invoked directly. The `.sh`
variant must be sourced (`source bin/setenv.sh`), not executed.
- `bin/install_py.bat` / `bin/install_py.sh` — calls `setenv`, then creates `.venv` (via
`py -m venv` / `python3 -m venv`) and `pip install -r requirements.txt` if `.venv` doesn't
already exist.
- `bin/activate_venv.bat` / `bin/activate_venv.sh` — calls `setenv`, then activates the
existing `.venv` (errors out if `install_py` hasn't been run yet).
- `bin/get_cmd.bat` / `bin/get_cmd.sh` — calls `setenv`, then opens a new shell with the
`PLATZ_*` environment already set.
- `bin/platz.bat` / `bin/platz.sh` — calls `setenv`, then runs `python
"$PLATZ_LIBS/platz.py"`. This is the actual program entry point (replaces the old
`bin/run` / `bin/run.bat`, which hardcoded absolute paths and have been removed).
Configuration is driven by `cfg/platz.cfg`, which points (via `$PLATZ_CFG`/`$PLATZ_WORK`
env-var expansion) to: