-
Notifications
You must be signed in to change notification settings - Fork 15
/
rapids-package-name
executable file
·81 lines (69 loc) · 1.91 KB
/
rapids-package-name
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# A utility script that generates a package name from a package type
# Positional Arguments:
# 1) package type
set -euo pipefail
export RAPIDS_SCRIPT_NAME="rapids-package-name"
repo_name="${RAPIDS_REPOSITORY##*/}"
if [ -z "$1" ]; then
rapids-echo-stderr "Must specify input arguments: PKG_TYPE"
exit 1
fi
pkg_type="$1"
append_cuda=0
append_wheelname=0
append_pyver=0
append_arch=0
case "${pkg_type}" in
conda_cpp)
append_cuda=1
append_arch=1
;;
conda_python)
append_cuda=1
append_pyver=1
append_arch=1
;;
wheel_cpp)
append_wheelname=1
append_arch=1
;;
wheel_python)
append_wheelname=1
# Pure wheels do not need a pyver or arch
if [[ ! -v RAPIDS_PY_WHEEL_PURE ]] || [[ "${RAPIDS_PY_WHEEL_PURE}" != "1" ]]; then
append_pyver=1
append_arch=1
fi
;;
*)
rapids-echo-stderr "Nonstandard package type '${pkg_type}'"
exit 1
;;
esac
pkg_name="${pkg_type}"
# for conda package types, append CUDA version
if (( append_cuda == 1 )); then
pkg_name+="_cuda${RAPIDS_CUDA_VERSION%%.*}"
fi
# for wheels, add the python wheel name if env var is set
if (( append_wheelname )) && [[ -v RAPIDS_PY_WHEEL_NAME ]] && [[ "${RAPIDS_PY_WHEEL_NAME}" != "" ]]; then
pkg_name+="_${RAPIDS_PY_WHEEL_NAME}"
fi
# for python package types (except pure wheels), add pyver
if (( append_pyver == 1 )); then
pkg_name+="_py${RAPIDS_PY_VERSION//./}"
fi
# for cpp and python package types (except pure wheels), append the arch
if (( append_arch == 1)); then
if [[ -v RAPIDS_ARCH ]] && [[ "${RAPIDS_ARCH}" != "" ]]; then
# use arch override if specified
pkg_name+="_${RAPIDS_ARCH}"
else
# otherwise use architecture of the host that's running the upload command
pkg_name+="_$(arch)"
fi
fi
# for cpp and python package types, it's a tarball, append .tar.gz and prepend project name
pkg_name="${repo_name}_${pkg_name}.tar.gz"
echo -n "${pkg_name}"