source:
docker/msys/py2exe.patch@
960:8e3a82e27332
Last change on this file since 960:8e3a82e27332 was 936:2d2c88cfc74a, checked in by , 6 years ago | |
---|---|
File size: 32.2 KB |
-
py2exe/distutils_buildexe.py
diff --git a/py2exe/distutils_buildexe.py b/py2exe/distutils_buildexe.py index ae8aca3..d809641 100644
a b class py2exe(Command): 154 154 self.ascii = 0 155 155 self.custom_boot_script = None 156 156 self.use_assembly = False 157 self.gi_namespaces = [] 157 158 158 159 def finalize_options (self): 159 160 self.optimize = int(self.optimize) … … class py2exe(Command): 239 240 excludes = self.excludes, 240 241 ignores = self.ignores, 241 242 packages = self.packages, 243 gi_namespaces = self.gi_namespaces, 242 244 dist_dist = self.dist_dir, 243 245 dll_excludes = self.dll_excludes, 244 246 typelibs = self.typelibs, -
py2exe/dllfinder.py
diff --git a/py2exe/dllfinder.py b/py2exe/dllfinder.py index 4e5e76c..bb43f9e 100644
a b class DllFinder: 68 68 if dll in self._loaded_dlls: 69 69 continue 70 70 for dep_dll in self.bind_image(dll): 71 if dep_dll in self._loaded_dlls: 71 bname = os.path.basename(dep_dll).lower() 72 if bname in self._loaded_dlls: 72 73 continue 73 74 dll_type = self.determine_dll_type(dep_dll) 74 75 if dll_type is None: … … class DllFinder: 144 145 deps = self.bind_image(imagename) 145 146 if pydll in [d.lower() for d in deps]: 146 147 return "EXT" 147 if fnm.startswith(windir + os.sep) or fnm.startswith(sysdir + os.sep): 148 if fnm.startswith(windir + os.sep) or fnm.startswith(sysdir + os.sep) or \ 149 fnm.startswith(windir + '\\') or fnm.startswith(sysdir + '\\'): 148 150 return None 149 151 return "DLL" 150 152 -
py2exe/gihelper.py
diff --git a/py2exe/gihelper.py b/py2exe/gihelper.py index e69de29..f597692 100644
a b 1 2 import cffi 3 4 class GIHelper(object): 5 _cdef=""" 6 typedef char gchar; 7 typedef int gint; 8 typedef uint32_t guint32; 9 typedef guint32 GQuark; 10 11 typedef struct { 12 GQuark domain; 13 gint code; 14 gchar *message; 15 } GError; 16 17 typedef struct _GITypelib GITypelib; 18 typedef struct _GIRepository GIRepository; 19 20 typedef enum 21 { 22 G_IREPOSITORY_LOAD_FLAG_LAZY = 1 23 } GIRepositoryLoadFlags; 24 25 GIRepository *g_irepository_get_default (void); 26 27 GITypelib * g_irepository_require (GIRepository *repository, 28 const gchar *namespace_, 29 const gchar *version, 30 GIRepositoryLoadFlags flags, 31 GError **error); 32 33 const gchar * g_irepository_get_shared_library (GIRepository *repository, 34 const gchar *namespace_); 35 """ 36 37 def __init__(self): 38 self._ffi = cffi.FFI() 39 self._ffi.cdef(self._cdef) 40 41 self._lib = self._ffi.dlopen("libgirepository-1.0-1.dll") 42 43 self._repo=self._lib.g_irepository_get_default() 44 45 self._error = self._ffi.new("GError**") 46 47 def getSharedLibraries(self, namespace, version): 48 typelib = self._lib.g_irepository_require(self._repo, 49 bytes(namespace, "utf-8"), 50 bytes(version, "utf-8"), 51 0, self._error) 52 if typelib == self._ffi.NULL: 53 return [] 54 else: 55 return str( 56 self._ffi.string( 57 self._lib.g_irepository_get_shared_library( 58 self._repo, bytes(namespace, "utf-8"))), "utf-8").split(",") -
py2exe/mf3.py
diff --git a/py2exe/mf3.py b/py2exe/mf3.py index f645740..ec1f261 100644
a b 5 5 6 6 # XXX XXX XXX Does not yet support PEP 452 namespace packages! 7 7 8 from . import gihelper 8 9 from collections import defaultdict 9 10 import dis 10 11 import importlib … … LOAD_CONST = dis.opname.index('LOAD_CONST') 21 22 IMPORT_NAME = dis.opname.index('IMPORT_NAME') 22 23 STORE_NAME = dis.opname.index('STORE_NAME') 23 24 STORE_GLOBAL = dis.opname.index('STORE_GLOBAL') 25 LOAD_NAME = dis.opname.index('LOAD_NAME') 26 LOAD_METHOD = dis.opname.index('LOAD_METHOD') 27 CALL_METHOD = dis.opname.index('CALL_METHOD') 24 28 STORE_OPS = [STORE_NAME, STORE_GLOBAL] 25 29 HAVE_ARGUMENT = dis.HAVE_ARGUMENT 26 30 … … class ModuleFinder: 63 67 self._depgraph = defaultdict(set) 64 68 self._indent = "" 65 69 self._package_paths = defaultdict(list) 66 70 self._gihelper = gihelper.GIHelper() 67 71 68 72 def add_packagepath(self, packagename, path): 69 73 """ModuleFinder can not handle __path__ modifications packages … … class ModuleFinder: 416 420 We also take note of 'static' global symbols in the module and 417 421 add them to __globalnames__. 418 422 """ 419 420 423 for what, args in self._scan_opcodes(code): 421 424 if what == "store": 422 425 name, = args … … class ModuleFinder: 424 427 elif what == "import": 425 428 level, fromlist, name = args 426 429 self.safe_import_hook(name, mod, fromlist, level) 430 elif what == "gi_request": 431 for sharedLibrary in \ 432 self._gihelper.getSharedLibraries(args[0], args[1]): 433 from . dllfinder import SearchPath 434 self.add_dll(SearchPath(sharedLibrary)) 427 435 else: 428 436 # We don't expect anything else from the generator. 429 437 raise RuntimeError(what) … … class ModuleFinder: 442 450 # dis.get_instructions() is only available in python 3.4 443 451 # and higher 444 452 instructions = [] 453 454 requireCallLevel = 0 455 requiredNamespace = None 456 requiredVersion = None 445 457 for inst in dis.get_instructions(co): 446 458 instructions.append(inst) 447 459 c = inst.opcode 448 460 if c == IMPORT_NAME: 461 requireCallLevel = 0 449 462 assert instructions[-3].opcode == LOAD_CONST 450 463 level = instructions[-3].argval 451 464 assert instructions[-2].opcode == LOAD_CONST … … class ModuleFinder: 453 466 name = inst.argval 454 467 yield "import", (level, fromlist, name) 455 468 elif c in STORE_OPS: 469 requireCallLevel = 0 456 470 yield "store", (inst.argval,) 471 elif c == LOAD_NAME: 472 if requireCallLevel==0 and inst.argval=="gi": 473 requireCallLevel += 1 474 else: 475 requireCallLevel = 0 476 elif c == LOAD_METHOD: 477 if requireCallLevel==1 and inst.argval=="require_version": 478 requireCallLevel += 1 479 else: 480 requireCallLevel = 0 481 elif c==LOAD_CONST: 482 if requireCallLevel==2: 483 requiredNamespace = inst.argval 484 requireCallLevel += 1 485 elif requireCallLevel==3: 486 requiredVersion = inst.argval 487 requireCallLevel += 1 488 else: 489 requireCallLevel = 0 490 elif c==CALL_METHOD: 491 if requireCallLevel==4: 492 yield ("gi_request", (requiredNamespace, requiredVersion)) 493 requireCallLevel = 0 494 requiredNamespace = None 495 requiredVersion = None 496 457 497 else: 458 498 code = co.co_code 459 499 names = co.co_names -
py2exe/py2exe_distutils.py
diff --git a/py2exe/py2exe_distutils.py b/py2exe/py2exe_distutils.py index 3918849..fe97b90 100644
a b 1 1 # This file is only used when BUILDING py2exe. 2 import os, sys 2 import os, sys, types, copy 3 3 4 4 from distutils.core import Extension 5 5 from distutils.dist import Distribution … … from distutils.sysconfig import customize_compiler 8 8 from distutils.dep_util import newer_group 9 9 from distutils.errors import DistutilsError, DistutilsSetupError, DistutilsPlatformError 10 10 from distutils.errors import CCompilerError, CompileError 11 from distutils.file_util import write_file 11 12 from distutils.util import get_platform 12 13 from distutils import log 13 14 14 # We don't need a manifest in the executable, so monkeypatch the code away: 15 from distutils.msvc9compiler import MSVCCompiler 16 MSVCCompiler.manifest_setup_ldargs = lambda *args: None 15 from distutils import ccompiler 16 isMingw32 = ccompiler.get_default_compiler()=='mingw32' 17 18 if not isMingw32: 19 # We don't need a manifest in the executable, so monkeypatch the code away: 20 from distutils.msvc9compiler import MSVCCompiler 21 MSVCCompiler.manifest_setup_ldargs = lambda *args: None 17 22 18 23 class Interpreter(Extension): 19 24 def __init__(self, *args, **kw): … … class Dist(Distribution): 38 43 def has_extensions(self): 39 44 return False 40 45 46 def mingw32_link(self, target_desc, objects, output_filename, output_dir=None, 47 libraries=None, library_dirs=None, runtime_library_dirs=None, 48 export_symbols=None, debug=0, extra_preargs=None, 49 extra_postargs=None, build_temp=None, target_lang=None): 50 """Link the objects.""" 51 from distutils.unixccompiler import UnixCCompiler 52 53 # use separate copies, so we can modify the lists 54 extra_preargs = copy.copy(extra_preargs or []) 55 libraries = copy.copy(libraries or []) 56 objects = copy.copy(objects or []) 57 58 # Additional libraries 59 libraries.extend(self.dll_libraries) 60 61 # handle export symbols by creating a def-file 62 # with executables this only works with gcc/ld as linker 63 if ((export_symbols is not None) and 64 (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): 65 # (The linker doesn't do anything if output is up-to-date. 66 # So it would probably better to check if we really need this, 67 # but for this we had to insert some unchanged parts of 68 # UnixCCompiler, and this is not what we want.) 69 70 # we want to put some files in the same directory as the 71 # object files are, build_temp doesn't help much 72 # where are the object files 73 temp_dir = os.path.dirname(objects[0]) 74 # name of dll to give the helper files the same base name 75 (dll_name, dll_extension) = os.path.splitext( 76 os.path.basename(output_filename)) 77 78 # generate the filenames for these files 79 def_file = os.path.join(temp_dir, dll_name + ".def") 80 lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a") 81 82 # Generate .def file 83 contents = ["EXPORTS"] 84 for sym in export_symbols: 85 contents.append(sym) 86 self.execute(write_file, (def_file, contents), 87 "writing %s" % def_file) 88 89 # next add options for def-file and to creating import libraries 90 91 # dllwrap uses different options than gcc/ld 92 if self.linker_dll == "dllwrap": 93 extra_preargs.extend(["--output-lib", lib_file]) 94 # for dllwrap we have to use a special option 95 extra_preargs.extend(["--def", def_file]) 96 # we use gcc/ld here and can be sure ld is >= 2.9.10 97 else: 98 # doesn't work: bfd_close build\...\libfoo.a: Invalid operation 99 #extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file]) 100 # for gcc/ld the def-file is specified as any object files 101 objects.append(def_file) 102 103 #end: if ((export_symbols is not None) and 104 # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): 105 106 # who wants symbols and a many times larger output file 107 # should explicitly switch the debug mode on 108 # otherwise we let dllwrap/ld strip the output file 109 # (On my machine: 10KiB < stripped_file < ??100KiB 110 # unstripped_file = stripped_file + XXX KiB 111 # ( XXX=254 for a typical python extension)) 112 if not debug and not hasattr(sys, 'gettotalrefcount'): 113 extra_preargs.append("-s") 114 115 UnixCCompiler.link(self, target_desc, objects, output_filename, 116 output_dir, libraries, library_dirs, 117 runtime_library_dirs, 118 None, # export_symbols, we do this in our def-file 119 debug, extra_preargs, extra_postargs, build_temp, 120 target_lang) 121 41 122 class BuildInterpreters(build_ext.build_ext): 42 123 description = "build special python interpreter stubs" 43 124 … … class BuildInterpreters(build_ext.build_ext): 67 148 if os.name == 'nt' and self.plat_name != get_platform(): 68 149 self.compiler.initialize(self.plat_name) 69 150 151 if isMingw32: 152 self.compiler.link = types.MethodType(mingw32_link, self.compiler) 153 70 154 # And make sure that any compile/link-related options (which might 71 155 # come from the command-line or from the setup script) are set in 72 156 # that CCompiler object -- that way, they automatically apply to … … class BuildInterpreters(build_ext.build_ext): 190 274 libraries=self.get_libraries(ext), 191 275 library_dirs=ext.library_dirs, 192 276 runtime_library_dirs=ext.runtime_library_dirs, 193 export_symbols=ext.export_symbols ,277 export_symbols=ext.export_symbols if ext.export_symbols else None, 194 278 extra_postargs=extra_args, 195 279 debug=self.debug) 196 280 -
py2exe/runtime.py
diff --git a/py2exe/runtime.py b/py2exe/runtime.py index 10b0fa9..d154ff7 100644
a b from .icons import BuildIcons 19 19 20 20 logger = logging.getLogger("runtime") 21 21 22 #from importlib.machinery import EXTENSION_SUFFIXES23 EXTENSION_SUFFIXES = ['.pyd']22 from importlib.machinery import EXTENSION_SUFFIXES 23 #EXTENSION_SUFFIXES = ['.pyd'] 24 24 from importlib.machinery import DEBUG_BYTECODE_SUFFIXES, OPTIMIZED_BYTECODE_SUFFIXES 25 25 26 26 RT_MANIFEST = 24 … … class Runtime(object): 248 248 if os.path.isfile(libpath): 249 249 os.remove(libpath) 250 250 251 if not os.path.exists(os.path.dirname(libpath)): 252 os.mkdir(os.path.dirname(libpath)) 253 254 dll_bytes = pkgutil.get_data("py2exe", "resources.dll") 255 with open(libpath, "wb") as ofi: 256 ofi.write(dll_bytes) 251 if self.options.skip_archive: 252 if not os.path.exists(libpath): 253 os.makedirs(libpath) 254 else: 255 if not os.path.exists(os.path.dirname(libpath)): 256 os.mkdir(os.path.dirname(libpath)) 257 dll_bytes = pkgutil.get_data("py2exe", "resources.dll") 258 with open(libpath, "wb") as ofi: 259 ofi.write(dll_bytes) 257 260 if options.verbose: 258 261 print("Building shared code archive '%s'." % libpath) 259 262 # Archive is appended to resources.dll; remove the icon … … class Runtime(object): 263 266 264 267 self.copy_files(destdir) 265 268 266 # data directories from modulefinder 269 # data directories from modulefinder 267 270 for name, (src, recursive) in self.mf._data_directories.items(): 268 271 if recursive: 269 272 dst = os.path.join(destdir, name) … … class Runtime(object): 274 277 else: 275 278 raise RuntimeError("not yet supported") 276 279 277 # data files from modulefinder 278 for name, src in self.mf._data_files.items(): 279 dst = os.path.join(destdir, name) 280 shutil.copy2(src, dst) 281 280 # data files from modulefinder 281 for name, src in self.mf._data_files.items(): 282 dst = os.path.join(destdir, name) 283 shutil.copy2(src, dst) 284 282 285 # other data files 283 286 if self.options.data_files: 284 287 for subdir, files in self.options.data_files: … … class Runtime(object): 410 413 compression = zipfile.ZIP_STORED 411 414 412 415 # Create a zipfile and append it to the library file 413 arc = zipfile.ZipFile(libpath, "a", 414 compression=compression) 415 416 # The same modules may be in self.ms.modules under different 417 # keys; we only need one of them in the archive. 418 for mod in set(self.mf.modules.values()): 419 if mod.__code__: 420 if hasattr(mod, "__path__"): 421 path = mod.__name__.replace(".", "\\") + "\\__init__" + bytecode_suffix 422 else: 423 path = mod.__name__.replace(".", "\\") + bytecode_suffix 424 stream = io.BytesIO() 425 stream.write(imp.get_magic()) 426 if sys.version_info >= (3,7,0): 427 stream.write(b"\0\0\0\0") # null flags 428 stream.write(b"\0\0\0\0") # null timestamp 429 stream.write(b"\0\0\0\0") # null size 430 marshal.dump(mod.__code__, stream) 431 arc.writestr(path, stream.getvalue()) 432 433 elif hasattr(mod, "__file__"): 434 #assert mod.__file__.endswith(EXTENSION_SUFFIXES[0]) 435 if self.options.bundle_files <= 2: 436 # put .pyds into the archive 437 arcfnm = mod.__name__.replace(".", "\\") + EXTENSION_SUFFIXES[0] 438 if self.options.verbose > 1: 439 print("Add %s to %s" % (os.path.basename(mod.__file__), libpath)) 440 arc.write(mod.__file__, arcfnm) 441 else: 442 # The extension modules will be copied into 443 # dlldir. To be able to import it without dlldir 444 # being on sys.path, create a loader module and 445 # put that into the archive. 446 pydfile = mod.__name__ + EXTENSION_SUFFIXES[0] 447 if self.options.verbose > 1: 448 print("Add Loader for %s to %s" % (os.path.basename(mod.__file__), libpath)) 449 loader = LOAD_FROM_DIR.format(pydfile) 450 451 code = compile(loader, "<loader>", "exec", 452 optimize=self.options.optimize) 416 if self.options.skip_archive: 417 for mod in set(self.mf.modules.values()): 418 if hasattr(mod, "__file__"): 419 path = os.path.join(*mod.__name__.split(".")) 420 if hasattr(mod, "__path__"): 421 path = os.path.join(path, "__init__") 422 path += bytecode_suffix if mod.__code__ else EXTENSION_SUFFIXES[0] 423 path = os.path.join(libpath, path) 424 dirpath = os.path.dirname(path) 425 if not os.path.isdir(dirpath): 426 os.makedirs(dirpath) 427 if mod.__code__: 428 with open(mod.__file__, "rt") as fin: 429 code = compile(fin.read(), mod.__file__, "exec", 430 optimize=self.options.optimize) 431 with open(path, "wb") as fout: 432 fout.write(imp.get_magic()) 433 if sys.version_info >= (3,7,0): 434 fout.write(b"\0\0\0\0") # null flags 435 fout.write(b"\0\0\0\0") # null timestamp 436 fout.write(b"\0\0\0\0") # null size 437 marshal.dump(code, fout) 438 else: 439 shutil.copy2(mod.__file__, path) 440 else: 441 arc = zipfile.ZipFile(libpath, "a", 442 compression=compression) 443 444 # The same modules may be in self.ms.modules under different 445 # keys; we only need one of them in the archive. 446 for mod in set(self.mf.modules.values()): 447 if mod.__code__: 453 448 if hasattr(mod, "__path__"): 454 449 path = mod.__name__.replace(".", "\\") + "\\__init__" + bytecode_suffix 455 450 else: … … class Runtime(object): 457 452 stream = io.BytesIO() 458 453 stream.write(imp.get_magic()) 459 454 if sys.version_info >= (3,7,0): 460 stream.write(b"\0\0\0\0") # null flags 455 stream.write(b"\0\0\0\0") # null flags 461 456 stream.write(b"\0\0\0\0") # null timestamp 462 457 stream.write(b"\0\0\0\0") # null size 463 marshal.dump( code, stream)458 marshal.dump(mod.__code__, stream) 464 459 arc.writestr(path, stream.getvalue()) 465 460 466 if self.options.bundle_files == 0: 467 # put everything into the arc 468 files = self.mf.all_dlls() 469 elif self.options.bundle_files in (1, 2): 470 # put only extension dlls into the arc 471 files = self.mf.extension_dlls() 472 else: 473 arc.close() 474 return 461 elif hasattr(mod, "__file__"): 462 #assert mod.__file__.endswith(EXTENSION_SUFFIXES[0]) 463 if self.options.bundle_files <= 2: 464 # put .pyds into the archive 465 arcfnm = mod.__name__.replace(".", "\\") + EXTENSION_SUFFIXES[0] 466 if self.options.verbose > 1: 467 print("Add %s to %s" % (os.path.basename(mod.__file__), libpath)) 468 arc.write(mod.__file__, arcfnm) 469 else: 470 # The extension modules will be copied into 471 # dlldir. To be able to import it without dlldir 472 # being on sys.path, create a loader module and 473 # put that into the archive. 474 pydfile = mod.__name__ + EXTENSION_SUFFIXES[0] 475 if self.options.verbose > 1: 476 print("Add Loader for %s to %s" % (os.path.basename(mod.__file__), libpath)) 477 loader = LOAD_FROM_DIR.format(pydfile) 478 479 code = compile(loader, "<loader>", "exec", 480 optimize=self.options.optimize) 481 if hasattr(mod, "__path__"): 482 path = mod.__name__.replace(".", "\\") + "\\__init__" + bytecode_suffix 483 else: 484 path = mod.__name__.replace(".", "\\") + bytecode_suffix 485 stream = io.BytesIO() 486 stream.write(imp.get_magic()) 487 if sys.version_info >= (3,7,0): 488 stream.write(b"\0\0\0\0") # null flags 489 stream.write(b"\0\0\0\0") # null timestamp 490 stream.write(b"\0\0\0\0") # null size 491 marshal.dump(code, stream) 492 arc.writestr(path, stream.getvalue()) 493 494 if self.options.bundle_files == 0: 495 # put everything into the arc 496 files = self.mf.all_dlls() 497 elif self.options.bundle_files in (1, 2): 498 # put only extension dlls into the arc 499 files = self.mf.extension_dlls() 500 else: 501 arc.close() 502 return 475 503 476 for src in files:477 if self.options.verbose > 1:478 print("Add DLL %s to %s" % (os.path.basename(src), libpath))479 arc.write(src, os.path.basename(src))504 for src in files: 505 if self.options.verbose > 1: 506 print("Add DLL %s to %s" % (os.path.basename(src), libpath)) 507 arc.write(src, os.path.basename(src)) 480 508 481 arc.close()509 arc.close() 482 510 483 511 def copy_files(self, destdir): 484 512 """Copy files (pyds, dlls, depending on the bundle_files value, … … class Runtime(object): 498 526 with UpdateResources(dst, delete_existing=False) as resource: 499 527 resource.add_string(1000, "py2exe") 500 528 501 if self.options.bundle_files == 3:529 if not self.options.skip_archive and self.options.bundle_files == 3: 502 530 # copy extension modules; they go to libdir 503 531 for mod in self.mf.modules.values(): 504 532 if mod.__code__: 505 533 # nothing to do for python modules. 506 534 continue 507 535 if hasattr(mod, "__file__"): 508 assert mod.__file__.endswith(EXTENSION_SUFFIXES[0])509 pydfile = mod.__name__ + EXTENSION_SUFFIXES[0]536 if mod.__file__.endswith(EXTENSION_SUFFIXES[0]): 537 pydfile = mod.__name__ + EXTENSION_SUFFIXES[0] 510 538 511 dst = os.path.join(libdir, pydfile) 539 dst = os.path.join(libdir, pydfile) 540 else: 541 dst = os.path.join(libdir, os.path.basename(mod.__file__)) 512 542 if self.options.verbose: 513 543 print("Copy %s to %s" % (mod.__file__, dst)) 514 544 shutil.copy2(mod.__file__, dst) … … def __load(): 638 668 dllpath = os.path.join(os.path.dirname(__loader__.archive), r'{0}') 639 669 try: 640 670 mod = imp.load_dynamic(__name__, dllpath) 671 mod.frozen = 1 641 672 except ImportError as details: 642 673 raise ImportError('(%s) %r' % (details, dllpath)) from None 643 mod.frozen = 1 674 except AttributeError: 675 pass 644 676 __load() 645 677 del __load 646 678 """ -
setup.py
diff --git a/setup.py b/setup.py index 342d194..5fb5a9a 100644
a b if sys.version_info < (3, 3): 12 12 ############################################################################ 13 13 14 14 from setuptools import setup 15 from distutils import ccompiler 16 isMingw32 = ccompiler.get_default_compiler()=='mingw32' 15 17 ##from distutils.core import setup 16 18 17 19 from py2exe.py2exe_distutils import Dist, Interpreter, BuildInterpreters … … def _is_debug_build(): 26 28 return False 27 29 28 30 if _is_debug_build(): 29 macros = [("PYTHONDLL", '\\"python%d%d_d.dll\\"'% sys.version_info[:2]),31 macros = [("PYTHONDLL", ('"libpython%d.%dm_d.dll"' if isMingw32 else '"\\python%d%d_d.dll\\"') % sys.version_info[:2]), 30 32 ## ("PYTHONCOM", '\\"pythoncom%d%d_d.dll\\"' % sys.version_info[:2]), 31 33 ("_CRT_SECURE_NO_WARNINGS", '1')] 32 34 else: 33 macros = [("PYTHONDLL", '\\"python%d%d.dll\\"'% sys.version_info[:2]),35 macros = [("PYTHONDLL", ('"libpython%d.%dm.dll"' if isMingw32 else '"\\python%d%d.dll\\"') % sys.version_info[:2]), 34 36 ## ("PYTHONCOM", '\\"pythoncom%d%d.dll\\"' % sys.version_info[:2]), 35 37 ("_CRT_SECURE_NO_WARNINGS", '1'),] 36 38 … … macros.append(("Py_BUILD_CORE", '1')) 39 41 extra_compile_args = [] 40 42 extra_link_args = [] 41 43 42 extra_compile_args.append("-IC:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Include") 43 extra_compile_args.append("-IC:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include") 44 extra_compile_args.append("-IC:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10586.0\\ucrt") 44 if not isMingw32: 45 extra_compile_args.append("-IC:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Include") 46 extra_compile_args.append("-IC:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include") 47 extra_compile_args.append("-IC:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10586.0\\ucrt") 45 48 46 49 if 0: 47 50 # enable this to debug a release build … … run_ctypes_dll = Interpreter("py2exe.run_ctypes_dll", 63 66 "source/python-dynload.c", 64 67 ], 65 68 libraries=["user32", "shell32"], 66 export_symbols=["DllCanUnloadNow,PRIVATE", 69 export_symbols=["DllCanUnloadNow", 70 "DllGetClassObject", 71 "DllRegisterServer", 72 "DllUnregisterServer", 73 ] if isMingw32 else ["DllCanUnloadNow,PRIVATE", 67 74 "DllGetClassObject,PRIVATE", 68 75 "DllRegisterServer,PRIVATE", 69 76 "DllUnregisterServer,PRIVATE", … … run_ctypes_dll = Interpreter("py2exe.run_ctypes_dll", 71 78 target_desc = "shared_library", 72 79 define_macros=macros, 73 80 extra_compile_args=extra_compile_args, 74 extra_link_args=extra_link_args + ["/DLL"],81 extra_link_args=extra_link_args + ([] if isMingw32 else ["/DLL"]), 75 82 ) 76 83 77 84 run = Interpreter("py2exe.run", … … resource_dll = Interpreter("py2exe.resources", 123 130 ["source/dll.c", 124 131 "source/icon.rc"], 125 132 target_desc = "shared_library", 126 extra_link_args=[ "/DLL"],133 extra_link_args=[] if isMingw32 else ["/DLL"], 127 134 ) 128 135 129 136 interpreters = [run, run_w, resource_dll, -
source/python-dynload.c
diff --git a/source/python-dynload.c b/source/python-dynload.c index 2a60b86..373bb62 100644
a b static HMODULE hmod_pydll; 31 31 32 32 #define FUNC(res, name, args) \ 33 33 static res(*proc)args; \ 34 if (!proc) (FARPROC)proc =MyGetProcAddress(hmod_pydll, #name)34 if (!proc) proc = (res (*)args)MyGetProcAddress(hmod_pydll, #name) 35 35 36 36 #define DATA(type, name) \ 37 37 static type pflag; \ … … void PyErr_Print(void) 158 158 proc(); 159 159 } 160 160 161 void Py_SetProgramName( wchar_t *name)161 void Py_SetProgramName(const wchar_t *name) 162 162 { 163 163 FUNC(void, Py_SetProgramName, (wchar_t *)); 164 164 proc(name); -
source/run.c
diff --git a/source/run.c b/source/run.c index e1f630e..933ae77 100644
a b extern int start(int argc, wchar_t **argv); 54 54 /* 55 55 The main function for our exe. 56 56 */ 57 #if defined(__MINGW32__) 58 int main (int argc, wchar_t **argv) 59 #else 57 60 int wmain (int argc, wchar_t **argv) 61 #endif 58 62 { 59 63 int result; 60 64 result = init("console_exe"); -
source/start.c
diff --git a/source/start.c b/source/start.c index e894ae6..6b61624 100644
a b BOOL locate_script(HMODULE hmod) 128 128 SystemError(GetLastError(), "Could not load script resource:"); 129 129 return FALSE; 130 130 } 131 p_script_info = (struct scriptinfo *) pScript = LockResource(hgbl);131 p_script_info = (struct scriptinfo *)(pScript = LockResource(hgbl)); 132 132 if (!pScript) { 133 133 SystemError(GetLastError(), "Could not lock script resource:"); 134 134 return FALSE; -
setup.py
diff --git a/setup.py b/setup.py index 342d194..1fe1e43 100644
a b run_w = Interpreter("py2exe.run_w", 107 107 libraries=["user32", "shell32"], 108 108 define_macros=macros, 109 109 extra_compile_args=extra_compile_args, 110 extra_link_args=extra_link_args ,110 extra_link_args=extra_link_args + (["-Wl,--subsystem,windows"] if isMingw32 else []), 111 111 ) 112 112 113 113 # The py2exe.resources name is special handled in BuildInterpreters;
Note:
See TracBrowser
for help on using the repository browser.