MCPcopy Index your code
hub / github.com/bleachbit/bleachbit / build

Function build

windows/setup.py:469–601  ·  view source on GitHub ↗

Build the application

()

Source from the content-addressed store, hash-verified

467
468
469def build():
470 """Build the application"""
471 logger.info('Deleting directories build and dist')
472 shutil.rmtree('build', ignore_errors=True)
473 shutil.rmtree('dist', ignore_errors=True)
474 shutil.rmtree('BleachBit-Portable', ignore_errors=True)
475
476 logger.info('Running py2exe')
477 copy_file('bleachbit.py', 'bleachbit_console.py')
478 build_py2exe()
479 assert_exist('dist\\bleachbit.exe')
480 assert_exist('dist\\bleachbit_console.exe')
481 os.remove('bleachbit_console.py')
482
483 if not os.path.exists('dist'):
484 os.makedirs('dist')
485
486 os.makedirs(os.path.join('dist', 'share'), exist_ok=True)
487
488 logger.info('Copying GTK helpers')
489 for exe in glob.glob1(GTK_LIBDIR, 'gspawn-win*-helper*.exe'):
490 copy_file(os.path.join(GTK_LIBDIR, exe), os.path.join('dist', exe))
491 for exe in ('fc-cache.exe',):
492 copy_file(os.path.join(GTK_LIBDIR, exe), os.path.join('dist', exe))
493
494 logger.info('Copying GTK files and icon')
495 for d in ('dbus-1', 'fonts', 'gtk-3.0', 'pango'):
496 path = os.path.join(GTK_DIR, 'etc', d)
497 copy_tree(path, os.path.join('dist', 'etc', d))
498 for d in ('gdk-pixbuf-2.0', 'girepository-1.0', 'glade', 'gtk-3.0'):
499 path = os.path.join(GTK_DIR, 'lib', d)
500 copy_tree(path, os.path.join('dist', 'lib', d))
501
502 gtk_share = os.path.join(GTK_LIBDIR, 'share')
503 if os.path.exists(gtk_share):
504 for d in ('icons', 'themes'):
505 path = os.path.join(gtk_share, d)
506 copy_tree(path, os.path.join('dist', 'share', d))
507
508 logger.info('Fixing paths in loaders.cache file')
509 loaders_fn = os.path.join(
510 'dist', 'lib', 'gdk-pixbuf-2.0', '2.10.0', 'loaders.cache')
511 with open(loaders_fn, 'r+', encoding=SetupEncoding) as f:
512 data = f.read()
513 data = re.sub(r'^".*[/\\](.*\.dll)"$',
514 r'"\1"', data, flags=re.I | re.M)
515 f.seek(0)
516 f.write(data)
517 f.truncate()
518
519 # fonts are not needed https://github.com/bleachbit/bleachbit/issues/863
520 for d in ('icons',):
521 path = os.path.join(GTK_DIR, 'share', d)
522 copy_tree(path, os.path.join('dist', 'share', d))
523 schemas_dir = 'share\\glib-2.0\\schemas'
524 gschemas_compiled_src = os.path.join(
525 GTK_DIR, schemas_dir, 'gschemas.compiled')
526 gschemas_compiled_dst = os.path.join(

Callers 1

mainFunction · 0.85

Calls 10

copy_fileFunction · 0.85
build_py2exeFunction · 0.85
assert_existFunction · 0.85
copy_treeFunction · 0.85
recursive_globFunction · 0.85
sign_filesFunction · 0.85
assert_execute_consoleFunction · 0.85
joinMethod · 0.80
readMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected