diff --git a/.gitignore b/.gitignore index 5724b71..2673c48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ __pycache__/ *.pyc +testprogram/ *-sab2sax-*.sab *-sab2sax-*.sax diff --git a/README.md b/README.md index 131a612..50d862c 100644 --- a/README.md +++ b/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 diff --git a/config.py b/config.py index 1cd8cd3..6706e5e 100644 --- a/config.py +++ b/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 diff --git a/sab2sax.py b/sab2sax.py index c5ab1cc..bbdf2fb 100644 --- a/sab2sax.py +++ b/sab2sax.py @@ -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() diff --git a/testprogram/test_normal.sax b/testprogram/test_normal.sax deleted file mode 100644 index c25127c..0000000 --- a/testprogram/test_normal.sax +++ /dev/null @@ -1,1266 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/testprogram/test_normal_sedonac.sab b/testprogram/test_normal_sedonac.sab deleted file mode 100644 index 8f5a949..0000000 Binary files a/testprogram/test_normal_sedonac.sab and /dev/null differ diff --git a/verify.py b/verify.py index 3708130..c7c19f1 100644 --- a/verify.py +++ b/verify.py @@ -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)