👷 parameterize .spec file
This commit is contained in:
parent
9f823a4e92
commit
7b7eacd700
5 changed files with 74 additions and 115 deletions
13
build.sh
13
build.sh
|
|
@ -15,27 +15,26 @@ pip install -r server/requirements.txt
|
|||
pip install pyinstaller
|
||||
|
||||
# 4. Detect M1 architecture or allow manual override
|
||||
USE_ARCH="intel"
|
||||
if [ "$1" = "m1" ]; then
|
||||
echo "Building for M1 architecture"
|
||||
SPEC_FILE="continue_server.m1.spec"
|
||||
USE_ARCH="m1"
|
||||
elif [ "$1" = "regular" ]; then
|
||||
echo "Building for regular architecture"
|
||||
SPEC_FILE="continue_server.spec"
|
||||
USE_ARCH="intel"
|
||||
else
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "arm64" ]; then
|
||||
echo "$ARCH architecture detected, using M1 spec file"
|
||||
SPEC_FILE="continue_server.m1.spec"
|
||||
USE_ARCH="m1"
|
||||
else
|
||||
echo "$ARCH architecture detected, using regular spec file"
|
||||
SPEC_FILE="continue_server.spec"
|
||||
USE_ARCH="intel"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Using $SPEC_FILE"
|
||||
|
||||
# 5. Call PyInstaller from within the virtual environment
|
||||
env/bin/pyinstaller $SPEC_FILE
|
||||
env/bin/pyinstaller continue_server.spec -- --arch $USE_ARCH
|
||||
|
||||
# 6. Deactivate the virtual environment
|
||||
deactivate
|
||||
|
|
|
|||
|
|
@ -1,85 +0,0 @@
|
|||
# -*- mode: python ; coding: utf-8 -*-
|
||||
import certifi
|
||||
import os
|
||||
import sys
|
||||
from PyInstaller.utils.hooks import copy_metadata
|
||||
|
||||
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'
|
||||
],
|
||||
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)
|
||||
|
||||
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="arm64",
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
|
|
@ -3,10 +3,15 @@ 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", type=bool, default=False)
|
||||
options = parser.parse_args()
|
||||
|
||||
block_cipher = None
|
||||
|
||||
|
||||
import subprocess
|
||||
def find_package_location(package_name):
|
||||
try:
|
||||
|
|
@ -63,24 +68,58 @@ a = Analysis(
|
|||
)
|
||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||
|
||||
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,
|
||||
)
|
||||
|
||||
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,
|
||||
)
|
||||
3
extensions/vscode/.gitignore
vendored
3
extensions/vscode/.gitignore
vendored
|
|
@ -6,4 +6,5 @@ data/
|
|||
src/client
|
||||
.continue
|
||||
|
||||
gui
|
||||
gui
|
||||
exe
|
||||
|
|
@ -66,6 +66,11 @@
|
|||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Continue collects anonymous usage data, cleaned of PII, to help us improve the product for our users. Read more at https://continue.dev/docs/telemetry."
|
||||
},
|
||||
"continue.showInlineTip": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Show inline suggestion to use the Continue keyboard shortcuts."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue