How to use the py2exe.mf.AddPackagePath 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 b3n4kh / chirp / setup.py View on Github external
def win32_build():
    from distutils.core import setup
    import py2exe

    try:
        # if this doesn't work, try import modulefinder
        import py2exe.mf as modulefinder
        import win32com
        for p in win32com.__path__[1:]:
            modulefinder.AddPackagePath("win32com", p)
        for extra in ["win32com.shell"]:  # ,"win32com.mapi"
            __import__(extra)
            m = sys.modules[extra]
            for p in m.__path__[1:]:
                modulefinder.AddPackagePath(extra, p)
    except ImportError:
        # no build path setup, no worries.
        pass

    staticify_chirp_module()
    staticify_drivers_module()

    opts = {
        "py2exe": {
            "includes": "pango,atk,gobject,cairo,pangocairo," +
                        "win32gui,win32com,win32com.shell," +
github lmacken / liveusb-creator / setup.py View on Github external
# This means we have to add package paths there, not to the built-in
        # one.  If this new modulefinder gets integrated into Python, then
        # we might be able to revert this some day.
        # if this doesn't work, try import modulefinder
        try:
            import py2exe.mf as modulefinder
        except ImportError:
            import modulefinder
        import win32com
        for p in win32com.__path__[1:]:
            modulefinder.AddPackagePath("win32com", p)
        for extra in ["win32com.shell"]: #,"win32com.mapi"
            __import__(extra)
            m = sys.modules[extra]
            for p in m.__path__[1:]:
                modulefinder.AddPackagePath(extra, p)
    except ImportError:
        # no build path setup, no worries.
        pass

    import py2exe
    LOCALE_DIR = 'locale'

    setup(
        name = 'liveusb-creator',
        version = VERSION,
        packages = ['liveusb'],
        scripts = ['liveusb-creator'],
        license = 'GNU General Public License (GPL)',
        url = 'https://fedorahosted.org/liveusb-creator',
        description = 'This tool installs a LiveCD ISO on to a USB stick',
        long_description = 'The liveusb-creator is a cross-platform tool for easily installing live operating systems on to USB flash drives',
github umitproject / network-scanner / install_scripts / windows / setup.py View on Github external
# Add i18n files to data_files list
os.path.walk(locale_dir, mo_find, data_files)

# win32com changes its __path__ to be able to do imports from
# win32comext (which is not a python package), but the modulefinder
# does not handle such situtation and thus win32com.shell (which is
# really win32comext.shell) cannot be found. Let's fix this here so
# umit.core.BasePaths still works after we run py2exe over it.
try:
    import py2exe.mf as modulefinder
except ImportError:
    # This py2exe is too old, will use the standard modulefinder
    import modulefinder
import win32com
for path in win32com.__path__[1:]:
    modulefinder.AddPackagePath("win32com", path)

class umit_py2exe(build_exe):
    def run(self):
        build_exe.run(self)
        self.finish_banner()

    def finish_banner(self):
        print
        print "%s The compiled version of Umit %s is in ./dist %s" % \
              ("#"*10, VERSION, "#"*10)
        print


##################### Umit banner ###################################
print
print "%s Umit for Windows %s %s" % ("#"*10, VERSION, "#"*10)
github lmacken / liveusb-creator / setup.py View on Github external
# win32com.shell fix from http://www.py2exe.org/index.cgi/win32com.shell
    # ModuleFinder can't handle runtime changes to __path__, but win32com uses them
    try:
        # py2exe 0.6.4 introduced a replacement modulefinder.
        # This means we have to add package paths there, not to the built-in
        # one.  If this new modulefinder gets integrated into Python, then
        # we might be able to revert this some day.
        # if this doesn't work, try import modulefinder
        try:
            import py2exe.mf as modulefinder
        except ImportError:
            import modulefinder
        import win32com
        for p in win32com.__path__[1:]:
            modulefinder.AddPackagePath("win32com", p)
        for extra in ["win32com.shell"]: #,"win32com.mapi"
            __import__(extra)
            m = sys.modules[extra]
            for p in m.__path__[1:]:
                modulefinder.AddPackagePath(extra, p)
    except ImportError:
        # no build path setup, no worries.
        pass

    import py2exe
    LOCALE_DIR = 'locale'

    setup(
        name = 'liveusb-creator',
        version = VERSION,
        packages = ['liveusb'],
github jipegit / FECT / setup.py View on Github external
# This means we have to add package paths there, not to the built-in
    # one.  If this new modulefinder gets integrated into Python, then
    # we might be able to revert this some day.
    # if this doesn't work, try import modulefinder
    try:
        import py2exe.mf as modulefinder
    except ImportError:
        import modulefinder
    import win32com, sys
    for p in win32com.__path__[1:]:
        modulefinder.AddPackagePath("win32com", p)
    for extra in ["win32com.shell"]: #,"win32com.mapi"
        __import__(extra)
        m = sys.modules[extra]
        for p in m.__path__[1:]:
            modulefinder.AddPackagePath(extra, p)
except ImportError:
    # no build path setup, no worries.
    pass

from distutils.core import setup
import py2exe
import sys

# Just in case...
if len(sys.argv) == 1:
    sys.argv.append("py2exe")

setup(
	console=[{
        'script': 'FECT.py',
        'icon_resources': [(0, 'FECT.ico')]
github wrye-bash / wrye-bash / scripts / build / standalone / setup.py View on Github external
try:
        yield
    finally:
        for target in file_map.values():
            os.remove(target)


# https://stackoverflow.com/a/18940379
argparser = argparse.ArgumentParser(add_help=False)
argparser.add_argument("--version", required=True)
args, unknown = argparser.parse_known_args()
sys.argv = [sys.argv[0]] + unknown

# ModuleFinder can't handle runtime changes to __path__, but win32com uses them
for p in win32com.__path__[1:]:
    modulefinder.AddPackagePath("win32com", p)

# Read in the manifest file
with open(MANIFEST_FILE, "r") as man:
    manifest = man.read()

target = {
    "name": "Wrye Bash",
    "description": "Wrye Bash",
    "version": args.version,
    "icon_resources": [(1, ICON_FILE)],
    "author": "Wrye Bash development team",
    "url": "https://www.nexusmods.com/oblivion/mods/22368",
    "download_url": "https://www.nexusmods.com/oblivion/mods/22368",
    "script": "Wrye Bash Launcher.pyw",
    "other_resources": [(24, 1, manifest)],
}
github b3n4kh / chirp / setup.py View on Github external
def win32_build():
    from distutils.core import setup
    import py2exe

    try:
        # if this doesn't work, try import modulefinder
        import py2exe.mf as modulefinder
        import win32com
        for p in win32com.__path__[1:]:
            modulefinder.AddPackagePath("win32com", p)
        for extra in ["win32com.shell"]:  # ,"win32com.mapi"
            __import__(extra)
            m = sys.modules[extra]
            for p in m.__path__[1:]:
                modulefinder.AddPackagePath(extra, p)
    except ImportError:
        # no build path setup, no worries.
        pass

    staticify_chirp_module()
    staticify_drivers_module()

    opts = {
        "py2exe": {
            "includes": "pango,atk,gobject,cairo,pangocairo," +
                        "win32gui,win32com,win32com.shell," +
                        "email.iterators,email.generator,gio",

            "compressed": 1,
            "optimize": 2,
            "bundle_files": 3,
github tartakynov / enso / scripts / win32-build / setup.py View on Github external
import sys
import os

try:
	try:
		import py2exe.mf as modulefinder
	except ImportError:
		import modulefinder
	import win32com, sys
	for p in win32com.__path__[1:]:
		modulefinder.AddPackagePath("win32com", p)
	for extra in ["win32com.shell"]: #,"win32com.mapi"
		__import__(extra)
		m = sys.modules[extra]
		for p in m.__path__[1:]:
			modulefinder.AddPackagePath(extra, p)
except ImportError:
	pass

commands = []
for root, _, files in os.walk("scripts/commands/"):
	for f in files:
		commands.append(os.path.join(root, f))

sys.path.append("enso/platform/win32")
setup(
	name	= "Enso",
	version	= "1.0",
	author	= "Enso Community",
	windows	= [ { "script" : "scripts/run_enso.py", "icon_resources" : [(1, "media/images/enso.ico")] } ],
	data_files = [(".", ["media/images/enso.ico", "media/fonts/GenI102.TTF", "media/fonts/GenR102.TTF", "media/fonts/OFL.txt"]), ("commands", commands)],
	options =
github joliebig / featurehouse / fstmerge / examples / SpamBayes / rev3103-3133 / base-trunk-3103 / windows / py2exe / setup_all.py View on Github external
sys.path.append(sb_top_dir)
sys.path.append(os.path.join(sb_top_dir, "windows"))
sys.path.append(os.path.join(sb_top_dir, "scripts"))
sys.path.append(os.path.join(sb_top_dir, "Outlook2000"))
sys.path.append(os.path.join(sb_top_dir, "Outlook2000", "sandbox"))
import spambayes.resources
import dialogs
dialogs.LoadDialogs()
try:
    try:
        import py2exe.mf as modulefinder
    except ImportError:
        import modulefinder
    import win32com
    for p in win32com.__path__[1:]:
        modulefinder.AddPackagePath("win32com", p)
    for extra in ["win32com.shell","win32com.mapi"]:
        __import__(extra)
        m = sys.modules[extra]
        for p in m.__path__[1:]:
            modulefinder.AddPackagePath(extra, p)
except ImportError:
    pass
from distutils.core import setup
import py2exe
py2exe_options = dict(
    packages = "spambayes.resources,encodings,spambayes.languages," \
               "spambayes.languages.es,spambayes.languages.es_AR," \
               "spambayes.languages.fr,spambayes.languages.es.DIALOGS," \
               "spambayes.languages.es_AR.DIALOGS," \
               "spambayes.languages.fr.DIALOGS," \
               "PIL",