Browse Source

fix bug #1335472: pfreeze should pack main module as __main__

rdb 11 years ago
parent
commit
7669e79322
1 changed files with 4 additions and 3 deletions
  1. 4 3
      direct/src/showutil/pfreeze.py

+ 4 - 3
direct/src/showutil/pfreeze.py

@@ -102,15 +102,16 @@ elif bl.endswith('.exe'):
     basename = os.path.splitext(basename)[0]
     basename = os.path.splitext(basename)[0]
 
 
 startfile = args[0]
 startfile = args[0]
+startmod = startfile
 if startfile.endswith('.py') or startfile.endswith('.pyw') or \
 if startfile.endswith('.py') or startfile.endswith('.pyw') or \
    startfile.endswith('.pyc') or startfile.endswith('.pyo'):
    startfile.endswith('.pyc') or startfile.endswith('.pyo'):
-    startfile = os.path.splitext(startfile)[0]
+    startmod = os.path.splitext(startfile)[0]
 
 
 compileToExe = False
 compileToExe = False
 if outputType == 'dll':
 if outputType == 'dll':
-    freezer.addModule(startfile)
+    freezer.addModule(startmod, filename = startfile)
 else:
 else:
-    freezer.addModule(startfile, newName = '__main__')
+    freezer.addModule('__main__', filename = startfile)
     compileToExe = True
     compileToExe = True
 
 
 freezer.done(compileToExe = compileToExe)
 freezer.done(compileToExe = compileToExe)