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:
arda.aydin@ontrol.com.tr 2026-08-12 22:08:20 +03:00
parent ec4019ea96
commit dd7b586ea0
7 changed files with 33 additions and 1275 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
__pycache__/ __pycache__/
*.pyc *.pyc
testprogram/
*-sab2sax-*.sab *-sab2sax-*.sab
*-sab2sax-*.sax *-sab2sax-*.sax

View File

@ -61,12 +61,20 @@ set the key by hand instead.
`python config.py` prints the resolved home, prompting if it isn't set yet. `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 ## Verify
python verify.py [sedona_home] python verify.py [sedona_home]
Without an argument the home comes from `system.properties`. Three checks, both against the Without an argument the home comes from `system.properties`. Three checks, run against a
checked-in pair in `testprogram/`: `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.sax -> sab vs test_normal_sedonac.sab
test_normal_sedonac.sab -> sax vs test_normal.sax test_normal_sedonac.sab -> sax vs test_normal.sax
@ -84,7 +92,7 @@ under.
config.py system.properties read/write, folder + file choosers config.py system.properties read/write, folder + file choosers
verify.py regression check against sedonac's output, both directions verify.py regression check against sedonac's output, both directions
system.properties sedona.home 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 ## Format

View File

@ -14,11 +14,19 @@ chooser is shown and the answer is written back to `system.properties`.
""" """
import os, sys import os, sys
NAME = "sab2sax"
VERSION = "0.0.0.001"
HERE = os.path.dirname(os.path.abspath(__file__)) HERE = os.path.dirname(os.path.abspath(__file__))
PROPS = os.path.join(HERE, "system.properties") PROPS = os.path.join(HERE, "system.properties")
KEY = "sedona.home" 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 ---------- # ---------- .properties ----------
def _unescape(v): def _unescape(v):
"""Collapse `\\\\` to `\\`; leave any other backslash alone. """Collapse `\\\\` to `\\`; leave any other backslash alone.
@ -82,36 +90,36 @@ def _tk():
return None return None
def ask_directory(title, initial=None): def ask_directory(text, initial=None):
root = _tk() root = _tk()
if root is None: if root is None:
return None return None
try: try:
from tkinter import filedialog 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: finally:
root.destroy() root.destroy()
def ask_open_file(title, filetypes, initial=None): def ask_open_file(text, filetypes, initial=None):
root = _tk() root = _tk()
if root is None: if root is None:
return None return None
try: try:
from tkinter import filedialog 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 initialdir=initial or HERE) or None
finally: finally:
root.destroy() 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() root = _tk()
if root is None: if root is None:
return None return None
try: try:
from tkinter import filedialog from tkinter import filedialog
return filedialog.asksaveasfilename(title=title, filetypes=filetypes, return filedialog.asksaveasfilename(title=title(text), filetypes=filetypes,
defaultextension=defaultextension, defaultextension=defaultextension,
initialfile=initialfile, initialfile=initialfile,
initialdir=initial or HERE) or None initialdir=initial or HERE) or None

View File

@ -30,6 +30,7 @@ def convert(in_path, out_path=None, home=None):
def main(argv): def main(argv):
print("%s %s" % (config.NAME, config.VERSION))
home = config.get_sedona_home() home = config.get_sedona_home()
in_path = argv[1] if len(argv) > 1 else config.choose_input_file() 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.

View File

@ -99,6 +99,12 @@ if __name__ == "__main__":
print("sedona home: %s" % HOME) print("sedona home: %s" % HOME)
saxf = os.path.join(TESTS, "test_normal.sax") saxf = os.path.join(TESTS, "test_normal.sax")
sabf = os.path.join(TESTS, "test_normal_sedonac.sab") 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_encode(saxf, sabf)
ok &= check_decode(sabf, saxf) ok &= check_decode(sabf, saxf)
ok &= check_round_trip(sabf) ok &= check_round_trip(sabf)