dotnet-installer/eng/install-scancode.sh
github-actions[bot] a6c135a934
[release/8.0.1xx] Set install-scancode script to be executable (#17537)
Co-authored-by: Matt Thalman <mthalman@microsoft.com>
2023-10-17 15:22:55 +00:00

22 lines
507 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
# https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#installation-as-a-library-via-pip
pyEnvPath="/tmp/scancode-env"
python3 -m venv $pyEnvPath
source $pyEnvPath/bin/activate
pip install scancode-toolkit
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