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 {
|
||||
// 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.")
|
||||
return true;
|
||||
} catch(error) {
|
||||
|
@ -20,6 +20,7 @@ export class UiUtilVscode implements UiUtil {
|
||||
|
||||
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.Workspace);
|
||||
}
|
||||
public async secretStorageGet(key: string): Promise<string | undefined> {
|
||||
try {
|
||||
|
@ -89,23 +89,23 @@ def pip_install_devchat(pythoncmd):
|
||||
# if not, install devchat
|
||||
|
||||
# first step: check if devchat is installed
|
||||
try:
|
||||
# before command run, output runnning command
|
||||
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)
|
||||
# try:
|
||||
# # before command run, output runnning command
|
||||
# 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)
|
||||
|
||||
pipCommandEnv = pythoncmd.replace("/python", "/devchat")
|
||||
print("==> devchatCommandEnv: ", pipCommandEnv)
|
||||
# pipCommandEnv = pythoncmd.replace("/python", "/devchat")
|
||||
# print("==> devchatCommandEnv: ", pipCommandEnv)
|
||||
|
||||
return True
|
||||
except Exception as error:
|
||||
# devchat is not installed
|
||||
print('devchat is not installed')
|
||||
print(error)
|
||||
pass
|
||||
# return True
|
||||
# except Exception as error:
|
||||
# # devchat is not installed
|
||||
# print('devchat is not installed')
|
||||
# print(error)
|
||||
# pass
|
||||
|
||||
# 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")
|
||||
print("==> devchatCommandEnv: ", pip_command_env)
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user