How to use the py2app.apptemplate.setup.main 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 / build_app.py View on Github external
def build_executable(self, target, arcname, pkgexts, copyexts, script, extra_scripts):
        # Build an executable for the target
        appdir, resdir, plist = self.create_bundle(target, script)
        self.appdir = appdir
        self.resdir = resdir
        self.plist = plist

        for fn in extra_scripts:
            if fn.endswith('.py'):
                fn = fn[:-3]
            elif fn.endswith('.pyw'):
                fn = fn[:-4]

            src_fn = script_executable(arch=self.arch, secondary=True)
            tgt_fn = os.path.join(self.appdir, 'Contents', 'MacOS', os.path.basename(fn))
            mergecopy(src_fn, tgt_fn)
            make_exec(tgt_fn)


        site_path = os.path.join(resdir, 'site.py')
        byte_compile([
            SourceModule('site', site_path),
            ],
            target_dir=resdir,
            optimize=self.optimize,
            force=self.force,
            verbose=self.verbose,
            dry_run=self.dry_run)
        if not self.dry_run:
            os.unlink(site_path)
github metachris / py2app / py2app / build_app.py View on Github external
for target in self.targets:

            extra_scripts = list(self.extra_scripts)
            if hasattr(target, 'extra_scripts'):
                extra_scripts.update(extra_scripts)

            dst = self.build_alias_executable(target, target.script, extra_scripts)
            self.app_files.append(dst)

            for fn in extra_scripts:
                if fn.endswith('.py'):
                    fn = fn[:-3]
                elif fn.endswith('.pyw'):
                    fn = fn[:-4]

                src_fn = script_executable(arch=self.arch, secondary=True)
                tgt_fn = os.path.join(target.appdir, 'Contents', 'MacOS', os.path.basename(fn))
                mergecopy(src_fn, tgt_fn)
                make_exec(tgt_fn)