24
24
# shellcheck disable=SC1091
25
25
. rapids-generate-docstring;
26
26
27
- generate_env_yaml () {
28
- (
29
- (rapids-dependency-file-generator " ${ @: 2} " 2> /dev/null || echo " name: none " ) \
30
- | (grep -v ' ^# ' || [ " $? " == " 1 " ]) \
31
- | tee " ${1} " 1> /dev/null ;
32
- ) & true
27
+ _generate_env_yaml () {
28
+ if rapids-dependency-file-generator " $@ " 2> /dev/null \
29
+ | grep -v ' ^# ' 2> /dev/null \
30
+ | tee " $file " 1> /dev/null ; then
31
+ echo " $file "
32
+ fi
33
33
}
34
34
35
- make_conda_dependencies () {
36
- local -;
37
- set -euo pipefail;
38
-
39
- eval " $( _parse_args --skip ' -m,--manifest -o,--omit --repo' " $@ " < & 0) " ;
40
-
41
- eval " $( rapids-list-repos " ${OPTS[@]} " ) " ;
42
-
43
- # shellcheck disable=SC1091
44
- . devcontainer-utils-debug-output ' rapids_build_utils_debug' ' make-conda-env make-conda-dependencies' ;
45
-
46
- test ${# exclude[@]} -eq 0 && exclude=();
47
- test ${# include[@]} -eq 0 && include=();
48
- test ${# matrix_entry[@]} -eq 0 && matrix_entry=();
49
-
50
- local -a _exclude=();
51
- local exc; for exc in " ${exclude[@]} " ; do
52
- # append '-f' so each file's contents will be treated as a list of patterns for 'grep'
53
- _exclude+=(-f " ${exc} " );
54
- done
55
-
56
- local -a _include=();
57
- local inc; for inc in " ${include[@]} " ; do
58
- # append '-f' so each file's contents will be treated as a list of patterns for 'grep'
59
- _include+=(-f " ${inc} " );
60
- done
61
-
62
- local cuda_version=" ${CUDA_VERSION:- ${CUDA_VERSION_MAJOR:- 12} .${CUDA_VERSION_MINOR:- 0} } " ;
63
- cuda_version=" $( grep -o ' ^[0-9]*.[0-9]' <<< " ${cuda_version}" ) " ;
64
-
65
- local python_version=" ${PYTHON_VERSION:- $(" ${ORIG_PYTHON:- python3} " --version 2>&1 | cut -d' ' -f2)} " ;
66
- python_version=" $( cut -d' .' -f3 --complement <<< " ${python_version}" ) " ;
67
-
68
- local -a _matrix_selectors=(
69
- arch=" $( uname -m) "
70
- cuda=" ${cuda_version} "
71
- py=" ${python_version} "
72
- );
73
-
74
- # add extra arguments (if there are conflicts, e.g. 'py=3.10;py=3.11', it's fine... the last one will win)
75
- test ${# matrix_entry[@]} -gt 0 && _matrix_selectors+=(" ${matrix_entry[@]} " );
76
- local -r matrix_selectors=$( IFS=" ;" ; echo " ${_matrix_selectors[*]} " )
77
-
78
- local conda_env_yamls=();
79
-
80
- local i;
81
- local j;
82
-
35
+ _generate_env_yamls () {
83
36
for (( i= 0 ; i < ${repos_length:- 0} ; i+= 1 )) ; do
84
37
85
38
local repo=" repos_${i} " ;
@@ -113,15 +66,12 @@ make_conda_dependencies() {
113
66
local keyi;
114
67
115
68
for (( keyi= 0 ; keyi < ${# keys[@]} ; keyi+= 1 )) ; do
116
- local file=" /tmp/${name} .${keys[$keyi]} .env.yaml" ;
117
- conda_env_yamls+=(" ${file} " );
118
- generate_env_yaml \
119
- " ${file} " \
69
+ local file=" ${tmpdir} /${name} .${keys[$keyi]} .env.yaml" ;
70
+ _generate_env_yaml \
120
71
--file-key " ${keys[$keyi]} " \
121
72
--output conda \
122
73
--config ~ /" ${path} /dependencies.yaml" \
123
- --matrix " ${matrix_selectors} " \
124
- ;
74
+ --matrix " ${matrix_selectors} " &
125
75
done
126
76
127
77
local cpp_length=" ${repo} _cpp_length" ;
@@ -136,15 +86,12 @@ make_conda_dependencies() {
136
86
local keyi;
137
87
138
88
for (( keyi= 0 ; keyi < ${# keys[@]} ; keyi+= 1 )) ; do
139
- local file=" /tmp/${name} .${cpp_name} .${keys[$keyi]} .env.yaml" ;
140
- conda_env_yamls+=(" ${file} " );
141
- generate_env_yaml \
142
- " ${file} " \
89
+ local file=" ${tmpdir} /${name} .${cpp_name} .${keys[$keyi]} .env.yaml" ;
90
+ _generate_env_yaml \
143
91
--file-key " ${keys[$keyi]} " \
144
92
--output conda \
145
93
--config ~ /" ${path} /dependencies.yaml" \
146
- --matrix " ${matrix_selectors} " \
147
- ;
94
+ --matrix " ${matrix_selectors} " &
148
95
done
149
96
done
150
97
@@ -160,30 +107,86 @@ make_conda_dependencies() {
160
107
local keyi;
161
108
162
109
for (( keyi= 0 ; keyi < ${# keys[@]} ; keyi+= 1 )) ; do
163
- local file=" /tmp/${name} .${py_name} .${keys[$keyi]} .env.yaml" ;
164
- conda_env_yamls+=(" ${file} " );
165
- generate_env_yaml \
166
- " ${file} " \
110
+ local file=" ${tmpdir} /${name} .${py_name} .${keys[$keyi]} .env.yaml" ;
111
+ _generate_env_yaml \
167
112
--file-key " ${keys[$keyi]} " \
168
113
--output conda \
169
114
--config ~ /" ${path} /dependencies.yaml" \
170
- --matrix " ${matrix_selectors} " \
171
- ;
115
+ --matrix " ${matrix_selectors} " &
172
116
done
173
117
done
174
118
fi
175
119
done
120
+ }
121
+
122
+ _make_conda_dependencies () {
123
+ local -;
124
+ set -euo pipefail;
125
+
126
+ eval " $( _parse_args --skip ' -m,--manifest -o,--omit --repo' " $@ " < & 0) " ;
127
+
128
+ eval " $( rapids-list-repos " ${OPTS[@]} " ) " ;
129
+
130
+ # shellcheck disable=SC1091
131
+ . devcontainer-utils-debug-output ' rapids_build_utils_debug' ' make-conda-env make-conda-dependencies' ;
132
+
133
+ test ${# exclude[@]} -eq 0 && exclude=();
134
+ test ${# include[@]} -eq 0 && include=();
135
+ test ${# matrix_entry[@]} -eq 0 && matrix_entry=();
136
+
137
+ local -a _exclude=();
138
+ local exc; for exc in " ${exclude[@]} " ; do
139
+ # append '-f' so each file's contents will be treated as a list of patterns for 'grep'
140
+ _exclude+=(-f " ${exc} " );
141
+ done
142
+
143
+ local -a _include=();
144
+ local inc; for inc in " ${include[@]} " ; do
145
+ # append '-f' so each file's contents will be treated as a list of patterns for 'grep'
146
+ _include+=(-f " ${inc} " );
147
+ done
148
+
149
+ local cuda_version=" ${CUDA_VERSION:- ${CUDA_VERSION_MAJOR:- 12} .${CUDA_VERSION_MINOR:- 0} } " ;
150
+ cuda_version=" $( grep -o ' ^[0-9]*.[0-9]' <<< " ${cuda_version}" ) " ;
151
+
152
+ local python_version=" ${PYTHON_VERSION:- $(" ${ORIG_PYTHON:- python3} " --version 2>&1 | cut -d' ' -f2)} " ;
153
+ python_version=" $( cut -d' .' -f3 --complement <<< " ${python_version}" ) " ;
154
+
155
+ local -a _matrix_selectors=(
156
+ arch=" $( uname -m) "
157
+ cuda=" ${cuda_version} "
158
+ py=" ${python_version} "
159
+ );
160
+
161
+ # add extra arguments (if there are conflicts, e.g. 'py=3.10;py=3.11', it's fine... the last one will win)
162
+ test ${# matrix_entry[@]} -gt 0 && _matrix_selectors+=(" ${matrix_entry[@]} " );
163
+ local -r matrix_selectors=$( IFS=" ;" ; echo " ${_matrix_selectors[*]} " )
164
+
165
+ local conda_env_yamls=();
166
+
167
+ local i;
168
+ local j;
169
+
170
+ local -r tmpdir=" $( mktemp -d) " ;
171
+ # shellcheck disable=SC2064
172
+ trap " rm -rf '${tmpdir} '" EXIT;
173
+
174
+ readarray -t conda_env_yamls < <( _generate_env_yamls) ;
176
175
177
176
if test ${# conda_env_yamls[@]} -gt 0; then
178
177
179
- for (( i= 0 ; i < ${# conda_env_yamls[@]} ; i+= 1 )) ; do
180
- while ! test -f " ${conda_env_yamls[$i]} " ; do
181
- sleep 0.1;
182
- done
183
- done
178
+ readarray -t rapids_python_pkg_names < <( rapids-python-pkg-names) ;
179
+ readarray -t rapids_python_conda_pkg_names < <( rapids-python-conda-pkg-names) ;
184
180
185
- # shellcheck disable=SC2207
186
- local conda_noinstall=($( rapids-python-pkg-names) $( rapids-python-conda-pkg-names) );
181
+ local -a conda_noinstall=();
182
+
183
+ conda_noinstall+=(" ${rapids_python_pkg_names[@]} " );
184
+ conda_noinstall+=(" ${rapids_python_pkg_names[@]// " -" / " _" } " );
185
+ conda_noinstall+=(" ${rapids_python_pkg_names[@]// " _" / " -" } " );
186
+
187
+ conda_noinstall+=(" ${rapids_python_conda_pkg_names[@]} " );
188
+ conda_noinstall+=(" ${rapids_python_conda_pkg_names[@]// " -" / " _" } " );
189
+ conda_noinstall+=(" ${rapids_python_conda_pkg_names[@]// " _" / " -" } " );
187
190
188
191
# Generate a combined conda env yaml file.
189
192
conda-merge " ${conda_env_yamls[@]} " \
@@ -193,9 +196,7 @@ make_conda_dependencies() {
193
196
| ( if test ${# _exclude[@]} -gt 0; then grep -E -v " ${_exclude[@]} " || [ " $? " == " 1" ]; else cat -; fi ) \
194
197
| ( if test ${# _include[@]} -gt 0; then grep -E " ${_include[@]} " || [ " $? " == " 1" ]; else cat -; fi ) \
195
198
;
196
-
197
- rm -f " ${conda_env_yamls[@]} " ;
198
199
fi
199
200
}
200
201
201
- make_conda_dependencies " $@ " < & 0;
202
+ _make_conda_dependencies " $@ " < & 0;
0 commit comments