Skip to content

Commit a91b74f

Browse files
author
Florent
committed
Add proper main entry point to avoid execution when import.
1 parent 558314f commit a91b74f

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

tools/mdexport_test.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,21 @@
5252
}
5353

5454

55-
item = MDIMPORT[sys.argv[1]]
55+
def main():
56+
item = MDIMPORT[sys.argv[1]]
5657

57-
metad = None
58+
metad = None
5859

59-
if item["type"] == "local":
60-
metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"])
61-
elif item["type"] == "external":
62-
metad = MetaDataExtern(sys.argv[1], ONTS.values(),
63-
item["url"], "/opt/local/bin/xmlsec1", item["cert"])
60+
if item["type"] == "local":
61+
metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"])
62+
elif item["type"] == "external":
63+
metad = MetaDataExtern(sys.argv[1], ONTS.values(),
64+
item["url"], "/opt/local/bin/xmlsec1", item["cert"])
6465

65-
if metad:
66-
metad.load()
67-
print metad.dumps()
66+
if metad:
67+
metad.load()
68+
print metad.dumps()
6869

70+
71+
if __name__ == '__main__':
72+
main()

0 commit comments

Comments
 (0)