1 """macfreeze - Main program and GUI
3 macfreeze allows you to turn Python scripts into fully self-contained
4 Mac applications, by including all the Python and C code needed in a single
5 executable. Like unix/windows freeze it can produce a config.c allowing you
6 to build the application with a development environment (CodeWarrior, to be
7 precise), but unlike the standard freeze it is also possible to create frozen
8 applications without a development environment, by glueing all the
9 shared libraries and extension modules needed together in a single
10 executable, using some Code Fragment Manager tricks."""
18 import macmodulefinder
21 # Here are the macfreeze directives, used when freezing macfreeze itself
22 # (see directives.py for an explanation)
24 # macfreeze: path ::::Tools:freeze
25 # macfreeze: exclude win32api
30 gentype
, program
, output
, debug
= macfreezegui
.dialog()
31 elif len(sys
.argv
) == 2:
32 gentype
, program
, output
, debug
= macfreezegui
.dialog(sys
.argv
[1])
35 "Please pass a single script. Additional modules can be specified with directives")
37 mustwait
= process(gentype
, program
, output
, debug
=debug
)
41 def process(gentype
, program
, output
, modules
=[], module_files
=[], debug
=0):
43 module_dict
= macmodulefinder
.process(program
, modules
, module_files
, debug
)
44 except macmodulefinder
.Missing
, arg
:
46 print '** Missing modules:', string
.join(arg
, ' ')
53 macgen_info
.generate(output
, module_dict
)
54 return 1 # So the user can inspect it
55 elif gentype
== 'source':
57 warnings
= macgen_src
.generate(output
, module_dict
, debug
)
59 elif gentype
== 'resource':
61 macgen_rsrc
.generate(output
, module_dict
, debug
)
62 warnings
= macgen_rsrc
.warnings(module_dict
)
64 elif gentype
== 'applet':
66 architecture
= 'fat' # user should choose
67 macgen_bin
.generate(program
, output
, module_dict
, architecture
, debug
)
69 raise 'unknown gentype', gentype
71 if __name__
== '__main__':