Make poup work with uv
This commit is contained in:
@@ -1,6 +1,21 @@
|
|||||||
function poup
|
function poup
|
||||||
set toml_state (git status --porcelain pyproject.toml | head -c 2)
|
set -l toml_state (git status --porcelain pyproject.toml | head -c 2)
|
||||||
|
set -l project_type unknown
|
||||||
|
set -l lockfile unknown
|
||||||
|
|
||||||
|
if test -e poetry.lock
|
||||||
|
set project_type poetry
|
||||||
|
set lockfile poetry.lock
|
||||||
|
else if test -e uv.lock
|
||||||
|
set project_type uv
|
||||||
|
set lockfile uv.lock
|
||||||
|
else
|
||||||
|
echo "Unknown project type (neither poetry.lock nor uv.lock exists)" >/dev/stderr
|
||||||
|
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Make sure pyproject.toml doesn’t have conflicts
|
||||||
if test "$toml_state" = UU
|
if test "$toml_state" = UU
|
||||||
echo "pyproject.toml has conflicts, resolve those first"
|
echo "pyproject.toml has conflicts, resolve those first"
|
||||||
git mergetool pyproject.toml; or return
|
git mergetool pyproject.toml; or return
|
||||||
@@ -8,9 +23,15 @@ function poup
|
|||||||
end
|
end
|
||||||
|
|
||||||
if test "$toml_state" = "M " -o "$toml_state" = MM -o "$toml_state" = " M"
|
if test "$toml_state" = "M " -o "$toml_state" = MM -o "$toml_state" = " M"
|
||||||
git checkout --ours poetry.lock
|
git checkout --ours $lockfile
|
||||||
|
|
||||||
|
if test $project_type = poetry
|
||||||
poetry lock --no-update
|
poetry lock --no-update
|
||||||
and git add poetry.lock
|
else if test $project_type = uv
|
||||||
|
uv lock
|
||||||
|
end
|
||||||
|
|
||||||
|
and git add $lockfile
|
||||||
end
|
end
|
||||||
|
|
||||||
set toml_state (git status --porcelain poetry.lock | head -c 2)
|
set toml_state (git status --porcelain poetry.lock | head -c 2)
|
||||||
|
Reference in New Issue
Block a user