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:
@@ -7,14 +7,14 @@ using a small custom GA framework, and writes the result to text/CSV output file
|
||||
|
||||
**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 needs a Python 2 interpreter; there are no third-party dependencies
|
||||
(standard library only).
|
||||
`dict.iteritems`). There are no third-party dependencies (standard library only), so
|
||||
`requirements.txt` is empty — it exists only so `bin/install_py` has something to install.
|
||||
|
||||
## Project structure
|
||||
|
||||
```
|
||||
platz/
|
||||
├── bin/ # launcher scripts (bash + Windows batch)
|
||||
├── bin/ # environment + launcher scripts (.bat + .sh pairs)
|
||||
├── cfg/ # GA cycle definition and penalty scheme
|
||||
├── libs/ # the two Python modules (ga.py, Strukturdaten.py, platz.py)
|
||||
└── work/ # per-run input (table layout, guest list) and output
|
||||
@@ -29,29 +29,48 @@ platz/
|
||||
|
||||
## Setup
|
||||
|
||||
1. Install a Python 2 interpreter (2.4+; no `pip install` needed, standard library only).
|
||||
2. Edit the hardcoded paths at the top of the launcher script for your platform:
|
||||
- `bin/run` (bash): `PLATZ=/Users/sm/develop/python/platz`
|
||||
- `bin/run.bat` (Windows): `PLATZ=h:\develop\python\platz` and `PYTHONSHELL=l:\tools\i486_nt\python24`
|
||||
1. Install a Python interpreter (`py` on Windows / `python3` on Linux/macOS must be on
|
||||
`PATH`).
|
||||
2. Run the installer for your platform to create a `.venv` and install `requirements.txt`:
|
||||
|
||||
Point `PLATZ` at wherever you checked out this repository.
|
||||
```bat
|
||||
:: Windows
|
||||
bin\install_py.bat
|
||||
```
|
||||
|
||||
```bash
|
||||
# Linux/macOS
|
||||
bin/install_py.sh
|
||||
```
|
||||
|
||||
All `bin/` scripts derive `PLATZ` automatically from their own location (no path editing
|
||||
required) by calling `setenv.bat`/`setenv.sh` first.
|
||||
|
||||
## Running
|
||||
|
||||
From a shell:
|
||||
```bat
|
||||
:: Windows
|
||||
bin\activate_venv.bat
|
||||
bin\platz.bat
|
||||
```
|
||||
|
||||
```bash
|
||||
# Linux/macOS
|
||||
source bin/run
|
||||
source bin/activate_venv.sh
|
||||
bin/platz.sh
|
||||
```
|
||||
|
||||
```bat
|
||||
:: Windows
|
||||
bin\run.bat
|
||||
```
|
||||
`bin/platz.bat` / `bin/platz.sh` call `setenv` to set `PLATZ`, `PLATZ_CFG`, `PLATZ_LIBS`,
|
||||
`PLATZ_WORK`, `PLATZ_IN`, `PLATZ_OUT`, add `PLATZ_LIBS` to `PYTHONPATH`, and then run
|
||||
`libs/platz.py`.
|
||||
|
||||
The launcher sets `PLATZ_CFG`, `PLATZ_LIBS`, `PLATZ_WORK`, adds `PLATZ_LIBS` to
|
||||
`PYTHONPATH`, and runs `libs/platz.py`.
|
||||
Other helper scripts (`bin/setenv.*`, `bin/get_cmd.*`) follow the same environment
|
||||
convention:
|
||||
|
||||
- `setenv` — sets all `PLATZ_*` environment variables and creates missing folders; sourced
|
||||
by every other script, not normally called directly.
|
||||
- `activate_venv` — activates the `.venv` created by `install_py`.
|
||||
- `get_cmd` — opens a new shell with the `PLATZ_*` environment already set.
|
||||
|
||||
### Configuring a run
|
||||
|
||||
|
||||
Reference in New Issue
Block a user