Commits

anatoly techtonik  committed 37a01a9

best practice: make module importable

  • Participants
  • Parent commits 6b85222

Comments (0)

Files changed (1)

     sys.exit(0)
 
 
-parser = OptionParser(usage="usage: %prog <pack|unpack>",
-    description="update library.zip created by py2exe utility")
-opt,arg = parser.parse_args()
-    
-if arg and arg[0] == 'unpack':
-    unpack("library.zip")
-elif arg and arg[0] == 'pack':
-    pack(PACKED)
-else:
-    sys.exit(parser.format_help())
+if __name__ == '__main__':
+    parser = OptionParser(usage="usage: %prog <pack|unpack>",
+        description="update library.zip created by py2exe utility")
+    opt,arg = parser.parse_args()
+        
+    if arg and arg[0] == 'unpack':
+        unpack("library.zip")
+    elif arg and arg[0] == 'pack':
+        pack(PACKED)
+    else:
+        sys.exit(parser.format_help())