File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 24
24
with :
25
25
python-version : " 3.11"
26
26
- name : Run check-requirements.sh script
27
- run : bash check-requirements.sh
27
+ run : bash check-requirements.sh nocleanup
Original file line number Diff line number Diff line change 6
6
# WARNING: This is quite IO intensive, because a fresh venv is set up for every
7
7
# python script.
8
8
#
9
+ # usage: ./check-requirements.sh [<working_dir>]
10
+ # ./check-requirements.sh 'nocleanup' [<working_dir>]
11
+ #
12
+ # where:
13
+ # - <working_dir> is a directory that can be used as the base for
14
+ # setting up the venvs. Defaults to `/tmp`.
15
+ # - 'nocleanup' as the first argument will disable automatic cleanup
16
+ # of the files created by this script.
17
+ #
9
18
# requires:
10
- # * bash >= 3.2.57
11
- # * shellcheck
19
+ # - bash >= 3.2.57
20
+ # - shellcheck
12
21
#
13
22
# For each script, it creates a fresh venv, `pip install -r` the
14
23
# requirements, and finally executes the python script with no arguments to
@@ -54,8 +63,12 @@ abort() {
54
63
exit 1
55
64
}
56
65
57
- trap abort SIGINT SIGTERM SIGQUIT SIGABRT
58
- trap cleanup EXIT
66
+ if [[ $1 == nocleanup ]]; then
67
+ shift # discard nocleanup arg
68
+ else
69
+ trap abort SIGINT SIGTERM SIGQUIT SIGABRT
70
+ trap cleanup EXIT
71
+ fi
59
72
60
73
set -eu -o pipefail
61
74
this=" $( realpath " $0 " ) "
@@ -107,6 +120,10 @@ check_convert_script() {
107
120
info " $py : beginning check"
108
121
109
122
local reqs=" requirements-$pyname .txt"
123
+ if [[ ! -r " $reqs " ]]; then
124
+ fatal " $py missing requirements. Expected: $reqs "
125
+ fi
126
+
110
127
local venv=" $workdir /$pyname -venv"
111
128
python3 -m venv " $venv "
112
129
You can’t perform that action at this time.
0 commit comments