mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-07-03 07:05:20 +00:00

### Summary Adds a CI check to ensure that packages added as dependencies are appropriately licensed. All of the `.txt` files in the `requirements` directory are checked with the exception of: - `constraints.txt`, since those are not installed and are instead conditions on the other dependency files - `dev.txt`, since those are for local development and not shipped as part of the `unstructured` package - `extra-pdf-image.txt` - the `extra-pdf-image.in` since checking `extra-pdf-image.txt` pulls in NVIDIA GPU related packages with an `Other/Proprietary` license type, and there's not a good way to exclude those without adding `Other/Proprietary` to the allowed licenses list. ### Testing The new `check-licenses` job should pass in CI.
22 lines
534 B
Bash
Executable File
22 lines
534 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
REQUIREMENTS_FILES=$(find requirements -type f -name "*.txt" \
|
|
-name "extra-pdf-image.in" \
|
|
! -name "extra-pdf-image.txt" \
|
|
! -name "constraints.txt" \
|
|
! -name "dev.txt")
|
|
|
|
for REQUIREMENTS_FILE in $REQUIREMENTS_FILES; do
|
|
echo "Checking $REQUIREMENTS_FILE"
|
|
liccheck -r "$REQUIREMENTS_FILE"
|
|
EXIT_CODE=$?
|
|
if [ "$EXIT_CODE" -eq 0 ]; then
|
|
echo "All dependencies have authorized licenses."
|
|
else
|
|
echo "There are dependencies with unauthorized or unknown licenses."
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
exit 0
|