forked from continuedev/continue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontinue_server.spec
126 lines (112 loc) · 3.74 KB
/
continue_server.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# -*- mode: python ; coding: utf-8 -*-
import certifi
import os
import sys
from PyInstaller.utils.hooks import copy_metadata
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--arch", type=str)
parser.add_argument("--dir", action="store_true")
options = parser.parse_args()
block_cipher = None
import subprocess
def find_package_location(package_name):
try:
# Run the 'pip show' command and capture its output
result = subprocess.run(['pip', 'show', package_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True)
output = result.stdout
# Split the output into lines and find the 'Location' field
for line in output.splitlines():
if line.startswith('Location:'):
# Extract the path after the 'Location:' prefix
location = line.split(':', 1)[1].strip()
return location
except subprocess.CalledProcessError as e:
print(f"Error: {e.stderr}")
return None
chroma_path = find_package_location('chromadb')
chroma_toc = list(map(lambda x: (x[1], os.path.dirname(x[0])), Tree(f'{chroma_path}/chromadb/migrations', prefix="chromadb/migrations")))
tsl_path = find_package_location('tree_sitter_languages')
tsl_filename = "languages.dll" if sys.platform == "win32" else "languages.so"
a = Analysis(
['continue_server.py'],
pathex=[],
binaries=[(os.path.join(tsl_path, 'tree_sitter_languages', tsl_filename), "tree_sitter_languages")],
datas=[
('server/continuedev', 'continuedev'),
(certifi.where(), 'ca_bundle'),
('.tiktoken_cache', 'tiktoken_cache'),
] + copy_metadata('replicate') + chroma_toc,
hiddenimports=[
'anthropic', 'github', 'ripgrepy', 'bs4', 'redbaron', 'tree_sitter', 'tree_sitter_languages',
'chromadb', 'onnxruntime',
'chromadb.telemetry.posthog',
'chromadb.api.segment', 'chromadb.db.impl',
'chromadb.db.impl.sqlite', 'chromadb.migrations',
'chromadb.migrations.embeddings_queue', 'chromadb.migrations.sysdb',
'chromadb.migrations.metadb', 'chromadb.segment.impl',
'chromadb.segment.impl.manager', 'chromadb.segment.impl.manager.local',
'chromadb.segment.impl.metadata', 'chromadb.segment.impl.metadata.sqlite',
# 'pysqlite3'
],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
target_arch = "arm64" if options.arch == "m1" else None
print("Using target arch", target_arch)
if options.dir:
print("Using directory")
exe = EXE(
pyz,
a.scripts,
exclude_binaries=True,
name='continue_server',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=target_arch,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
name='continue_server',
)
else:
print("Using one file")
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='continue_server',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)