File size: 1,086 Bytes
e98c0d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash

set -e

if [ -z "$DEPENDABOT_NATIVE_HELPERS_PATH" ]; then
  echo "Unable to build, DEPENDABOT_NATIVE_HELPERS_PATH is not set"
  exit 1
fi

install_dir="$DEPENDABOT_NATIVE_HELPERS_PATH/python"
mkdir -p "$install_dir"

helpers_dir="$(dirname "${BASH_SOURCE[0]}")"
cp -r \
  "$helpers_dir/lib" \
  "$helpers_dir/run.py" \
  "$helpers_dir/requirements.txt" \
  "$install_dir"

cd "$install_dir"
PYENV_VERSION=$1 pyenv exec pip3 --disable-pip-version-check install --use-pep517 -r "requirements.txt"

# Remove the extra objects added during the previous install. Based on
# https://github.com/docker-library/python/blob/master/Dockerfile-linux.template
# And the image docker.io/library/python
find "${PYENV_ROOT:-/usr/local/.pyenv}/versions" -depth \
    \( \
    \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
    -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \
    \) -exec rm -rf '{}' +

find -L "${PYENV_ROOT:-/usr/local/.pyenv}/versions" -type f  \
    -name '*.so' \
    -exec strip --preserve-dates {} +