mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-10 05:39:11 +00:00
Exclude unused libs under torch/lib. Reduce Debian package size by 700Mb
- libtorch_cuda.so (1Gb) and libtorch_cpu.so (700Mb) are large shared libs that are available at package root and under torch/lib. - The top level imports are used, so they unused libs are removed from package - This reduces the single file package size from 1.6Gb to 920Mb
This commit is contained in:
15
Khoj.spec
15
Khoj.spec
@@ -1,4 +1,6 @@
|
|||||||
# -*- mode: python ; coding: utf-8 -*-
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
from os.path import join
|
||||||
|
from platform import system
|
||||||
from PyInstaller.utils.hooks import copy_metadata
|
from PyInstaller.utils.hooks import copy_metadata
|
||||||
|
|
||||||
datas = [('src/interface/web', 'src/interface/web')]
|
datas = [('src/interface/web', 'src/interface/web')]
|
||||||
@@ -29,6 +31,13 @@ a = Analysis(
|
|||||||
cipher=block_cipher,
|
cipher=block_cipher,
|
||||||
noarchive=False,
|
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_cpu.so')])
|
||||||
|
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)
|
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||||
|
|
||||||
exe = EXE(
|
exe = EXE(
|
||||||
@@ -53,9 +62,11 @@ exe = EXE(
|
|||||||
entitlements_file=None,
|
entitlements_file=None,
|
||||||
icon='src/interface/web/assets/icons/favicon.icns',
|
icon='src/interface/web/assets/icons/favicon.icns',
|
||||||
)
|
)
|
||||||
app = BUNDLE(
|
|
||||||
|
if system() == 'Darwin':
|
||||||
|
app = BUNDLE(
|
||||||
exe,
|
exe,
|
||||||
name='Khoj.app',
|
name='Khoj.app',
|
||||||
icon='src/interface/web/assets/icons/favicon.icns',
|
icon='src/interface/web/assets/icons/favicon.icns',
|
||||||
bundle_identifier=None,
|
bundle_identifier=None,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user