root/Softs/py2exe-0.6.6_one_exe.diff

リビジョン 41, 4.5 kB (コミッタ: mtamaki, 3 年 前)
  • py2exe/build_exe.py

    diff -ur py2exe-0.6.6_src/py2exe/build_exe.py py2exe-0.6.6_one_exe/py2exe/build_exe.py
    old new  
    464464            if base.lower() in self.dlls_in_exedir: 
    465465                # pythonXY.dll must be bundled as resource. 
    466466                # w9xpopen.exe must be copied to self.exe_dir. 
    467                 if base.lower() == python_dll.lower() and self.bundle_files < 2: 
     467                if (base.lower() == python_dll.lower() or base.lower() == "msvcr71.dll") and self.bundle_files < 2: 
    468468                    dst = os.path.join(self.bundle_dir, base) 
    469469                else: 
    470470                    dst = os.path.join(self.exe_dir, base) 
     
    789789 
    790790            # add the pythondll as resource, and delete in self.exe_dir 
    791791            if self.bundle_files < 2 and self.distribution.zipfile is None: 
    792                 # bundle pythonxy.dll 
    793                 dll_path = os.path.join(self.bundle_dir, python_dll) 
    794                 bytes = open(dll_path, "rb").read() 
    795                 # image, bytes, lpName, lpType 
     792                def add_resource_dll( name ): 
     793                    # bundle pythonxy.dll 
     794                    dll_path = os.path.join(self.bundle_dir, name) 
     795                    bytes = open(dll_path, "rb").read() 
     796                    # image, bytes, lpName, lpType 
    796797 
    797                 print "Adding %s as resource to %s" % (python_dll, exe_path) 
    798                 add_resource(unicode(exe_path), bytes, 
     798                    print "Adding %s as resource to %s" % (name, exe_path) 
     799                    add_resource(unicode(exe_path), bytes, 
    799800                             # for some reason, the 3. argument MUST BE UPPER CASE, 
    800801                             # otherwise the resource will not be found. 
    801                              unicode(python_dll).upper(), 1, False) 
     802                             unicode(name).upper(), 1, False) 
     803                add_resource_dll( "msvcr71.dll" ) 
     804                add_resource_dll( python_dll ) 
    802805 
    803806            if self.compressed and self.bundle_files < 3 and self.distribution.zipfile is None: 
    804807                zlib_file = imp.find_module("zlib")[0] 
  • py2exe-0.6.

    diff -ur py2exe-0.6.6_src/setup.py py2exe-0.6.6_one_exe/setup.py
    old new  
    5252            del kw['target_desc'] 
    5353        else: 
    5454            self.target_desc = "executable" 
     55        kw['extra_compile_args'] = ["/MT"] 
    5556        Extension.__init__(self, *args, **kw) 
    5657 
    5758 
     
    345346                          "source/_memimporter_module.c"], 
    346347                         depends=depends + ["source/_memimporter.c"], 
    347348                         define_macros=macros, 
     349                         extra_compile_args=["/MT"] 
    348350                         ) 
    349351 
    350352run = Interpreter("py2exe.run", 
     
    446448      ext_modules = [_memimporter, 
    447449                     Extension("py2exe.py2exe_util", 
    448450                               sources=["source/py2exe_util.c"], 
    449                                libraries=["imagehlp"]), 
     451                               libraries=["imagehlp"], 
     452                               extra_compile_args=["/MT"]), 
    450453                     ], 
    451454      py_modules = ["zipextimporter"], 
    452455      scripts = ["py2exe_postinstall.py"], 
  • source/start.c

    diff -ur py2exe-0.6.6_src/source/start.c py2exe-0.6.6_one_exe/source/start.c
    old new  
    160160        return data; 
    161161} 
    162162 
     163void _TryLoadCRTDLLFromResource(HMODULE hmod, char* dllName) 
     164{ 
     165        HRSRC hrsrc = FindResource(hmod, MAKEINTRESOURCE(1), dllName); 
     166        if (hrsrc) { 
     167                int i; 
     168                HMODULE hmod = NULL; 
     169                struct IMPORT *p = imports; 
     170                HGLOBAL hgbl = LoadResource(hmod, hrsrc); 
     171                char *bytes = LockResource(hgbl); 
     172                if (!bytes) 
     173                        return; 
     174                hmod = MemoryLoadLibrary(dllName, bytes); 
     175                if (hmod) { 
     176                        for (i = 0; p->name; ++i, ++p) { 
     177                                p->proc = (void (*)())MemoryGetProcAddress(hmod, p->name); 
     178                                if (p->proc == NULL) { 
     179                                        break; 
     180                                } 
     181                        } 
     182                } 
     183        } 
     184} 
     185 
    163186BOOL _LoadPythonDLL(HMODULE hmod) 
    164187{ 
    165188        HRSRC hrsrc; 
     
    169192        if (!dirname[0]) 
    170193                calc_dirname(hmod); 
    171194 
     195        _TryLoadCRTDLLFromResource(hmod, "MSVCR71.DLL"); 
     196 
    172197        // Try to locate pythonxy.dll as resource in the exe 
    173198        hrsrc = FindResource(hmod, MAKEINTRESOURCE(1), PYTHONDLL); 
    174199        if (hrsrc) { 
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。