Back to index

python3.2  3.2.2
Functions | Variables
winmakemakefile Namespace Reference

Functions

def get_custom_entry_point
def makemakefile
def realwork

Variables

string WINMAINTEMPLATE
string SERVICETEMPLATE
dictionary subsystem_details

Function Documentation

Definition at line 38 of file winmakemakefile.py.

00038 
00039 def get_custom_entry_point(subsystem):
00040     try:
00041         return subsystem_details[subsystem][:2]
00042     except KeyError:
00043         raise ValueError("The subsystem %s is not known" % subsystem)
00044 

Here is the caller graph for this function:

def winmakemakefile.makemakefile (   outfp,
  vars,
  files,
  target 
)

Definition at line 45 of file winmakemakefile.py.

00045 
00046 def makemakefile(outfp, vars, files, target):
00047     save = sys.stdout
00048     try:
00049         sys.stdout = outfp
00050         realwork(vars, files, target)
00051     finally:
00052         sys.stdout = save

Here is the call graph for this function:

Here is the caller graph for this function:

def winmakemakefile.realwork (   vars,
  moddefns,
  target 
)

Definition at line 53 of file winmakemakefile.py.

00053 
00054 def realwork(vars, moddefns, target):
00055     version_suffix = "%r%r" % sys.version_info[:2]
00056     print("# Makefile for Microsoft Visual C++ generated by freeze.py script")
00057     print()
00058     print('target = %s' % target)
00059     print('pythonhome = %s' % vars['prefix'])
00060     print()
00061     print('DEBUG=0 # Set to 1 to use the _d versions of Python.')
00062     print('!IF $(DEBUG)')
00063     print('debug_suffix=_d')
00064     print('c_debug=/Zi /Od /DDEBUG /D_DEBUG')
00065     print('l_debug=/DEBUG')
00066     print('temp_dir=Build\\Debug')
00067     print('!ELSE')
00068     print('debug_suffix=')
00069     print('c_debug=/Ox')
00070     print('l_debug=')
00071     print('temp_dir=Build\\Release')
00072     print('!ENDIF')
00073     print()
00074 
00075     print('# The following line assumes you have built Python using the standard instructions')
00076     print('# Otherwise fix the following line to point to the library.')
00077     print('pythonlib = "$(pythonhome)/pcbuild/python%s$(debug_suffix).lib"' % version_suffix)
00078     print()
00079 
00080     # We only ever write one "entry point" symbol - either
00081     # "main" or "WinMain".  Therefore, there is no need to
00082     # pass a subsystem switch to the linker as it works it
00083     # out all by itself.  However, the subsystem _does_ determine
00084     # the file extension and additional linker flags.
00085     target_link_flags = ""
00086     target_ext = ".exe"
00087     if subsystem_details[vars['subsystem']][2]:
00088         target_link_flags = "-dll"
00089         target_ext = ".dll"
00090 
00091 
00092     print("# As the target uses Python%s.dll, we must use this compiler option!" % version_suffix)
00093     print("cdl = /MD")
00094     print()
00095     print("all: $(target)$(debug_suffix)%s" % (target_ext))
00096     print()
00097 
00098     print('$(temp_dir):')
00099     print('  if not exist $(temp_dir)\. mkdir $(temp_dir)')
00100     print()
00101 
00102     objects = []
00103     libs = ["shell32.lib", "comdlg32.lib", "wsock32.lib", "user32.lib", "oleaut32.lib"]
00104     for moddefn in moddefns:
00105         print("# Module", moddefn.name)
00106         for file in moddefn.sourceFiles:
00107             base = os.path.basename(file)
00108             base, ext = os.path.splitext(base)
00109             objects.append(base + ".obj")
00110             print('$(temp_dir)\%s.obj: "%s"' % (base, file))
00111             print("\t@$(CC) -c -nologo /Fo$* $(cdl) $(c_debug) /D BUILD_FREEZE", end=' ')
00112             print('"-I$(pythonhome)/Include"  "-I$(pythonhome)/PC" \\')
00113             print("\t\t$(cflags) $(cdebug) $(cinclude) \\")
00114             extra = moddefn.GetCompilerOptions()
00115             if extra:
00116                 print("\t\t%s \\" % (' '.join(extra),))
00117             print('\t\t"%s"' % file)
00118             print()
00119 
00120         # Add .lib files this module needs
00121         for modlib in moddefn.GetLinkerLibs():
00122             if modlib not in libs:
00123                 libs.append(modlib)
00124 
00125     print("ADDN_LINK_FILES=", end=' ')
00126     for addn in vars['addn_link']: print('"%s"' % (addn), end=' ')
00127     print() ; print()
00128 
00129     print("OBJS=", end=' ')
00130     for obj in objects: print('"$(temp_dir)\%s"' % (obj), end=' ')
00131     print() ; print()
00132 
00133     print("LIBS=", end=' ')
00134     for lib in libs: print('"%s"' % (lib), end=' ')
00135     print() ; print()
00136 
00137     print("$(target)$(debug_suffix)%s: $(temp_dir) $(OBJS)" % (target_ext))
00138     print("\tlink -out:$(target)$(debug_suffix)%s %s" %
00139           (target_ext, target_link_flags), "@<<")
00140     print("\t$(OBJS)")
00141     print("\t$(LIBS)")
00142     print("\t$(ADDN_LINK_FILES)")
00143     print("\t$(pythonlib) $(lcustom) $(l_debug)")
00144     print("\t$(resources)")
00145     print("<<")
00146     print()
00147     print("clean:")
00148     print("\t-rm -f *.obj")
00149     print("\t-rm -f $(target).exe")

Here is the caller graph for this function:


Variable Documentation

Initial value:
00001 """
00002 extern int PythonService_main(int, char **);
00003 
00004 int main( int argc, char **argv)
00005 {
00006     PyImport_FrozenModules = _PyImport_FrozenModules;
00007     return PythonService_main(argc, argv);
00008 }
00009 """

Definition at line 20 of file winmakemakefile.py.

Initial value:
00001 {
00002     # -s flag        : (C entry point template), (is it __main__?), (is it a DLL?)
00003     'console'        : (None,                    1,                 0),
00004     'windows'        : (WINMAINTEMPLATE,         1,                 0),
00005     'service'        : (SERVICETEMPLATE,         0,                 0),
00006     'com_dll'        : ("",                      0,                 1),
00007 }

Definition at line 30 of file winmakemakefile.py.

Initial value:
00001 """
00002 #include <windows.h>
00003 
00004 int WINAPI WinMain(
00005     HINSTANCE hInstance,      // handle to current instance
00006     HINSTANCE hPrevInstance,  // handle to previous instance
00007     LPSTR lpCmdLine,          // pointer to command line
00008     int nCmdShow              // show state of window
00009     )
00010 {
00011     extern int Py_FrozenMain(int, char **);
00012     PyImport_FrozenModules = _PyImport_FrozenModules;
00013     return Py_FrozenMain(__argc, __argv);
00014 }
00015 """

Definition at line 4 of file winmakemakefile.py.