Skip to content

Commit

Permalink
Use tempfile instead of __updated__
Browse files Browse the repository at this point in the history
Fixes #91
  • Loading branch information
keith committed Aug 7, 2024
1 parent ed49781 commit 3e4f860
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions uv/private/pip_compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ REQUIREMENTS_TXT="{{requirements_txt}}"
COMPILE_COMMAND="{{compile_command}}"

# make a writable copy of incoming requirements
cp "$REQUIREMENTS_TXT" __updated__
updated_file=$(mktemp)
trap 'rm -f "$updated_file"' EXIT
cp "$REQUIREMENTS_TXT" "$updated_file"

{{uv}} pip compile \
--quiet \
--no-cache \
{{args}} \
--output-file="__updated__" \
--output-file="$updated_file" \
"$REQUIREMENTS_IN"

# check files match
DIFF="$(diff "$REQUIREMENTS_TXT" "__updated__" || true)"
DIFF="$(diff "$REQUIREMENTS_TXT" "$updated_file" || true)"
if [ "$DIFF" != "" ]
then
echo >&2 "FAIL: $REQUIREMENTS_TXT is out-of-date. Run '$COMPILE_COMMAND' to update."
Expand Down

0 comments on commit 3e4f860

Please sign in to comment.