mirror of
https://github.com/whyour/qinglong.git
synced 2026-01-28 02:58:21 +08:00
Fix pyproject.toml path handling and add error handling
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
parent
f526d3f972
commit
023d0f1cc4
|
|
@ -600,8 +600,8 @@ export function getInstallCommand(type: DependenceTypes, name: string): string {
|
||||||
// Check if it's a pyproject.toml file
|
// Check if it's a pyproject.toml file
|
||||||
if (trimmedName.endsWith('pyproject.toml')) {
|
if (trimmedName.endsWith('pyproject.toml')) {
|
||||||
// For pyproject.toml, install from the directory containing it
|
// For pyproject.toml, install from the directory containing it
|
||||||
const dir = trimmedName.replace(/\/pyproject\.toml$/, '') || '.';
|
const dir = trimmedName.replace(/\/pyproject\.toml$/, '');
|
||||||
return `${command} ${dir}`;
|
return dir && dir !== 'pyproject.toml' ? `${command} ${dir}` : `${command} .`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,10 +133,13 @@ auto_install_python_deps() {
|
||||||
-X POST \
|
-X POST \
|
||||||
-H "Content-Type: application/json;charset=UTF-8" \
|
-H "Content-Type: application/json;charset=UTF-8" \
|
||||||
-H "Authorization: Bearer ${__ql_token__}" \
|
-H "Authorization: Bearer ${__ql_token__}" \
|
||||||
--data-raw "[{\"name\":\"${dep_name}\",\"type\":1,\"remark\":\"自动检测:${uniq_path} 订阅依赖\"}]" | jq -r '.code')
|
--data-raw "[{\"name\":\"${dep_name}\",\"type\":1,\"remark\":\"自动检测:${uniq_path} 订阅依赖\"}]" 2>/dev/null)
|
||||||
|
|
||||||
if [[ "$result" == "200" ]]; then
|
local code=$(echo "$result" | jq -r '.code' 2>/dev/null)
|
||||||
|
if [[ "$code" == "200" ]]; then
|
||||||
echo -e "已添加 requirements.txt 依赖安装任务\n"
|
echo -e "已添加 requirements.txt 依赖安装任务\n"
|
||||||
|
else
|
||||||
|
echo -e "添加 requirements.txt 依赖失败,请手动添加\n"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -153,10 +156,13 @@ auto_install_python_deps() {
|
||||||
-X POST \
|
-X POST \
|
||||||
-H "Content-Type: application/json;charset=UTF-8" \
|
-H "Content-Type: application/json;charset=UTF-8" \
|
||||||
-H "Authorization: Bearer ${__ql_token__}" \
|
-H "Authorization: Bearer ${__ql_token__}" \
|
||||||
--data-raw "[{\"name\":\"${dep_name}\",\"type\":1,\"remark\":\"自动检测:${uniq_path} 订阅依赖\"}]" | jq -r '.code')
|
--data-raw "[{\"name\":\"${dep_name}\",\"type\":1,\"remark\":\"自动检测:${uniq_path} 订阅依赖\"}]" 2>/dev/null)
|
||||||
|
|
||||||
if [[ "$result" == "200" ]]; then
|
local code=$(echo "$result" | jq -r '.code' 2>/dev/null)
|
||||||
|
if [[ "$code" == "200" ]]; then
|
||||||
echo -e "已添加 pyproject.toml 依赖安装任务\n"
|
echo -e "已添加 pyproject.toml 依赖安装任务\n"
|
||||||
|
else
|
||||||
|
echo -e "添加 pyproject.toml 依赖失败,请手动添加\n"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user