mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-27 18:06:08 +08:00
修复依赖是否安装检查逻辑
This commit is contained in:
parent
1c18668bad
commit
0ff60f8cf8
|
@ -517,15 +517,11 @@ export async function setSystemTimezone(timezone: string): Promise<boolean> {
|
||||||
export function getGetCommand(type: DependenceTypes, name: string): string {
|
export function getGetCommand(type: DependenceTypes, name: string): string {
|
||||||
const baseCommands = {
|
const baseCommands = {
|
||||||
[DependenceTypes.nodejs]: `pnpm ls -g | grep "${name}" | head -1`,
|
[DependenceTypes.nodejs]: `pnpm ls -g | grep "${name}" | head -1`,
|
||||||
[DependenceTypes.python3]: `python3 -c "import importlib;pkg=importlib.import_module('${name}');print(getattr(pkg, '__version__', 'inner package'))"`,
|
[DependenceTypes.python3]: `python3 -c "import sys, importlib.util; from importlib.metadata import version, PackageNotFoundError; m=sys.argv[1]; spec=importlib.util.find_spec(m); print(version(m) if spec and 'site-packages' in (spec.origin or '') else (m if spec else ''))" ${name}`,
|
||||||
[DependenceTypes.linux]: `apk info -es ${name}`,
|
[DependenceTypes.linux]: `apk info -es ${name}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
let command = baseCommands[type];
|
return baseCommands[type];
|
||||||
|
|
||||||
return type === DependenceTypes.python3
|
|
||||||
? command
|
|
||||||
: `${command} ${name.trim()}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInstallCommand(type: DependenceTypes, name: string): string {
|
export function getInstallCommand(type: DependenceTypes, name: string): string {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user