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 EventGhost / EventGhost / _build / builder / BuildLibrary.py View on Github external
Build the library and .exe files with py2exe.
        """
        buildSetup = self.buildSetup
        sys.path.append(EncodePath(buildSetup.pyVersionDir))
        from distutils.core import setup
        InstallPy2exePatch()

        import py2exe
        origIsSystemDLL = py2exe.build_exe.isSystemDLL

        def isSystemDLL(path):
            if basename(path).lower().startswith("api-ms-win-"):
                return 1
            else:
                return origIsSystemDLL(path)
        py2exe.build_exe.isSystemDLL = isSystemDLL

        libraryDir = buildSetup.libraryDir
        if exists(libraryDir):
            for filename in os.listdir(libraryDir):
                path = join(libraryDir, filename)
                if not os.path.isdir(path):
                    os.remove(path)

        wip_version = None
        if buildSetup.appVersion.startswith("WIP-"):
            # this is to avoid a py2exe warning when building a WIP version
            wip_version = buildSetup.appVersion
            buildSetup.appVersion = ".".join(
                buildSetup.appVersion.split("-")[1].split(".")
            )
github rodrigets / games-in-pygame / executables / build.py View on Github external
import py2exe, pygame
    from modulefinder import Module
    import glob, fnmatch
    import sys, os, shutil
    import operator
except ImportError, message:
    raise SystemExit,  "Unable to load module. %s" % message

#hack which fixes the pygame mixer and pygame font
origIsSystemDLL = py2exe.build_exe.isSystemDLL # save the orginal before we edit it
def isSystemDLL(pathname):
    # checks if the freetype and ogg dll files are being included
    if os.path.basename(pathname).lower() in ("libfreetype-6.dll", "libogg-0.dll","sdl_ttf.dll"): # "sdl_ttf.dll" added by arit.
            return 0
    return origIsSystemDLL(pathname) # return the orginal function
py2exe.build_exe.isSystemDLL = isSystemDLL # override the default function with this one

class pygame2exe(py2exe.build_exe.py2exe): #This hack make sure that pygame default font is copied: no need to modify code for specifying default font
    def copy_extensions(self, extensions):
        #Get pygame default font
        pygamedir = os.path.split(pygame.base.__file__)[0]
        pygame_default_font = os.path.join(pygamedir, pygame.font.get_default_font())

        #Add font to list of extension to be copied
        extensions.append(Module("pygame.font", pygame_default_font))
        py2exe.build_exe.py2exe.copy_extensions(self, extensions)

class BuildExe:
    def __init__(self):
        #Name of starting .py
        self.script = "../asteroides.py"
github digiholic / universalSmashSystem / pygame2exe.py View on Github external
import py2exe, pygame
    from modulefinder import Module
    import glob, fnmatch
    import sys, os, shutil
    import operator
except ImportError as message:
    raise (SystemExit, "Unable to load module. %s" % message)
 
#hack which fixes the pygame mixer and pygame font
orig_is_system_dll = py2exe.build_exe.isSystemDLL # save the orginal before we edit it
def isSystemDLL(_pathname):
    # checks if the freetype and ogg dll files are being included
    if os.path.basename(_pathname).lower() in ("libfreetype-6.dll", "libogg-0.dll","sdl_ttf.dll"): # "sdl_ttf.dll" added by arit.
            return 0
    return orig_is_system_dll(_pathname) # return the orginal function
py2exe.build_exe.isSystemDLL = isSystemDLL # override the default function with this one
 
class pygame2exe(py2exe.build_exe.py2exe): #This hack make sure that pygame default font is copied: no need to modify code for specifying default font
    def copy_extensions(self, _extensions):
        #Get pygame default font
        pygame_dir = os.path.split(pygame.base.__file__)[0]
        pygame_default_font = os.path.join(pygame_dir, pygame.font.get_default_font())
 
        #Add font to list of extension to be copied
        _extensions.append(Module("pygame.font", pygame_default_font))
        py2exe.build_exe.py2exe.copy_extensions(self, _extensions)
 
class BuildExe:
    def __init__(self):
        #Name of starting .py
        self.script = "main.py"
github EventGhost / EventGhost / _build / builder / BuildLibrary.py View on Github external
def DoTask(self):
        """
        Build the library and .exe files with py2exe.
        """
        buildSetup = self.buildSetup
        sys.path.append(EncodePath(buildSetup.pyVersionDir))
        from distutils.core import setup
        InstallPy2exePatch()

        import py2exe
        origIsSystemDLL = py2exe.build_exe.isSystemDLL

        def isSystemDLL(path):
            if basename(path).lower().startswith("api-ms-win-"):
                return 1
            else:
                return origIsSystemDLL(path)
        py2exe.build_exe.isSystemDLL = isSystemDLL

        libraryDir = buildSetup.libraryDir
        if exists(libraryDir):
            for filename in os.listdir(libraryDir):
                path = join(libraryDir, filename)
                if not os.path.isdir(path):
                    os.remove(path)

        wip_version = None
github xlcteam / nxtIDE / nxtemu / setup.py View on Github external
[os.path.basename(f) for f in glob.glob(self.opj(srcdir, '*'))])
    return file_list

for data in extra_data:
    if os.path.isdir(data):
        data_files.extend(find_data_files(data, '*', recursive=True))
    else:
        data_files.append(('.', [data]))


#print find_data_files('theme', 'default/*', recursive=True)
#raw_input()



origIsSystemDLL = py2exe.build_exe.isSystemDLL # save the orginal before we edit it
def isSystemDLL(pathname):
    # checks if the freetype and ogg dll files are being included
    if os.path.basename(pathname).lower() in ("libfreetype-6.dll", "libogg-0.dll", "sdl_ttf.dll"):
            return 0
    return origIsSystemDLL(pathname) # return the orginal function
py2exe.build_exe.isSystemDLL = isSystemDLL


setup(
    options = {"py2exe": {"compressed": 2,
                          "optimize": 2,
                          "includes": includes,
                          "excludes": excludes,
                          "packages": packages,
                          "dll_excludes": dll_excludes,
                          "bundle_files": 3,
github philroberts / FPDB-for-OSX / packaging / windows / py2exe_setup.py View on Github external
pydir = rootdir+'pyfpdb/'
packagedir = rootdir+'packaging/windows/'
gfxdir = rootdir+'gfx/'
sys.path.append( pydir )  # allows fpdb modules to be found by options/includes below


print "\n" + r"Output will be created in "+distdir

print "*** Cleaning working folders ***"
test_and_remove('dist')
test_and_remove('build')
test_and_remove(distdir)

print "*** Building now in dist folder ***"

origIsSystemDLL = py2exe.build_exe.isSystemDLL
py2exe.build_exe.isSystemDLL = isSystemDLL

setup(
    name        = 'fpdb',
    description = 'Free Poker DataBase',
    version     = fpdbver,

    windows = [   {'script': pydir+'fpdb.pyw', 'uac_info': "requireAdministrator", "icon_resources": [(1, gfxdir+"fpdb_large_icon.ico")]},
                  {'script': pydir+'HUD_main.pyw', 'uac_info': "requireAdministrator", }
              ],

    console = [   {'script': pydir+'Stove.py', },
                  {'script': pydir+'Configuration.py', },
                  {'script': pydir+'fpdb_prerun.py', }
              ],
github albertca / NanScan / setup.py View on Github external
from distutils.file_util import copy_file
from distutils.sysconfig import get_python_lib
from distutils.core import setup

try:
	import py2exe

	# Override the function in py2exe to determine if a dll should be included
        dllList = ('mfc90.dll','msvcp90.dll','qtnetwork.pyd','qtxmlpatterns4.dll','qtsvg4.dll')
	origIsSystemDLL = py2exe.build_exe.isSystemDLL
	def isSystemDLL(pathname):
		if os.path.basename(pathname).lower() in dllList:
			return 0
		return origIsSystemDLL(pathname)
	py2exe.build_exe.isSystemDLL = isSystemDLL
	using_py2exe = True
except:
	using_py2exe = False
	pass

opj = os.path.join

name = 'NanScan'

from NanScan import Version
version = Version.Version

# get python short version
py_short_version = '%s.%s' % sys.version_info[:2]

required_modules = [
github Lithium95 / ConTroll_Remote_Access_Trojan / flappy bird / setup.py View on Github external
for dirpath, _, filenames in os.walk(np_path):
        for item in filenames:
            if item.endswith('.dll'):
                paths.add(dirpath)

    sys.path.append(*list(paths))

numpy_dll_paths_fix()

origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
    dlls = ("libfreetype-6.dll", "libogg-0.dll", "sdl_ttf.dll")
    if os.path.basename(pathname).lower() in dlls:
        return 0
    return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL

sys.argv.append('py2exe')

setup(
    name =    'Flappy Bird',
    version = '1.0',
    author =  'Lomar Lilly',
    options = {
        'py2exe': {
            'bundle_files': 1, # doesn't work on win64
            'compressed': True,
        }
    },

    windows = [{
        'script': "flappy.py",
github mcedit / mcedit / setup.py View on Github external
def setup_win32():
    """
    Packing setup for Windows 32/64.
    """
    import py2exe

    # This little ditty makes sure the font module is available
    origIsSystemDLL = py2exe.build_exe.isSystemDLL

    def isSystemDLL(pathname):
        if os.path.basename(pathname).lower() in ['sdl_ttf.dll']:
            return 0
        return origIsSystemDLL(pathname)
    py2exe.build_exe.isSystemDLL = isSystemDLL
github Lithium95 / ConTroll_Remote_Access_Trojan / flappy bird / setup.py View on Github external
import py2exe, numpy

def numpy_dll_paths_fix():
    paths = set()
    np_path = numpy.__path__[0]
    for dirpath, _, filenames in os.walk(np_path):
        for item in filenames:
            if item.endswith('.dll'):
                paths.add(dirpath)

    sys.path.append(*list(paths))

numpy_dll_paths_fix()

origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
    dlls = ("libfreetype-6.dll", "libogg-0.dll", "sdl_ttf.dll")
    if os.path.basename(pathname).lower() in dlls:
        return 0
    return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL

sys.argv.append('py2exe')

setup(
    name =    'Flappy Bird',
    version = '1.0',
    author =  'Lomar Lilly',
    options = {
        'py2exe': {
            'bundle_files': 1, # doesn't work on win64