From bdb49079c6e72284f9f716b12334a4ee38090643 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Sun, 21 May 2017 22:52:44 -0400 Subject: [PATCH] added usage output --- winclient/filever.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/winclient/filever.py b/winclient/filever.py index 500ecce..78297d9 100644 --- a/winclient/filever.py +++ b/winclient/filever.py @@ -20,7 +20,14 @@ def get_version_number (filename): return 0,0,0,0 if __name__ == '__main__': - import os - filename = os.environ["COMSPEC"] - this_delimiter = "." - print(".".join ([str (i) for i in get_version_number (filename)])) + import os + if "COMSPEC" in os.environ: + filename = os.environ["COMSPEC"] + this_delimiter = "." + print(str(filename) + " version:") + print(".".join ([str (i) for i in get_version_number (filename)])) + print("Running filever directly doesn't do much.\n\n#Usage:\n" + + "import filever\n" + + "parts = filever.get_version_number(filename)\n" + + "major,minor,subminor,revision = parts\n" + + "print(\".\".join([str (i) for i in parts]))\n\n")