summaryrefslogtreecommitdiff
path: root/extension/scripts
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-27 09:58:56 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-27 09:58:56 -0700
commit73c6827d02ff62313184e3745fd94c7591c98b61 (patch)
tree6d42f74c7c3740dd8d03b1cbe61ec8ac3439678b /extension/scripts
parent8db5b39170229ba93b83f526e7fd80056e461c6a (diff)
downloadsncontinue-73c6827d02ff62313184e3745fd94c7591c98b61.tar.gz
sncontinue-73c6827d02ff62313184e3745fd94c7591c98b61.tar.bz2
sncontinue-73c6827d02ff62313184e3745fd94c7591c98b61.zip
fix: :bug: handle when vscode workspace not open
Diffstat (limited to 'extension/scripts')
-rw-r--r--extension/scripts/install_from_source.py37
1 files changed, 22 insertions, 15 deletions
diff --git a/extension/scripts/install_from_source.py b/extension/scripts/install_from_source.py
index bbb86797..d004259b 100644
--- a/extension/scripts/install_from_source.py
+++ b/extension/scripts/install_from_source.py
@@ -6,7 +6,28 @@ def run(cmd: str):
return subprocess.run(cmd, shell=True, capture_output=False)
+def get_latest_version() -> str:
+ latest = None
+ latest_major = 0
+ latest_minor = 0
+ latest_patch = 0
+ for file in os.listdir("../build"):
+ if file.endswith(".vsix"):
+ version = file.split("-")[1].split(".vsix")[0]
+ major, minor, patch = list(
+ map(lambda x: int(x), version.split(".")))
+ if latest is None or (major >= latest_major and minor >= latest_minor and patch > latest_patch):
+ latest = file
+ latest_major = major
+ latest_minor = minor
+ latest_patch = patch
+
+
def main():
+ # Clear out old stuff
+ run(f"rm -rf ../build/{get_latest_version()}")
+ run("rm ../server/continuedev-0.1.2-py3-none-any.whl")
+
# Check for Python and Node - we won't install them, but will warn
resp1 = run("python --version")
resp2 = run("python3 --version")
@@ -39,21 +60,7 @@ def main():
print("This was the error: ", resp.stderr)
return
- latest = None
- latest_major = 0
- latest_minor = 0
- latest_patch = 0
- for file in os.listdir("../build"):
- if file.endswith(".vsix"):
- version = file.split("-")[1].split(".vsix")[0]
- major, minor, patch = list(
- map(lambda x: int(x), version.split(".")))
- if latest is None or (major >= latest_major and minor >= latest_minor and patch > latest_patch):
- latest = file
- latest_major = major
- latest_minor = minor
- latest_patch = patch
-
+ latest = get_latest_version()
resp = run(f"cd ..; code --install-extension ./build/{latest}")
print("Continue VS Code extension installed successfully. Please restart VS Code to use it.")