Minor style fixes suggested by ShellCheck. Mostly, these consist
of preferring '[[' to '[' in bash scripts. Other changes include quoting unquoted variables, and explicitly specifying bash as the interpreter for scripts that use features not defined in POSIX sh Fixes SC2046, SC3001, and SC2292
This commit is contained in:
parent
888775f1c5
commit
a74d2bb5c9
3 changed files with 15 additions and 15 deletions
|
|
@ -6,7 +6,7 @@ errors_terminate=$2
|
|||
# Therefore $1 ($default_python) is not needed and is invoked with "" by default.
|
||||
# $default_python stays in the arguments for backward compatibility and $extra for the following check:
|
||||
extra=$3
|
||||
if [ 0$extra -eq 1 ]; then
|
||||
if [[ 0"$extra" -eq 1 ]]; then
|
||||
echo -e "%_python_bytecompile_extra is discontinued, use %py_byte_compile instead.\nSee: https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_3" >/dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -14,7 +14,7 @@ fi
|
|||
compileall_flags="$4"
|
||||
|
||||
# If using normal root, avoid changing anything.
|
||||
if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
|
||||
if [[ -z "$RPM_BUILD_ROOT" ]] || [[ "$RPM_BUILD_ROOT" = "/" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
@ -45,14 +45,14 @@ function python_bytecompile()
|
|||
#
|
||||
# Python 3.4 and higher
|
||||
#
|
||||
if [ "$python_version" -ge 34 ]; then
|
||||
if [[ "$python_version" -ge 34 ]]; then
|
||||
|
||||
# We compile all opt levels in one go: only when $options is empty.
|
||||
if [ -n "$options" ]; then
|
||||
if [[ -n "$options" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$python_version" -ge 39 ]; then
|
||||
if [[ "$python_version" -ge 39 ]]; then
|
||||
# For Pyhon 3.9+, use the standard library
|
||||
compileall_module=compileall
|
||||
else
|
||||
|
|
@ -60,7 +60,7 @@ function python_bytecompile()
|
|||
compileall_module=compileall2
|
||||
fi
|
||||
|
||||
if [ "$python_version" -ge 37 ]; then
|
||||
if [[ "$python_version" -ge 37 ]]; then
|
||||
# Force the TIMESTAMP invalidation mode
|
||||
invalidation_option=--invalidation-mode=timestamp
|
||||
else
|
||||
|
|
@ -69,7 +69,7 @@ function python_bytecompile()
|
|||
invalidation_option=
|
||||
fi
|
||||
|
||||
[ ! -z $exclude ] && exclude="-x '$exclude'"
|
||||
[[ -n "$exclude" ]] && exclude="-x '$exclude'"
|
||||
|
||||
# PYTHONPATH is needed for compileall2, but doesn't hurt for the stdlib
|
||||
# -o 0 -o 1 are the optimization levels
|
||||
|
|
@ -137,12 +137,12 @@ do
|
|||
|
||||
# Generate normal (.pyc) byte-compiled files.
|
||||
python_clamp_source_mtime "" "$python_binary" "" "$python_libdir" ""
|
||||
if [ $? -ne 0 ] && [ 0$errors_terminate -ne 0 ]; then
|
||||
if [[ $? -ne 0 ]] && [[ 0"$errors_terminate" -ne 0 ]]; then
|
||||
# One or more of the files had inaccessible mtime
|
||||
exit 1
|
||||
fi
|
||||
python_bytecompile "" "$python_binary" "" "$python_libdir" "$compileall_flags"
|
||||
if [ $? -ne 0 ] && [ 0$errors_terminate -ne 0 ]; then
|
||||
if [[ $? -ne 0 ]] && [[ 0"$errors_terminate" -ne 0 ]]; then
|
||||
# One or more of the files had a syntax error
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -150,7 +150,7 @@ do
|
|||
# Generate optimized (.pyo) byte-compiled files.
|
||||
# N.B. For Python 3.4+, this call does nothing
|
||||
python_bytecompile "-O" "$python_binary" "" "$python_libdir" "$compileall_flags"
|
||||
if [ $? -ne 0 ] && [ 0$errors_terminate -ne 0 ]; then
|
||||
if [[ $? -ne 0 ]] && [[ 0"$errors_terminate" -ne 0 ]]; then
|
||||
# One or more of the files had a syntax error
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue