]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
cosmetics: py-compile consistently use test, not [ ... ]; indentation.
authorKarl Berry <karl@freefriends.org>
Tue, 27 Jul 2021 01:03:53 +0000 (18:03 -0700)
committerKarl Berry <karl@freefriends.org>
Tue, 27 Jul 2021 01:03:53 +0000 (18:03 -0700)
* lib/py-compile: consistently use test rather than [ ... ];
use consistent sh indentation; check exit status consistently.

lib/py-compile

index c45a77de24e67241b2f7a60011f6f059453261db..81b122b0a546ca34b2e6bad824ea2fd2d2bb5610 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # py-compile - Compile a Python program
 
-scriptversion=2020-02-19.23; # UTC
+scriptversion=2021-02-27.01; # UTC
 
 # Copyright (C) 2000-2021 Free Software Foundation, Inc.
 
@@ -27,7 +27,7 @@ scriptversion=2020-02-19.23; # UTC
 # bugs to <bug-automake@gnu.org> or send patches to
 # <automake-patches@gnu.org>.
 
-if [ -z "$PYTHON" ]; then
+if test -z "$PYTHON"; then
   PYTHON=python
 fi
 
@@ -96,23 +96,23 @@ done
 
 files=$*
 if test -z "$files"; then
-    usage_error "no files given"
+  usage_error "no files given"
 fi
 
 # if basedir was given, then it should be prepended to filenames before
 # byte compilation.
-if [ -z "$basedir" ]; then
-    pathtrans="path = file"
+if test -z "$basedir"; then
+  pathtrans="path = file"
 else
-    pathtrans="path = os.path.join('$basedir', file)"
+  pathtrans="path = os.path.join('$basedir', file)"
 fi
 
 # if destdir was given, then it needs to be prepended to the filename to
 # byte compile but not go into the compiled file.
-if [ -z "$destdir" ]; then
-    filetrans="filepath = path"
+if test -z "$destdir"; then
+  filetrans="filepath = path"
 else
-    filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)"
+  filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)"
 fi
 
 python_major=`$PYTHON -V 2>&1 | sed -e 's/.* //;s/\..*$//;1q'`
@@ -176,7 +176,7 @@ for file in files.split():
         py_compile.compile(filepath, $import_call(filepath$import_arg2), path)
     else:
         py_compile.compile(filepath, filepath + 'o', path)
-sys.stdout.write('\n')" 2>/dev/null || :
+sys.stdout.write('\n')" 2>/dev/null || exit $?
 
 # Local Variables:
 # mode: shell-script