Reduce Windows App Size by Removing Unused Libraries under Torch/Lib

Tighten the duplicate library removal code in Khoj.spec
This commit is contained in:
Debanjum Singh Solanky
2022-08-18 11:25:52 +03:00
parent b78ee317ae
commit 082fe937b9

View File

@@ -32,15 +32,14 @@ a = Analysis(
noarchive=False, noarchive=False,
) )
# Filter out unused, duplicate shared libs under torch/lib # Filter out unused, duplicate shared libs
torch_lib_path = set([ extension = {'Windows': '.dll', 'Darwin': '.dylib', 'Linux': '.so'}[system()]
join('torch', 'lib', 'libtorch_cuda.so'), torch_lib_paths = {
join('torch', 'lib', 'libtorch_cuda.dylib'), join('torch', 'lib', 'libtorch_cuda' + extension),
join('torch', 'lib', 'libtorch_cpu.so'), join('torch', 'lib', 'libtorch_cpu' + extension),
join('torch', 'lib', 'libtorch_cpu.dylib'), join('torch', 'lib', 'libtorch_python' + extension)
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_paths]
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)