diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-05-28 15:11:46 -0400 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-05-28 15:11:46 -0400 |
commit | 64643e87e9af8b98945614119179e45fc95281e4 (patch) | |
tree | 396156b0cca282c936a60a20b33ba725e956d1dc /extension/scripts/install_from_source.py | |
parent | 306ab404ce687db5a67762d63b159118ab592837 (diff) | |
download | sncontinue-64643e87e9af8b98945614119179e45fc95281e4.tar.gz sncontinue-64643e87e9af8b98945614119179e45fc95281e4.tar.bz2 sncontinue-64643e87e9af8b98945614119179e45fc95281e4.zip |
First load fail error fixed
Diffstat (limited to 'extension/scripts/install_from_source.py')
-rw-r--r-- | extension/scripts/install_from_source.py | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/extension/scripts/install_from_source.py b/extension/scripts/install_from_source.py index 4fe903ed..28f382b0 100644 --- a/extension/scripts/install_from_source.py +++ b/extension/scripts/install_from_source.py @@ -1,43 +1,61 @@ +import os import subprocess def run(cmd: str): - return subprocess.run(cmd, shell=True, capture_output=True) + return subprocess.run(cmd, shell=True, capture_output=False) def main(): # Check for Python and Node - we won't install them, but will warn - out, err1 = run("python --version") - out, err2 = run("python3 --version") - if err1 and err2: + resp1 = run("python --version") + resp2 = run("python3 --version") + if resp1.stderr and resp2.stderr: print("Python is required for Continue but is not installed on your machine. See https://www.python.org/downloads/ to download the latest version, then try again.") return - out, err = run("node --version") - if err: + resp = run("node --version") + if resp.stderr: print("Node is required for Continue but is not installed on your machine. See https://nodejs.org/en/download/ to download the latest version, then try again.") return - out, err = run("npm --version") - if err: + resp = run("npm --version") + if resp.stderr: print("NPM is required for Continue but is not installed on your machine. See https://nodejs.org/en/download/ to download the latest version, then try again.") return - out, err = run("poetry --version") - if err: + resp = run("poetry --version") + if resp.stderr: print("Poetry is required for Continue but is not installed on your machine. See https://python-poetry.org/docs/#installation to download the latest version, then try again.") return - out, err = run("cd ../../continuedev; poetry run typegen") + resp = run("cd ../../continuedev; poetry run typegen") - out, err = run( - "cd ..; npm i; cd react-app; npm i; cd ..; npm run full-package\r y\r npm run install-extension") + resp = run( + "cd ..; npm i; cd react-app; npm i; cd ..; npm run full-package") - if err: - print("Error installing the extension. Please try again.") - print("This was the error: ", err) + if resp.stderr: + print("Error packaging the extension. Please try again.") + 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 + + resp = run(f"cd ..; code --install-extension ./build/{latest}") + print("Continue VS Code extension installed successfully. Please restart VS Code to use it.") |