diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a672e37..88ef1adf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,9 +49,9 @@ jobs: run: | # Setup Environment for Reproducible Builds export PYTHONHASHSEED=42 - export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct + export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) - pyinstaller Khoj.spec + pyinstaller --noconfirm Khoj.spec if [ "$RUNNER_OS" == "Windows" ]; then mv dist/Khoj.exe dist/khoj_"$GITHUB_REF_NAME"_amd64.exe fi diff --git a/Khoj.spec b/Khoj.spec index 3697f32d..56d164e7 100644 --- a/Khoj.spec +++ b/Khoj.spec @@ -1,4 +1,6 @@ # -*- mode: python ; coding: utf-8 -*- +from os.path import join +from platform import system from PyInstaller.utils.hooks import copy_metadata datas = [('src/interface/web', 'src/interface/web')] @@ -29,6 +31,17 @@ a = Analysis( cipher=block_cipher, noarchive=False, ) + +# Filter out unused, duplicate shared libs under torch/lib +torch_lib_path = set([ + join('torch', 'lib', 'libtorch_cuda.so'), + join('torch', 'lib', 'libtorch_cuda.dylib'), + join('torch', 'lib', 'libtorch_cpu.so'), + join('torch', 'lib', 'libtorch_cpu.dylib'), + join('torch', 'lib', 'libtorch_python.so'), + join('torch', 'lib', 'libtorch_python.dylib')]) +a.datas = [entry for entry in a.datas if not entry[0] in torch_lib_path] + pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE( @@ -53,9 +66,11 @@ exe = EXE( entitlements_file=None, icon='src/interface/web/assets/icons/favicon.icns', ) -app = BUNDLE( - exe, - name='Khoj.app', - icon='src/interface/web/assets/icons/favicon.icns', - bundle_identifier=None, -) + +if system() == 'Darwin': + app = BUNDLE( + exe, + name='Khoj.app', + icon='src/interface/web/assets/icons/favicon.icns', + bundle_identifier=None, + )