How to use the py2exe.dllfinder.DllFinder.determine_dll_type 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 nvaccess / nvda / source / setup.py View on Github external
/>
			
			
			
			
		 
	

"""

# py2exe's idea of whether a dll is a system dll appears to be wrong sometimes, so monkey patch it.
orig_determine_dll_type = DllFinder.determine_dll_type
def determine_dll_type(self, imagename):
	dll = os.path.basename(imagename).lower()
	if dll.startswith("api-ms-win-") or dll in ("powrprof.dll", "mpr.dll", "crypt32.dll"):
		# These are definitely system dlls available on all systems and must be excluded.
		# Including them can cause serious problems when a binary build is run on a different version of Windows.
		return None
	return orig_determine_dll_type(self, imagename)
DllFinder.determine_dll_type = determine_dll_type

class py2exe(distutils_buildexe.py2exe):
	"""Overridden py2exe command to:
		* Add a command line option --enable-uiAccess to enable uiAccess for the main executable and EOA proxy
		* Add a manifest to the executables
	"""

	user_options = distutils_buildexe.py2exe.user_options + [
github nvaccess / nvda / source / setup.py View on Github external
/>
		 
	

"""

# py2exe's idea of whether a dll is a system dll appears to be wrong sometimes, so monkey patch it.
orig_determine_dll_type = DllFinder.determine_dll_type
def determine_dll_type(self, imagename):
	dll = os.path.basename(imagename).lower()
	if dll.startswith("api-ms-win-") or dll in ("powrprof.dll", "mpr.dll", "crypt32.dll"):
		# These are definitely system dlls available on all systems and must be excluded.
		# Including them can cause serious problems when a binary build is run on a different version of Windows.
		return None
	return orig_determine_dll_type(self, imagename)
DllFinder.determine_dll_type = determine_dll_type

class py2exe(distutils_buildexe.py2exe):
	"""Overridden py2exe command to:
		* Add a command line option --enable-uiAccess to enable uiAccess for the main executable and EOA proxy
		* Add a manifest to the executables
	"""

	user_options = distutils_buildexe.py2exe.user_options + [
		("enable-uiAccess", "u", "enable uiAccess for the main executable"),
	]

	def initialize_options(self):
		super(py2exe, self).initialize_options()
		self.enable_uiAccess = False

	def run(self):