@@ -515,6 +515,11 @@ def finalize_options(self):
515515 # Old Python version that doesn't support cross-compile
516516 self .plat_name = distutils .util .get_platform ()
517517
518+ def _link_executable (self , * args , ** kwargs ):
519+ del kwargs ['export_symbols' ]
520+ del kwargs ['build_temp' ]
521+ return self .compiler .link_executable (* args , ** kwargs )
522+
518523 def run (self ):
519524 build_ext .run (self )
520525 # self.run_command('build_scintilla')
@@ -532,6 +537,7 @@ def build_extensions(self):
532537 if not self .compiler .initialized :
533538 self .compiler .initialize ()
534539
540+ link_shared_object = self .compiler .link_shared_object
535541 # Here we hack a "pywin32" directory (one of 'win32', 'win32com',
536542 # 'pythonwin' etc), as distutils doesn't seem to like the concept
537543 # of multiple top-level directories.
@@ -541,7 +547,11 @@ def build_extensions(self):
541547 self .package = ext .get_pywin32_dir ()
542548 except AttributeError :
543549 raise RuntimeError ("Not a win32 package!" )
550+ if issubclass (type (ext ), WinExt_Executable ):
551+ self .compiler .link_shared_object = self ._link_executable
544552 self .build_extension (ext )
553+ if issubclass (type (ext ), WinExt_Executable ):
554+ self .compiler .link_shared_object = link_shared_object
545555 if not issubclass (type (ext ), WinExt_Executable ):
546556 extra = self .debug and "_d.lib" or ".lib"
547557 if ext .name in ("pywintypes" , "pythoncom" , "axscript" ):
@@ -627,20 +637,14 @@ def _copy_mfc(self):
627637 def get_ext_filename (self , name ):
628638 # The pywintypes and pythoncom extensions have special names
629639 extra_dll = self .debug and "_d.dll" or ".dll"
630- extra_exe = self .debug and "_d.exe" or ".exe"
631640 # *sob* - python fixed this bug in python 3.1 (bug 6403)
632641 # So in the fixed versions we only get the base name, and if the
633642 # output name is simply 'dir\name' we need to nothing.
634643
635- # 3.1+ pythoncom
636-
637- # The post 3.1 rest
638644 if name in ['perfmondata' , 'PyISAPI_loader' ]:
639645 return name + extra_dll
640- elif name in ['pythonservice' , 'Pythonwin' ]:
641- return name + extra_exe
642-
643- return build_ext .get_ext_filename (self , name )
646+ else :
647+ return build_ext .get_ext_filename (self , name )
644648
645649 def get_export_symbols (self , ext ):
646650 if issubclass (type (ext ), WinExt_Executable ):
@@ -1572,7 +1576,7 @@ def finalize_options(self):
15721576 "Pythonwin/pythonwin.rc" ,
15731577 "Pythonwin/stdafxpw.cpp" ,
15741578 ],
1575- extra_link_args = ["/SUBSYSTEM:WINDOWS" ],
1579+ extra_link_args = ["/SUBSYSTEM:WINDOWS" , "/ENTRY:wWinMainCRTStartup" ],
15761580 optional_headers = ['afxres.h' ]),
15771581]
15781582
0 commit comments