Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
__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
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