-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestLocalWhl.sh
executable file
·72 lines (57 loc) · 1.3 KB
/
testLocalWhl.sh
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
#! /usr/bin/env bash
set -x
WHAT="spectra?assure?sdk"
VERSION_FILE="./spectra_assure_api_client/version.py"
get_version()
{
# sets VERSION and PACKAGE_FILE
export VERSION=$(
cat "${VERSION_FILE}" |
awk '
/VERSION/ && /=/ {
version=$NF;
gsub(/"/,"", version);
print version
}
'
)
echo "VERSION: ${VERSION}" >&2
[ -z "${VERSION}" ] && {
echo "FATAL: version is not found in '$VERSION_FILE'" >&2
exit 101
}
export PACKAGE_FILE=$(
ls dist/${WHAT}-${VERSION}-py3-none-any.whl
)
echo "Dist now contains:"
ls -l "${PACKAGE_FILE}"
[ ! -f "${PACKAGE_FILE}" ] && {
echo "FATAL: cannot find the package file: ${PACKAGE_FILE}" >&2
exit 101
}
}
makeVenv()
{
rm -rf ${VENV}
${MIN_PYTHON_VERSION} -m venv ${VENV}
source ./${VENV}/bin/activate
}
installFromDistWhl()
{
ls -l "${PACKAGE_FILE}"
which pip3 |
grep "${VENV}" || {
# verify we are using the pip3 from the virtual env
echo "FATAL: we are not using the virtual env programs" >&2
exit 101
}
pip3 install "${PACKAGE_FILE}"
pip3 list # show the currently installed packages
}
main()
{
get_version
makeVenv
installFromDistWhl
}
main "$@"