Skip to content

Commit

Permalink
Add bash script to run vendoring and tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Sep 7, 2024
1 parent 1d33e10 commit 69bbcae
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions conda_lock/scripts/vendor_poetry/rerun_vendoring.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -euo pipefail

if ! command -v vendoring &> /dev/null; then
echo "vendoring not found on PATH. Please install vendoring with 'pip install vendoring'."
exit 1
fi

if ! command -v dos2unix &> /dev/null; then
echo "dos2unix not found on PATH. Please install dos2unix with 'apt-get install dos2unix' or 'brew install dos2unix'."
exit 1
fi

if [ ! -f pyproject.toml ]; then
echo "pyproject.toml not found in the current directory. Please run this script from the root of the project:"
echo " conda_lock/scripts/vendor_poetry/rerun_vendoring.sh"
exit 1
fi

vendoring sync -vvv .

echo Fixing CRLF line endings...
dos2unix conda_lock/_vendor/poetry/core/_vendor/lark/grammars/*
dos2unix conda_lock/_vendor/poetry/core/_vendor/fastjsonschema/*
dos2unix conda_lock/_vendor/conda/_vendor/boltons/LICENSE
dos2unix conda_lock/_vendor/poetry/core/_vendor/lark/LICENSE

echo Downloading missing licenses...
for package in poetry poetry-core cleo; do
curl -s "https://raw.githubusercontent.com/python-poetry/${package}/master/LICENSE" > "conda_lock/_vendor/${package}.LICENSE"
done

echo Removing duplicate licenses...
# This one is actually correct, but we downloaded it to poetry-core.LICENSE above.
diff conda_lock/_vendor/poetry_core.LICENSE conda_lock/_vendor/poetry-core.LICENSE
rm conda_lock/_vendor/poetry-core.LICENSE
# These are licenses for poetry_core's vendored 'packaging', not poetry_core itself.
diff conda_lock/_vendor/poetry/core/_vendor/packaging/LICENSE.APACHE conda_lock/_vendor/poetry_core.LICENSE.APACHE
diff conda_lock/_vendor/poetry/core/_vendor/packaging/LICENSE.BSD conda_lock/_vendor/poetry_core.LICENSE.BSD
rm conda_lock/_vendor/poetry_core.LICENSE.APACHE
rm conda_lock/_vendor/poetry_core.LICENSE.BSD

echo "Vendoring complete. Please commit the changes."

0 comments on commit 69bbcae

Please sign in to comment.