How to use the py2exe.build_exe._isSystemDLL function in py2exe

To help you get started, we’ve selected a few py2exe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Surgo / python-innosetup / innosetup / innosetup.py View on Github external
__import__(modname)
            return getattr(sys.modules[name], '__path__', [])[1:]
        except ImportError:
            pass
        return default

    def __setitem__(self, name, value):
        packagePathMap[name] = value
modulefinder.packagePathMap = PackagePathMap()


# fix a problem that `py2exe` includes MinWin's ApiSet Stub DLLs on Windows 7.
# http://www.avertlabs.com/research/blog/index.php/2010/01/05/windows-7-kernel-api-refactoring/

if sys.getwindowsversion()[:2] >= (6, 1):
    build_exe._isSystemDLL = build_exe.isSystemDLL

    def isSystemDLL(pathname):
        if build_exe._isSystemDLL(pathname):
            return True
        try:
            language = win32api.GetFileVersionInfo(pathname,
                '\\VarFileInfo\\Translation')
            company = win32api.GetFileVersionInfo(pathname,
                '\\StringFileInfo\\%.4x%.4x\\CompanyName' % language[0])
            if company.lower() == 'microsoft corporation':
                return True
        except Exception:
            pass
        return False
    build_exe.isSystemDLL = isSystemDLL
github Surgo / python-innosetup / innosetup / innosetup.py View on Github external
def isSystemDLL(pathname):
        if build_exe._isSystemDLL(pathname):
            return True
        try:
            language = win32api.GetFileVersionInfo(pathname,
                '\\VarFileInfo\\Translation')
            company = win32api.GetFileVersionInfo(pathname,
                '\\StringFileInfo\\%.4x%.4x\\CompanyName' % language[0])
            if company.lower() == 'microsoft corporation':
                return True
        except Exception:
            pass
        return False
    build_exe.isSystemDLL = isSystemDLL