summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Mearman <joseph@mearman.co.uk>2023-09-23 02:09:38 +0100
committerGitHub <noreply@github.com>2023-09-22 18:09:38 -0700
commit470711d25b44d1a545c57bc17d40d5e1fd402216 (patch)
treee0425a5f20bfb1a7ec02d99e8f192df4851d27ab
parent1188dd7e5f26ed57d034c927ba032739963b9abc (diff)
downloadsncontinue-470711d25b44d1a545c57bc17d40d5e1fd402216.tar.gz
sncontinue-470711d25b44d1a545c57bc17d40d5e1fd402216.tar.bz2
sncontinue-470711d25b44d1a545c57bc17d40d5e1fd402216.zip
Update PyInstaller call to detect M1 architecture or allow manual override (#497)
* The shebang must be on the first line. Delete blanks and move comments. See SC1128. https://github.com/koalaman/shellcheck/wiki/SC1128 * In POSIX sh, 'source' in place of '.' is undefined. https://github.com/koalaman/shellcheck/wiki/SC2039 * build.sh: Update PyInstaller call to detect M1 architecture or allow manual override This commit updates the build.sh script to include logic for detecting the M1 architecture or allowing a manual override. The SPEC_FILE variable is set accordingly based on the provided argument ("m1" or "regular") or the system's architecture. This ensures that the correct spec file is used when calling PyInstaller from within the virtual environment. Additionally, a comment is added to clarify each step of the process. Note: The virtual environment is deactivated at the end of the script. * build.sh: Add architecture detection and print statements - Added architecture detection for M1 and regular architectures - Print statements added to indicate the detected architecture and spec file being used * Update build script command for M1 Mac in manually-run-continue.md The build script command for building on an M1 Mac has been updated to `sh build.sh m1` instead of `sh buildm1.sh`. This change ensures that the correct build script is used when building for an M1 Mac.
-rwxr-xr-x[-rw-r--r--]build.sh29
-rw-r--r--buildm1.sh22
-rw-r--r--docs/docs/walkthroughs/manually-run-continue.md2
3 files changed, 25 insertions, 28 deletions
diff --git a/build.sh b/build.sh
index c9dd60f6..895094ba 100644..100755
--- a/build.sh
+++ b/build.sh
@@ -12,11 +12,30 @@ python3 -m venv env
# 3. Install the required packages
pip install -r continuedev/requirements.txt
-
pip install pyinstaller
-# 4. Call PyInstaller from within the virtual environment
-env/bin/pyinstaller run.spec
+# 4. Detect M1 architecture or allow manual override
+if [ "$1" = "m1" ]; then
+ echo "Building for M1 architecture"
+ SPEC_FILE="run.m1.spec"
+elif [ "$1" = "regular" ]; then
+ echo "Building for regular architecture"
+ SPEC_FILE="run.spec"
+else
+ ARCH=$(uname -m)
+ if [ "$ARCH" = "arm64" ]; then
+ echo "$ARCH architecture detected, using M1 spec file"
+ SPEC_FILE="run.m1.spec"
+ else
+ echo "$ARCH architecture detected, using regular spec file"
+ SPEC_FILE="run.spec"
+ fi
+fi
+
+echo "Using $SPEC_FILE"
+
+# 5. Call PyInstaller from within the virtual environment
+env/bin/pyinstaller $SPEC_FILE
-# 5. Deactivate the virtual environment
-deactivate \ No newline at end of file
+# 6. Deactivate the virtual environment
+deactivate
diff --git a/buildm1.sh b/buildm1.sh
deleted file mode 100644
index fbb127c2..00000000
--- a/buildm1.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-# 1. Remove unwanted stuff
-rm -rf build
-rm -rf env
-rm -rf dist
-rm -rf continuedev/.venv
-
-# 2. Create a new virtual environment and activate it
-python3 -m venv env
-source env/bin/activate
-
-# 3. Install the required packages
-pip install -r continuedev/requirements.txt
-
-pip install pyinstaller
-
-# 4. Call PyInstaller from within the virtual environment
-env/bin/pyinstaller run.m1.spec
-
-# 5. Deactivate the virtual environment
-deactivate \ No newline at end of file
diff --git a/docs/docs/walkthroughs/manually-run-continue.md b/docs/docs/walkthroughs/manually-run-continue.md
index 26b8e07e..a20fe69b 100644
--- a/docs/docs/walkthroughs/manually-run-continue.md
+++ b/docs/docs/walkthroughs/manually-run-continue.md
@@ -40,7 +40,7 @@ If you don't want to use the PyPI package, but need a version of Continue that w
1. Clone the [Continue repo](https://github.com/continuedev/continue)
2. Change directories into the repo: `cd continue`
-3. Run the build script: `sh build.sh` (or `sh buildm1.sh` if building for an M1 Mac, or `build.cmd` if on Windows without WSL)
+3. Run the build script: `sh build.sh` (or `sh build.sh m1` if building for an M1 Mac, or `build.cmd` if on Windows without WSL)
4. Now that the binary is outputted in the `./dist` folder, start the server by running `./dist/run`. You should see that it begins listening on port 65432.
## Run the server from source