Update DevChat dependency check and configuration update
- Added version check for DevChat in checkDevChatDependency function. - Updated configuration in both Global and Workspace scopes. - Commented out the initial DevChat check in install.py and added --force flag to pip install command.
This commit is contained in:
parent
9e056e26d2
commit
3136283970
@ -31,7 +31,13 @@ export function checkDevChatDependency(pythonCommand: string, showError: boolean
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Check if DevChat is installed
|
// Check if DevChat is installed
|
||||||
runCommand(`"${devChat}" --help`);
|
const expectVersion = 'DevChat 0.1.15';
|
||||||
|
const devchatVersion = runCommand(`"${devChat}" --version`).toString().trim();
|
||||||
|
if (devchatVersion < expectVersion) {
|
||||||
|
logger.channel()?.info("devchat version: ${devchatVersion}, but expect version: ${expectVersion}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
logger.channel()?.info("devchat has installed.")
|
logger.channel()?.info("devchat has installed.")
|
||||||
return true;
|
return true;
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
|
@ -20,6 +20,7 @@ export class UiUtilVscode implements UiUtil {
|
|||||||
|
|
||||||
public async updateConfiguration(key1: string, key2: string, value: string): Promise<void> {
|
public async updateConfiguration(key1: string, key2: string, value: string): Promise<void> {
|
||||||
await vscode.workspace.getConfiguration(key1).update(key2, value, vscode.ConfigurationTarget.Global);
|
await vscode.workspace.getConfiguration(key1).update(key2, value, vscode.ConfigurationTarget.Global);
|
||||||
|
await vscode.workspace.getConfiguration(key1).update(key2, value, vscode.ConfigurationTarget.Workspace);
|
||||||
}
|
}
|
||||||
public async secretStorageGet(key: string): Promise<string | undefined> {
|
public async secretStorageGet(key: string): Promise<string | undefined> {
|
||||||
try {
|
try {
|
||||||
|
@ -89,23 +89,23 @@ def pip_install_devchat(pythoncmd):
|
|||||||
# if not, install devchat
|
# if not, install devchat
|
||||||
|
|
||||||
# first step: check if devchat is installed
|
# first step: check if devchat is installed
|
||||||
try:
|
# try:
|
||||||
# before command run, output runnning command
|
# # before command run, output runnning command
|
||||||
print("run command: ", pythoncmd, "-m", "pip", "show", "devchat")
|
# print("run command: ", pythoncmd, "-m", "pip", "show", "devchat")
|
||||||
subprocess.run([pythoncmd, "-m", "pip", "show", "devchat"], check=True, stdout=sys.stdout, stderr=sys.stderr, text=True)
|
# subprocess.run([pythoncmd, "-m", "pip", "show", "devchat"], check=True, stdout=sys.stdout, stderr=sys.stderr, text=True)
|
||||||
|
|
||||||
pipCommandEnv = pythoncmd.replace("/python", "/devchat")
|
# pipCommandEnv = pythoncmd.replace("/python", "/devchat")
|
||||||
print("==> devchatCommandEnv: ", pipCommandEnv)
|
# print("==> devchatCommandEnv: ", pipCommandEnv)
|
||||||
|
|
||||||
return True
|
# return True
|
||||||
except Exception as error:
|
# except Exception as error:
|
||||||
# devchat is not installed
|
# # devchat is not installed
|
||||||
print('devchat is not installed')
|
# print('devchat is not installed')
|
||||||
print(error)
|
# print(error)
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
# second step: install devchat
|
# second step: install devchat
|
||||||
if (pip_cmd_with_retries([pythoncmd, "-m", "pip", "install", "devchat"], 3, False)):
|
if (pip_cmd_with_retries([pythoncmd, "-m", "pip", "install", "devchat", "--force"], 3, False)):
|
||||||
pip_command_env = pythoncmd.replace("/python", "/devchat")
|
pip_command_env = pythoncmd.replace("/python", "/devchat")
|
||||||
print("==> devchatCommandEnv: ", pip_command_env)
|
print("==> devchatCommandEnv: ", pip_command_env)
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user