summaryrefslogtreecommitdiff
path: root/extension
diff options
context:
space:
mode:
authorKirill Dubovitskiy <kirill2003de@gmail.com>2023-08-06 18:31:52 -0700
committerKirill Dubovitskiy <kirill2003de@gmail.com>2023-08-06 18:31:52 -0700
commit1598a614b248085d16006b79cd55f6fbce4d6bf5 (patch)
tree9e75095979da29d2d84841ac2421cfa7952b0bfd /extension
parent57139952995014ec154e5190a932c32f180aa5dc (diff)
downloadsncontinue-1598a614b248085d16006b79cd55f6fbce4d6bf5.tar.gz
sncontinue-1598a614b248085d16006b79cd55f6fbce4d6bf5.tar.bz2
sncontinue-1598a614b248085d16006b79cd55f6fbce4d6bf5.zip
Fixed up broken script for installing extension built locally - we can probably just kill this code
Diffstat (limited to 'extension')
-rw-r--r--extension/scripts/install_from_source.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/extension/scripts/install_from_source.py b/extension/scripts/install_from_source.py
index 5e16bf21..cd8f5cde 100644
--- a/extension/scripts/install_from_source.py
+++ b/extension/scripts/install_from_source.py
@@ -1,3 +1,5 @@
+# Run from extension/scripts directory
+
import os
import subprocess
@@ -5,23 +7,22 @@ import subprocess
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
-
+ # Ensure build directory exists
+ if not os.path.exists("../build"):
+ os.mkdir("../build")
+
+ def version_tuple(filename):
+ version = filename.split("-")[1].split(".vsix")[0]
+ return tuple(map(int, version.split(".")))
+
+ versions = [file for file in os.listdir("../build") if file.endswith(".vsix")]
+
+ # Ensure we have at least one version
+ if len(versions) == 0:
+ return None
+
+ return max(versions, key=version_tuple)
def main():
# Clear out old stuff
@@ -62,7 +63,7 @@ def main():
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.")