From a91b74f9b428563642ad9d2ed294695c44961469 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 27 Feb 2014 11:33:30 +0100 Subject: Add proper main entry point to avoid execution when import. --- tools/mdexport_test.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'tools/mdexport_test.py') diff --git a/tools/mdexport_test.py b/tools/mdexport_test.py index abd9aefe..b7faca35 100755 --- a/tools/mdexport_test.py +++ b/tools/mdexport_test.py @@ -52,17 +52,21 @@ MDIMPORT = { } -item = MDIMPORT[sys.argv[1]] +def main(): + item = MDIMPORT[sys.argv[1]] -metad = None + metad = None -if item["type"] == "local": - metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"]) -elif item["type"] == "external": - metad = MetaDataExtern(sys.argv[1], ONTS.values(), - item["url"], "/opt/local/bin/xmlsec1", item["cert"]) + if item["type"] == "local": + metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"]) + elif item["type"] == "external": + metad = MetaDataExtern(sys.argv[1], ONTS.values(), + item["url"], "/opt/local/bin/xmlsec1", item["cert"]) -if metad: - metad.load() - print metad.dumps() + if metad: + metad.load() + print metad.dumps() + +if __name__ == '__main__': + main() -- cgit v1.2.1