2023-10-12 14:28:42 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2023-10-25 20:39:45 +00:00
|
|
|
# Install instructions: https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#installation-as-a-library-via-pip
|
|
|
|
|
|
|
|
# See latest release at https://github.com/nexB/scancode-toolkit/releases
|
2024-04-08 18:57:20 +00:00
|
|
|
SCANCODE_VERSION="32.1.0"
|
2023-10-12 14:28:42 +00:00
|
|
|
|
|
|
|
pyEnvPath="/tmp/scancode-env"
|
|
|
|
python3 -m venv $pyEnvPath
|
|
|
|
source $pyEnvPath/bin/activate
|
2023-10-25 20:39:45 +00:00
|
|
|
pip install scancode-toolkit==$SCANCODE_VERSION
|
2023-10-12 14:28:42 +00:00
|
|
|
deactivate
|
|
|
|
|
|
|
|
# Setup a script which executes scancode in the virtual environment
|
|
|
|
cat > /usr/local/bin/scancode << EOF
|
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
source $pyEnvPath/bin/activate
|
|
|
|
scancode "\$@"
|
|
|
|
deactivate
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod +x /usr/local/bin/scancode
|