diff --git a/.github/workflows/bundle_windows.yml b/.github/workflows/bundle_windows.yml index ecea139..c999570 100644 --- a/.github/workflows/bundle_windows.yml +++ b/.github/workflows/bundle_windows.yml @@ -35,7 +35,9 @@ jobs: - name: Bundle with cx_Freeze run: | python setup_cxfreeze.py build_exe - python setup_cxfreeze.py cleanse_cxfreeze + pip install pip-licenses + pip-licenses --format=plain-vertical --with-license-file --no-license-path --output-file=lib_licenses.txt + python setup_cxfreeze.py finalize_cxfreeze python setup_cxfreeze.py build_zip - name: Upload the artifact diff --git a/setup_cxfreeze.py b/setup_cxfreeze.py index 6eb8fb8..0857b78 100644 --- a/setup_cxfreeze.py +++ b/setup_cxfreeze.py @@ -50,8 +50,8 @@ TO_DELETE = [ BASE_DIR = Path(__file__).parent.absolute() -class CleanseCXFreezeCommand(Command): - description = "Get rid of unwanted files pulled in by cx_Freeze" +class FinalizeCXFreezeCommand(Command): + description = "Prepare cx_Freeze build dirs for zipping" user_options = [] def initialize_options(self) -> None: @@ -70,6 +70,9 @@ class CleanseCXFreezeCommand(Command): os.unlink(cleanse_path) except: pass + # Must have been generated with pip-licenses before. Many dependencies + # require their license to be distributed with their binaries. + shutil.copy(BASE_DIR / "lib_licenses.txt", path / "lib_licenses.txt") class BuildZipArchiveCommand(Command): @@ -120,7 +123,7 @@ setup( options=options, executables=executables, cmdclass={ - "cleanse_cxfreeze": CleanseCXFreezeCommand, + "finalize_cxfreeze": FinalizeCXFreezeCommand, "build_zip": BuildZipArchiveCommand, } )