How to use the py2app.build_app.py2app function in py2app

To help you get started, we’ve selected a few py2app 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 metachris / py2app / py2app_tests / test_setup.py View on Github external
def create_cmd(self, **kwds):
        dist = Distribution(kwds)
        cmd = py2app_cmd(dist)
        cmd.dist_dir = 'dist'
        cmd.fixup_distribution()
        cmd.finalize_options()

        return cmd
github pculture / miro / tv / osx / setup.py View on Github external
else:
            conf = self.config.copy()
            conf.update(self.themeConfig)
            return conf
    
    def get(self, key, prioritizeTheme=True):
        if self.themeConfig is not None and key in self.themeConfig and prioritizeTheme:
            return self.themeConfig[key]
        else:
            return self.config.get(key)

# =============================================================================
# Define our custom build task
# =============================================================================

class MiroBuild (py2app):

    description = "create the OS X Miro application"
    
    user_options = py2app.user_options + [
        ("keep-tests",   "u", "keep the unit tests module"),
        ("make-dmg",     "d", "produce a disk image"),
        ("force-update", "f", "force resource update"),
        ("theme=",       "t", "theme file to use"),
        ("sign=",        "s", "identity to sign app with"),
    ]

    boolean_options = py2app.boolean_options + ["make-dmg", "force-update", "keep-tests"]
        
    def initialize_options(self):
        self.keep_tests = False
        self.make_dmg = False
github cloudmatrix / esky / esky / bdist_esky / f_py2app.py View on Github external
def _make_py2app_cmd(dist_dir,distribution,options,exes):
    exe = exes[0]
    extra_exes = exes[1:]
    cmd = py2app(distribution)
    for (nm,val) in options.iteritems():
        setattr(cmd,nm,val)
    cmd.dist_dir = dist_dir
    cmd.app = [Target(script=exe.script,dest_base=exe.name)]
    cmd.extra_scripts = [e.script for e in extra_exes]
    cmd.finalize_options()
    cmd.plist["CFBundleExecutable"] = exe.name
    old_run = cmd.run
    def new_run():
        #  py2app munges the environment in ways that break things.
        old_deployment_target = os.environ.get("MACOSX_DEPLOYMENT_TARGET",None)
        old_run()
        if old_deployment_target is None:
            os.environ.pop("MACOSX_DEPLOYMENT_TARGET",None)
        else:
            os.environ["MACOSX_DEPLOYMENT_TARGET"] = old_deployment_target
github rackerlabs / mimic / setup-mac.py View on Github external
CFBundleShortVersionString  = ' '.join([NAME, VERSION]),
    CFBundleGetInfoString       = NAME,
    CFBundleExecutable          = NAME,
    CFBundleIdentifier          = 'com.%s.%s' % (NAME, ID),
    LSUIElement                 = '1',
    LSMultipleInstancesProhibited = '1',
)

APP_DATA = dict(
    script=SCRIPT,
    plist=PLIST,
    extra_scripts=[TEST_SCRIPT]
)


class BuildWithCache(py2app):
    """
    Before building the application rebuild the `dropin.cache` files.
    """

    def run(self):
        """
        This generates `dropin.cache` files for mimic's plugins.
        """
        list(getPlugins(IPlugin, package=plugins))
        list(getPlugins(IPlugin))
        py2app.run(self)


setup(
    name=NAME,
    version=VERSION,
github rackerlabs / mimic / setup.py View on Github external
plist = dict(
        CFBundleName                = _NAME,
        CFBundleShortVersionString  = " ".join([_NAME, _VERSION]),
        CFBundleGetInfoString       = _NAME,
        CFBundleExecutable          = _NAME,
        CFBundleIdentifier          = "com.%s.%s" % (_NAME, _VERSION),
        LSUIElement                 = "1",
        LSMultipleInstancesProhibited = "1",
    )
    app_data = dict(
        script=script,
        plist=plist,
        extra_scripts=[test_script]
    )

    class BuildWithCache(py2app, object):
        """
        Before building the application rebuild the `dropin.cache` files.
        """

        def collect_recipedict(self):
            """
            Implement a special Twisted plugins recipe so that dropin.cache
            files are generated and included in site-packages.zip.
            """
            result = super(BuildWithCache, self).collect_recipedict()
            def check(cmd, mg):
                from twisted.plugin import getPlugins, IPlugin
                from twisted import plugins as twisted_plugins
                from mimic import plugins as mimic_plugins

                for plugin_package in [twisted_plugins, mimic_plugins]: