How to use the py2app.util.makedirs 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
if self.optimize:
            self.symlink('../../site.pyo', os.path.join(pyhome, 'site.pyo'))
        else:
            self.symlink('../../site.pyc', os.path.join(pyhome, 'site.pyc'))
        self.symlink(
            os.path.join(realhome, 'config'),
            os.path.join(pyhome, 'config'))


        # symlink data files
        # XXX: fixme: need to integrate automatic data conversion
        for src, dest in self.iter_data_files():
            dest = os.path.join(resdir, dest)
            if src == dest:
                continue
            makedirs(os.path.dirname(dest))
            try:
                copy_resource(src, dest, dry_run=self.dry_run, symlink=1)
            except:
                import traceback
                traceback.print_exc()
                raise

        plugindir = os.path.join(appdir, 'Contents', 'Library')
        for src, dest in self.iter_extra_plugins():
            dest = os.path.join(plugindir, dest)
            if src == dest:
                continue

            makedirs(os.path.dirname(dest))
            try:
                copy_resource(src, dest, dry_run=self.dry_run)
github metachris / py2app / py2app / create_pluginbundle.py View on Github external
# Remove any existing build artifacts to ensure
        # we're getting a clean build
        shutil.rmtree(plugin)
    contents = os.path.join(plugin, 'Contents')
    resources = os.path.join(contents, 'Resources')
    platdir = os.path.join(contents, platform)
    dirs = [contents, resources, platdir]
    plist = plistlib.Plist()
    plist.update(kw)
    plistPath = os.path.join(contents, 'Info.plist')
    if os.path.exists(plistPath):
        if plist != plistlib.Plist.fromFile(plistPath):
            for d in dirs:
                shutil.rmtree(d, ignore_errors=True)
    for d in dirs:
        makedirs(d)
    plist.write(plistPath)
    srcmain = module.setup.main(arch=arch)
    if sys.version_info[0] == 2 and isinstance(kw['CFBundleExecutable'], unicode):
        destmain = os.path.join(platdir, kw['CFBundleExecutable'].encode('utf-8'))
    else:
        destmain = os.path.join(platdir, kw['CFBundleExecutable'])
    with open(os.path.join(contents, 'PkgInfo'), 'w') as fp:
        fp.write(
            kw['CFBundlePackageType'] + kw['CFBundleSignature']
        )
    copy(srcmain, destmain)
    make_exec(destmain)
    mergetree(
        resource_filename(module.__name__, 'lib'),
        resources,
        condition=condition,
github metachris / py2app / py2app / build_app.py View on Github external
# Build an alias executable for the target
        appdir, resdir, plist = self.create_bundle(target, script)

        # symlink python executable
        execdst = os.path.join(appdir, 'Contents', 'MacOS', 'python')
        prefixPathExecutable = os.path.join(sys.prefix, 'bin', 'python')
        if os.path.exists(prefixPathExecutable):
            pyExecutable = prefixPathExecutable
        else:
            pyExecutable = sys.executable
        self.symlink(pyExecutable, execdst)

        # make PYTHONHOME
        pyhome = os.path.join(resdir, 'lib', 'python' + sys.version[:3])
        realhome = os.path.join(sys.prefix, 'lib', 'python' + sys.version[:3])
        makedirs(pyhome)
        if self.optimize:
            self.symlink('../../site.pyo', os.path.join(pyhome, 'site.pyo'))
        else:
            self.symlink('../../site.pyc', os.path.join(pyhome, 'site.pyc'))
        self.symlink(
            os.path.join(realhome, 'config'),
            os.path.join(pyhome, 'config'))


        # symlink data files
        # XXX: fixme: need to integrate automatic data conversion
        for src, dest in self.iter_data_files():
            dest = os.path.join(resdir, dest)
            if src == dest:
                continue
            makedirs(os.path.dirname(dest))
github metachris / py2app / py2app / build_app.py View on Github external
copy_file(copyext.filename, fn, dry_run=self.dry_run)

        for src, dest in self.iter_data_files():
            dest = os.path.join(resdir, dest)
            if src == dest:
                continue
            makedirs(os.path.dirname(dest))
            copy_resource(src, dest, dry_run=self.dry_run)

        plugindir = os.path.join(appdir, 'Contents', 'Library')
        for src, dest in self.iter_extra_plugins():
            dest = os.path.join(plugindir, dest)
            if src == dest:
                continue

            makedirs(os.path.dirname(dest))
            copy_resource(src, dest, dry_run=self.dry_run)


        target.appdir = appdir
        return appdir
github metachris / py2app / py2app / build_app.py View on Github external
continue
            makedirs(os.path.dirname(dest))
            try:
                copy_resource(src, dest, dry_run=self.dry_run, symlink=1)
            except:
                import traceback
                traceback.print_exc()
                raise

        plugindir = os.path.join(appdir, 'Contents', 'Library')
        for src, dest in self.iter_extra_plugins():
            dest = os.path.join(plugindir, dest)
            if src == dest:
                continue

            makedirs(os.path.dirname(dest))
            try:
                copy_resource(src, dest, dry_run=self.dry_run)
            except:
                import traceback
                traceback.print_exc()
                raise

        # symlink frameworks
        for src in self.iter_frameworks():
            dest = os.path.join(
                appdir, 'Contents', 'Frameworks', os.path.basename(src))
            if src == dest:
                continue
            makedirs(os.path.dirname(dest))
            self.symlink(os.path.abspath(src), dest)