Changeset View
Changeset View
Standalone View
Standalone View
ext/python/Tools/freeze/winmakemakefile.py
import sys, os | import sys, os | ||||
Lint: PEP8 E401: multiple imports on one line | |||||
# Template used then the program is a GUI program | # Template used then the program is a GUI program | ||||
WINMAINTEMPLATE = """ | WINMAINTEMPLATE = """ | ||||
#include <windows.h> | #include <windows.h> | ||||
int WINAPI WinMain( | int WINAPI WinMain( | ||||
HINSTANCE hInstance, // handle to current instance | HINSTANCE hInstance, // handle to current instance | ||||
HINSTANCE hPrevInstance, // handle to previous instance | HINSTANCE hPrevInstance, // handle to previous instance | ||||
Show All 14 Lines | |||||
{ | { | ||||
PyImport_FrozenModules = _PyImport_FrozenModules; | PyImport_FrozenModules = _PyImport_FrozenModules; | ||||
return PythonService_main(argc, argv); | return PythonService_main(argc, argv); | ||||
} | } | ||||
""" | """ | ||||
subsystem_details = { | subsystem_details = { | ||||
# -s flag : (C entry point template), (is it __main__?), (is it a DLL?) | # -s flag : (C entry point template), (is it __main__?), (is it a DLL?) | ||||
'console' : (None, 1, 0), | 'console' : (None, 1, 0), | ||||
Lint: PEP8 E203 whitespace before ':' Lint: PEP8 E203: whitespace before ':' | |||||
'windows' : (WINMAINTEMPLATE, 1, 0), | 'windows' : (WINMAINTEMPLATE, 1, 0), | ||||
Lint: PEP8 E203 whitespace before ':' Lint: PEP8 E203: whitespace before ':' | |||||
'service' : (SERVICETEMPLATE, 0, 0), | 'service' : (SERVICETEMPLATE, 0, 0), | ||||
Lint: PEP8 E203 whitespace before ':' Lint: PEP8 E203: whitespace before ':' | |||||
'com_dll' : ("", 0, 1), | 'com_dll' : ("", 0, 1), | ||||
Lint: PEP8 E203 whitespace before ':' Lint: PEP8 E203: whitespace before ':' | |||||
} | } | ||||
def get_custom_entry_point(subsystem): | def get_custom_entry_point(subsystem): | ||||
try: | try: | ||||
return subsystem_details[subsystem][:2] | return subsystem_details[subsystem][:2] | ||||
except KeyError: | except KeyError: | ||||
raise ValueError, "The subsystem %s is not known" % subsystem | raise ValueError("The subsystem %s is not known" % subsystem) | ||||
def makemakefile(outfp, vars, files, target): | def makemakefile(outfp, vars, files, target): | ||||
save = sys.stdout | save = sys.stdout | ||||
try: | try: | ||||
sys.stdout = outfp | sys.stdout = outfp | ||||
realwork(vars, files, target) | realwork(vars, files, target) | ||||
finally: | finally: | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | for moddefn in moddefns: | ||||
# Add .lib files this module needs | # Add .lib files this module needs | ||||
for modlib in moddefn.GetLinkerLibs(): | for modlib in moddefn.GetLinkerLibs(): | ||||
if modlib not in libs: | if modlib not in libs: | ||||
libs.append(modlib) | libs.append(modlib) | ||||
print "ADDN_LINK_FILES=", | print "ADDN_LINK_FILES=", | ||||
for addn in vars['addn_link']: print '"%s"' % (addn), | for addn in vars['addn_link']: print '"%s"' % (addn), | ||||
Lint: PEP8 E701 multiple statements on one line (colon) Lint: PEP8 E701: multiple statements on one line (colon) | |||||
print ; print | print ; print | ||||
Lint: PEP8 E203 whitespace before ';' Lint: PEP8 E203: whitespace before ';' | |||||
Lint: PEP8 E702 multiple statements on one line (semicolon) Lint: PEP8 E702: multiple statements on one line (semicolon) | |||||
print "OBJS=", | print "OBJS=", | ||||
for obj in objects: print '"$(temp_dir)\%s"' % (obj), | for obj in objects: print '"$(temp_dir)\%s"' % (obj), | ||||
Lint: PEP8 E701 multiple statements on one line (colon) Lint: PEP8 E701: multiple statements on one line (colon) | |||||
print ; print | print ; print | ||||
Lint: PEP8 E203 whitespace before ';' Lint: PEP8 E203: whitespace before ';' | |||||
Lint: PEP8 E702 multiple statements on one line (semicolon) Lint: PEP8 E702: multiple statements on one line (semicolon) | |||||
print "LIBS=", | print "LIBS=", | ||||
for lib in libs: print '"%s"' % (lib), | for lib in libs: print '"%s"' % (lib), | ||||
Lint: PEP8 E701 multiple statements on one line (colon) Lint: PEP8 E701: multiple statements on one line (colon) | |||||
print ; print | print ; print | ||||
Lint: PEP8 E203 whitespace before ';' Lint: PEP8 E203: whitespace before ';' | |||||
Lint: PEP8 E702 multiple statements on one line (semicolon) Lint: PEP8 E702: multiple statements on one line (semicolon) | |||||
print "$(target)$(debug_suffix)%s: $(temp_dir) $(OBJS)" % (target_ext) | print "$(target)$(debug_suffix)%s: $(temp_dir) $(OBJS)" % (target_ext) | ||||
print "\tlink -out:$(target)$(debug_suffix)%s %s" % (target_ext, target_link_flags), | print "\tlink -out:$(target)$(debug_suffix)%s %s" % (target_ext, target_link_flags), | ||||
print "\t$(OBJS) \\" | print "\t$(OBJS) \\" | ||||
print "\t$(LIBS) \\" | print "\t$(LIBS) \\" | ||||
print "\t$(ADDN_LINK_FILES) \\" | print "\t$(ADDN_LINK_FILES) \\" | ||||
print "\t$(pythonlib) $(lcustom) $(l_debug)\\" | print "\t$(pythonlib) $(lcustom) $(l_debug)\\" | ||||
print "\t$(resources)" | print "\t$(resources)" | ||||
print "clean:" | print "clean:" | ||||
print "\t-rm -f *.obj" | print "\t-rm -f *.obj" | ||||
print "\t-rm -f $(target).exe" | print "\t-rm -f $(target).exe" |
multiple imports on one line