|
3 | 3 | set -e |
4 | 4 | set -x |
5 | 5 |
|
6 | | -OUTPUT_PATH="${1:-.}" |
| 6 | +# Ensure OUTPUT_PATH is defined as a fully qualified path |
| 7 | +pushd $(dirname $(realpath "$0")) |
| 8 | +OUTPUT_PATH=${1:-.} |
| 9 | +if [ ! -d "${OUTPUT_PATH}" ]; then |
| 10 | + mkdir -p ${OUTPUT_PATH} |
| 11 | +fi |
| 12 | +OUTPUT_PATH=$(realpath ${OUTPUT_PATH}) |
| 13 | +popd |
| 14 | + |
| 15 | +wheel2debconf="$(dirname "$(realpath "$0")")"/wheel2deb.yml |
7 | 16 |
|
8 | 17 | function build_from_pypi { |
9 | 18 | PACKAGE_NAME="$1" |
@@ -42,14 +51,43 @@ function build_from_pypi { |
42 | 51 | rm "${PREREM_TMP}" |
43 | 52 | } |
44 | 53 |
|
| 54 | +function build_from_pypi_wheel { |
| 55 | + PACKAGE_NAME=$1 |
| 56 | + |
| 57 | + if [ -z $2 ]; then |
| 58 | + PACKAGE_VERSION="" |
| 59 | + # Get the most recent package version from PyPI to be included in the package name of the Debian artifact |
| 60 | + curl -X GET "https://pypi.org/pypi/${PACKAGE_NAME}/json" > "${PACKAGE_NAME}.json" |
| 61 | + PACKAGE_VERSION="==$(cat "${PACKAGE_NAME}.json" | jq --raw-output '.info.version')" |
| 62 | + rm "${PACKAGE_NAME}.json" |
| 63 | + else |
| 64 | + PACKAGE_VERSION="==$2" |
| 65 | + fi |
| 66 | + |
| 67 | + rm -rvf /tmp/wheel |
| 68 | + mkdir /tmp/wheel |
| 69 | + pushd /tmp/wheel |
| 70 | + pip3 wheel ${PACKAGE_NAME}${PACKAGE_VERSION} |
| 71 | + # Can't build cytoolz using wheel for rlp, but can't build rlp with fpm |
| 72 | + rm -f /tmp/wheel/cytoolz* |
| 73 | + wheel2deb --config ${wheel2debconf} |
| 74 | + popd |
| 75 | + mv /tmp/wheel/output/*.deb ${OUTPUT_PATH} |
| 76 | + rm -rvf /tmp/wheel |
| 77 | +} |
| 78 | + |
| 79 | +# Install any python requirements needed for the builds. |
| 80 | +pip3 install wheel2deb |
| 81 | +apt-get update -y && apt-get install -y debhelper |
| 82 | + |
45 | 83 | # build 3rd parties: |
46 | 84 | # build_from_pypi <pypi-name> <version> |
47 | 85 | # TODO duplicates list from Jenkinsfile.cd |
48 | 86 |
|
49 | 87 | SCRIPT_PATH="${BASH_SOURCE[0]}" |
50 | 88 | pushd `dirname ${SCRIPT_PATH}` >/dev/null |
51 | 89 |
|
52 | | -build_from_pypi importlib-metadata 3.10.1 |
| 90 | +build_from_pypi_wheel importlib-metadata 3.10.1 |
53 | 91 | build_from_pypi timeout-decorator |
54 | 92 | build_from_pypi distro 1.7.0 |
55 | 93 |
|
|
0 commit comments