()
| 41 | |
| 42 | |
| 43 | def main(): |
| 44 | command_line_args() |
| 45 | |
| 46 | # Make sure pyinstaller build/dist directories do not exist, |
| 47 | # otherwise they would be packed along with examples and thus |
| 48 | # increase package size significantly. |
| 49 | assert not os.path.exists(os.path.join(EXAMPLES_DIR, |
| 50 | "pyinstaller", "build")) |
| 51 | assert not os.path.exists(os.path.join(EXAMPLES_DIR, |
| 52 | "pyinstaller", "dist")) |
| 53 | |
| 54 | # Setup and package directories |
| 55 | global SETUP_DIR, PKG_DIR |
| 56 | setup_dir_name = get_setup_installer_basename(VERSION, OS_POSTFIX2) |
| 57 | SETUP_DIR = os.path.join(BUILD_DIR, setup_dir_name) |
| 58 | PKG_DIR = os.path.join(SETUP_DIR, "cefpython3") |
| 59 | |
| 60 | # Print src and dest for file operations |
| 61 | print("[make_installer.py] Src: {src}".format(src=ROOT_DIR)) |
| 62 | print("[make_installer.py] Dst: {dst}".format(dst=SETUP_DIR)) |
| 63 | |
| 64 | # Make directories |
| 65 | if os.path.exists(SETUP_DIR): |
| 66 | print("[make_installer.py] Delete: {dir}" |
| 67 | .format(dir=SETUP_DIR.replace(ROOT_DIR, ""))) |
| 68 | shutil.rmtree(SETUP_DIR) |
| 69 | os.makedirs(SETUP_DIR) |
| 70 | os.makedirs(os.path.join(SETUP_DIR, "examples/")) |
| 71 | os.makedirs(PKG_DIR) |
| 72 | os.makedirs(os.path.join(PKG_DIR, "examples/")) |
| 73 | |
| 74 | # Copy files from tools/installer/ |
| 75 | copy_tools_installer_files(SETUP_DIR, PKG_DIR) |
| 76 | |
| 77 | # Multiple copy operations using glob patterns |
| 78 | copy_operations = [ |
| 79 | (ROOT_DIR, "License"), (PKG_DIR,), |
| 80 | (CEF_BINARIES_LIBRARIES, "*.txt"), (PKG_DIR,), |
| 81 | (CEF_BINARIES_LIBRARIES, "bin/*"), (PKG_DIR,), |
| 82 | (CEFPYTHON_BINARY, "*"), (PKG_DIR,), |
| 83 | (EXAMPLES_DIR, "*"), (PKG_DIR, "examples/"), |
| 84 | (EXAMPLES_DIR, "*"), (SETUP_DIR, "examples/"), |
| 85 | ] |
| 86 | perform_copy_operations(copy_operations) |
| 87 | delete_cef_sample_apps(caller_script=__file__, bin_dir=PKG_DIR) |
| 88 | |
| 89 | # Linux only operations |
| 90 | if LINUX: |
| 91 | os.makedirs(os.path.join(SETUP_DIR, "examples", "kivy-select-boxes")) |
| 92 | copy_operations_linux = [ |
| 93 | (LINUX_DIR, "binaries_64bit/kivy_.py"), |
| 94 | (SETUP_DIR, "examples/"), |
| 95 | (LINUX_DIR, "binaries_64bit/kivy-select-boxes/*"), |
| 96 | (SETUP_DIR, "examples/kivy-select-boxes/") |
| 97 | ] |
| 98 | perform_copy_operations(copy_operations_linux) |
| 99 | |
| 100 | # Create empty debug.log files so that package uninstalls cleanly |
no test coverage detected