How to use the py2app.util.copy_file 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
continue
                pth = os.path.join(dname, fname)

                # Check if we have found a package, exclude those
                if zipio.isdir(pth):
                    # XXX: the 'and not' part is wrong, need to fix zipio.isdir
                    for p in zipio.listdir(pth):
                        if p.startswith('__init__.') and p[8:] in exts:
                            break

                    else:
                        if os.path.isfile(pth):
                            # Avoid extracting a resource file that happens
                            # to be zipfile.
                            # XXX: Need API in zipio for nicer code.
                            copy_file(pth, os.path.join(target_dir, fname))
                        else:
                            copy_tree(pth, os.path.join(target_dir, fname))
                    continue

                elif zipio.isdir(pth) and (
                        zipio.isfile(os.path.join(pth, '__init__.py'))
                     or zipio.isfile(os.path.join(pth, '__init__.pyc'))
                     or zipio.isfile(os.path.join(pth, '__init__.pyo'))):
                    # Subdirectory is a python package, these will get included later on
                    # when the subpackage itself is included, ignore for now.
                    pass

                else:
                    copy_file(pth, os.path.join(target_dir, fname))
github metachris / py2app / py2app / build_app.py View on Github external
# XXX: Need API in zipio for nicer code.
                            copy_file(pth, os.path.join(target_dir, fname))
                        else:
                            copy_tree(pth, os.path.join(target_dir, fname))
                    continue

                elif zipio.isdir(pth) and (
                        zipio.isfile(os.path.join(pth, '__init__.py'))
                     or zipio.isfile(os.path.join(pth, '__init__.pyc'))
                     or zipio.isfile(os.path.join(pth, '__init__.pyo'))):
                    # Subdirectory is a python package, these will get included later on
                    # when the subpackage itself is included, ignore for now.
                    pass

                else:
                    copy_file(pth, os.path.join(target_dir, fname))
github metachris / py2app / py2app / build_app.py View on Github external
continue

            dst = os.path.join(pydir, pkg_name)
            self.mkpath(dst)
            self.copy_tree(pkg, dst)

            # FIXME: The python files should be bytecompiled
            #        here (see issue 101)

        for copyext in copyexts:
            fn = os.path.join(ext_dir,
                (copyext.identifier.replace('.', os.sep) +
                os.path.splitext(copyext.filename)[1])
            )
            self.mkpath(os.path.dirname(fn))
            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)