How to use the bypy.utils.py_compile function in bypy

To help you get started, we’ve selected a few bypy 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 norbusan / calibre-debian / bypy / windows / __main__.py View on Github external
if os.path.exists(deld):
            shutil.rmtree(deld)

    for x in os.walk(j(sp_dir, 'calibre')):
        for f in x[-1]:
            if not f.endswith('.py'):
                os.remove(j(x[0], f))

    extract_pyd_modules(env, sp_dir)

    printf('Byte-compiling all python modules...')
    for x in ('test', 'lib2to3'):
        x = j(env.lib_dir, x)
        if os.path.exists(x):
            shutil.rmtree(x)
    py_compile(env.lib_dir.replace(os.sep, '/'))
github norbusan / calibre-debian / bypy / linux / __main__.py View on Github external
c = j(env.SRC, x)
        if os.path.exists(j(c, '__init__.py')):
            shutil.copytree(c, j(dest, x), ignore=partial(ignore_in_lib, ignored_dirs={}))
        elif os.path.isfile(c):
            shutil.copy2(c, j(dest, x))
    pdir = j(dest, 'calibre', 'plugins')
    if not os.path.exists(pdir):
        os.mkdir(pdir)
    for x in glob.glob(j(ext_dir, '*.so')):
        shutil.copy2(x, j(pdir, os.path.basename(x)))

    shutil.copytree(j(env.src_root, 'resources'), j(env.base, 'resources'))
    sitepy = j(self_dir, 'site.py')
    shutil.copy2(sitepy, j(env.py_dir, 'site.py'))

    py_compile(env.py_dir)
github kovidgoyal / calibre / bypy / windows / __main__.py View on Github external
if os.path.exists(deld):
            shutil.rmtree(deld)

    for x in os.walk(j(sp_dir, 'calibre')):
        for f in x[-1]:
            if not f.endswith('.py'):
                os.remove(j(x[0], f))

    extract_pyd_modules(env, sp_dir)

    printf('Byte-compiling all python modules...')
    for x in ('test', 'lib2to3'):
        x = j(env.lib_dir, x)
        if os.path.exists(x):
            shutil.rmtree(x)
    py_compile(env.lib_dir.replace(os.sep, '/'))
github kovidgoyal / calibre / bypy / linux / __main__.py View on Github external
shutil.copy2(c, j(dest, x))
    pdir = j(dest, 'calibre', 'plugins')
    if not os.path.exists(pdir):
        os.mkdir(pdir)
    for x in glob.glob(j(ext_dir, '*.so')):
        shutil.copy2(x, j(pdir, os.path.basename(x)))

    shutil.copytree(j(env.src_root, 'resources'), j(env.base, 'resources'))
    for pak in glob.glob(j(QT_PREFIX, 'resources', '*.pak')):
        shutil.copy2(pak, j(env.base, 'resources'))
    os.mkdir(j(env.base, 'translations'))
    shutil.copytree(j(QT_PREFIX, 'translations', 'qtwebengine_locales'), j(env.base, 'translations', 'qtwebengine_locales'))
    sitepy = j(self_dir, 'site.py')
    shutil.copy2(sitepy, j(env.py_dir, 'site.py'))

    py_compile(env.py_dir)
github kovidgoyal / calibre / bypy / macos / __main__.py View on Github external
def compile_py_modules(self):
        print('\nCompiling Python modules')
        base = join(self.resources_dir, 'Python')
        py_compile(base)
github norbusan / calibre-debian / bypy / macos / __main__.py View on Github external
    @flush
    def compile_py_modules(self):
        print('\nCompiling Python modules')
        base = join(self.resources_dir, 'Python')
        py_compile(base)