Drop testprogram/ from the repo, show version in dialog titles
testprogram/ is local test data, not part of the tool: untracked and gitignored so it never comes back. verify.py now prints SKIP and exits 0 when the test pair is absent instead of blowing up. Adds config.NAME / config.VERSION (sab2sax 0.0.0.001). Every dialog title bar goes through config.title(), and the CLI prints the same line at startup, so it is clear which build produced a file. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
ec4019ea96
commit
dd7b586ea0
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
__pycache__/
|
||||
*.pyc
|
||||
testprogram/
|
||||
*-sab2sax-*.sab
|
||||
*-sab2sax-*.sax
|
||||
|
||||
14
README.md
14
README.md
@ -61,12 +61,20 @@ set the key by hand instead.
|
||||
|
||||
`python config.py` prints the resolved home, prompting if it isn't set yet.
|
||||
|
||||
## Version
|
||||
|
||||
`config.NAME` / `config.VERSION` — currently `sab2sax 0.0.0.001`. Every dialog title bar reads
|
||||
`sab2sax 0.0.0.001 - Select the .sax or .sab application file to convert`, and the CLI prints the
|
||||
same line when it starts, so it is obvious which build produced a file. Bump it in
|
||||
[config.py](config.py) and both follow.
|
||||
|
||||
## Verify
|
||||
|
||||
python verify.py [sedona_home]
|
||||
|
||||
Without an argument the home comes from `system.properties`. Three checks, both against the
|
||||
checked-in pair in `testprogram/`:
|
||||
Without an argument the home comes from `system.properties`. Three checks, run against a
|
||||
`test_normal.sax` / `test_normal_sedonac.sab` pair in `testprogram/`. That folder is **not** in the
|
||||
repo (gitignored) — drop the pair in yourself, otherwise verify prints `SKIP` and exits 0:
|
||||
|
||||
test_normal.sax -> sab vs test_normal_sedonac.sab
|
||||
test_normal_sedonac.sab -> sax vs test_normal.sax
|
||||
@ -84,7 +92,7 @@ under.
|
||||
config.py system.properties read/write, folder + file choosers
|
||||
verify.py regression check against sedonac's output, both directions
|
||||
system.properties sedona.home
|
||||
testprogram/ test_normal.sax and the sedonac .sab to match it against
|
||||
testprogram/ local only, gitignored: test apps to run verify.py against
|
||||
|
||||
## Format
|
||||
|
||||
|
||||
20
config.py
20
config.py
@ -14,11 +14,19 @@ chooser is shown and the answer is written back to `system.properties`.
|
||||
"""
|
||||
import os, sys
|
||||
|
||||
NAME = "sab2sax"
|
||||
VERSION = "0.0.0.001"
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
PROPS = os.path.join(HERE, "system.properties")
|
||||
KEY = "sedona.home"
|
||||
|
||||
|
||||
def title(text):
|
||||
"""Every dialog carries the program name and version in its title bar."""
|
||||
return "%s %s - %s" % (NAME, VERSION, text)
|
||||
|
||||
|
||||
# ---------- .properties ----------
|
||||
def _unescape(v):
|
||||
"""Collapse `\\\\` to `\\`; leave any other backslash alone.
|
||||
@ -82,36 +90,36 @@ def _tk():
|
||||
return None
|
||||
|
||||
|
||||
def ask_directory(title, initial=None):
|
||||
def ask_directory(text, initial=None):
|
||||
root = _tk()
|
||||
if root is None:
|
||||
return None
|
||||
try:
|
||||
from tkinter import filedialog
|
||||
return filedialog.askdirectory(title=title, initialdir=initial or HERE) or None
|
||||
return filedialog.askdirectory(title=title(text), initialdir=initial or HERE) or None
|
||||
finally:
|
||||
root.destroy()
|
||||
|
||||
|
||||
def ask_open_file(title, filetypes, initial=None):
|
||||
def ask_open_file(text, filetypes, initial=None):
|
||||
root = _tk()
|
||||
if root is None:
|
||||
return None
|
||||
try:
|
||||
from tkinter import filedialog
|
||||
return filedialog.askopenfilename(title=title, filetypes=filetypes,
|
||||
return filedialog.askopenfilename(title=title(text), filetypes=filetypes,
|
||||
initialdir=initial or HERE) or None
|
||||
finally:
|
||||
root.destroy()
|
||||
|
||||
|
||||
def ask_save_file(title, filetypes, defaultextension, initialfile=None, initial=None):
|
||||
def ask_save_file(text, filetypes, defaultextension, initialfile=None, initial=None):
|
||||
root = _tk()
|
||||
if root is None:
|
||||
return None
|
||||
try:
|
||||
from tkinter import filedialog
|
||||
return filedialog.asksaveasfilename(title=title, filetypes=filetypes,
|
||||
return filedialog.asksaveasfilename(title=title(text), filetypes=filetypes,
|
||||
defaultextension=defaultextension,
|
||||
initialfile=initialfile,
|
||||
initialdir=initial or HERE) or None
|
||||
|
||||
@ -30,6 +30,7 @@ def convert(in_path, out_path=None, home=None):
|
||||
|
||||
|
||||
def main(argv):
|
||||
print("%s %s" % (config.NAME, config.VERSION))
|
||||
home = config.get_sedona_home()
|
||||
|
||||
in_path = argv[1] if len(argv) > 1 else config.choose_input_file()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -99,6 +99,12 @@ if __name__ == "__main__":
|
||||
print("sedona home: %s" % HOME)
|
||||
saxf = os.path.join(TESTS, "test_normal.sax")
|
||||
sabf = os.path.join(TESTS, "test_normal_sedonac.sab")
|
||||
missing = [f for f in (saxf, sabf) if not os.path.isfile(f)]
|
||||
if missing:
|
||||
# testprogram/ is deliberately not in the repo -- put the pair back to run this
|
||||
print(" SKIP no test files: %s" % ", ".join(os.path.basename(f) for f in missing))
|
||||
sys.exit(0)
|
||||
|
||||
ok = check_encode(saxf, sabf)
|
||||
ok &= check_decode(sabf, saxf)
|
||||
ok &= check_round_trip(sabf)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user