mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-26 00:46:07 +08:00
修复依赖是否安装检查逻辑
This commit is contained in:
parent
1c18668bad
commit
224000b63b
|
@ -517,15 +517,22 @@ export async function setSystemTimezone(timezone: string): Promise<boolean> {
|
|||
export function getGetCommand(type: DependenceTypes, name: string): string {
|
||||
const baseCommands = {
|
||||
[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 "exec('''
|
||||
name='${name}'
|
||||
try:
|
||||
from importlib.metadata import version
|
||||
print(version(name))
|
||||
except:
|
||||
import importlib.util as u
|
||||
import importlib.metadata as m
|
||||
spec=u.find_spec(name)
|
||||
print(name if spec else '')
|
||||
''')"`,
|
||||
[DependenceTypes.linux]: `apk info -es ${name}`,
|
||||
};
|
||||
|
||||
let command = baseCommands[type];
|
||||
|
||||
return type === DependenceTypes.python3
|
||||
? command
|
||||
: `${command} ${name.trim()}`;
|
||||
return baseCommands[type];
|
||||
}
|
||||
|
||||
export function getInstallCommand(type: DependenceTypes, name: string): string {
|
||||
|
|
Loading…
Reference in New Issue
Block a user