@@ -104,7 +104,7 @@ function python_version::parse_runtime_txt() {
104
104
in the correct format.
105
105
106
106
The following file contents were found, which aren't valid:
107
- ${contents}
107
+ ${contents: 0 : 100 }
108
108
109
109
However, the runtime.txt file is deprecated since it has
110
110
been replaced by the .python-version file. As such, we
@@ -125,6 +125,7 @@ function python_version::parse_runtime_txt() {
125
125
your app to receive Python security updates.
126
126
EOF
127
127
meta_set " failure_reason" " runtime-txt::invalid-version"
128
+ meta_set " failure_detail" " ${contents: 0: 50} "
128
129
exit 1
129
130
fi
130
131
}
@@ -174,6 +175,7 @@ function python_version::parse_python_version_file() {
174
175
your app to receive Python security updates.
175
176
EOF
176
177
meta_set " failure_reason" " python-version-file::invalid-version"
178
+ meta_set " failure_detail" " ${line: 0: 50} "
177
179
exit 1
178
180
fi
179
181
;;
@@ -193,17 +195,19 @@ function python_version::parse_python_version_file() {
193
195
begin with a '#', otherwise it will be treated as a comment.
194
196
EOF
195
197
meta_set " failure_reason" " python-version-file::no-version"
198
+ meta_set " failure_detail" " ${contents: 0: 50} "
196
199
exit 1
197
200
;;
198
201
* )
202
+ local first_five_version_lines=(" ${version_lines[@]: 0: 5} " )
199
203
output::error << -EOF
200
204
Error: Invalid Python version in .python-version.
201
205
202
206
Multiple versions were found in your .python-version file:
203
207
204
208
$(
205
209
IFS=$' \n '
206
- echo " ${version_lines [*]} "
210
+ echo " ${first_five_version_lines [*]} "
207
211
)
208
212
209
213
Update the file so it contains only one Python version.
@@ -212,6 +216,10 @@ function python_version::parse_python_version_file() {
212
216
lines begin with a '#', so that they are ignored.
213
217
EOF
214
218
meta_set " failure_reason" " python-version-file::multiple-versions"
219
+ meta_set " failure_detail" " $(
220
+ IFS=,
221
+ echo " ${first_five_version_lines[*]} "
222
+ ) "
215
223
exit 1
216
224
;;
217
225
esac
@@ -233,17 +241,19 @@ function python_version::read_pipenv_python_version() {
233
241
fi
234
242
235
243
if ! version=$( jq --raw-output ' ._meta.requires.python_full_version // ._meta.requires.python_version' " ${pipfile_lock_path} " 2>&1 ) ; then
244
+ local jq_error_message=" ${version} "
236
245
output::error << -EOF
237
246
Error: Can't parse Pipfile.lock.
238
247
239
248
A Pipfile.lock file was found, however, it couldn't be parsed:
240
- ${version }
249
+ ${jq_error_message }
241
250
242
251
This is likely due to it not being valid JSON.
243
252
244
253
Run 'pipenv lock' to regenerate/fix the lockfile.
245
254
EOF
246
255
meta_set " failure_reason" " pipfile-lock::invalid-json"
256
+ meta_set " failure_detail" " ${jq_error_message: 0: 100} "
247
257
exit 1
248
258
fi
249
259
@@ -282,6 +292,7 @@ function python_version::read_pipenv_python_version() {
282
292
https://pipenv.pypa.io/en/stable/specifiers.html#specifying-versions-of-python
283
293
EOF
284
294
meta_set " failure_reason" " pipfile-lock::invalid-version"
295
+ meta_set " failure_detail" " ${version: 0: 50} "
285
296
exit 1
286
297
fi
287
298
}
@@ -341,6 +352,7 @@ function python_version::resolve_python_version() {
341
352
EOF
342
353
fi
343
354
meta_set " failure_reason" " python-version::eol"
355
+ meta_set " failure_detail" " ${major} .${minor} "
344
356
exit 1
345
357
fi
346
358
@@ -388,6 +400,7 @@ function python_version::resolve_python_version() {
388
400
EOF
389
401
fi
390
402
meta_set " failure_reason" " python-version::unknown-major"
403
+ meta_set " failure_detail" " ${major} .${minor} "
391
404
exit 1
392
405
fi
393
406
0 commit comments