Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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, '/'))
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)
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, '/'))
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)
def compile_py_modules(self):
print('\nCompiling Python modules')
base = join(self.resources_dir, 'Python')
py_compile(base)
@flush
def compile_py_modules(self):
print('\nCompiling Python modules')
base = join(self.resources_dir, 'Python')
py_compile(base)