aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRyan Moeller <ryan@freqlabs.com>2019-09-12 20:32:32 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2019-09-12 20:32:32 +0000
commit4f342e45be19d0bb8e32f38664dc29a12092dfe9 (patch)
tree685ca60e63c7b977750249f326143cf305699203 /tests
parentb01a6574aebbf50504db2c1b28de5a9d288be1a5 (diff)
Canonicalize Python shebangs
/usr/bin/env python3 is the suggested[1] shebang for Python in general (likewise for python2) and is conventional across platforms. This eases development on systems where python is not installed in /usr/bin (FreeBSD for example) and makes it possible to develop in virtual environments (venv) for isolating dependencies. Many packaging guidelines discourage the use of /usr/bin/env, but since this is the canonical way of writing shebangs in the Python community, many packaging scripts are already equipped to handle substituting the appropriate absolute path to python automatically. Some RPM package builders lacking brp-mangle-shebangs need a small fallback mechanism in the package spec to stamp the appropriate shebang on installed Python scripts. [1]: https://docs.python.org/3/using/unix.html?#miscellaneous Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: George Melikov <mail@gmelikov.ru> Signed-off-by: Ryan Moeller <ryan@ixsystems.com> Closes #9314
Diffstat (limited to 'tests')
-rw-r--r--tests/test-runner/bin/Makefile.am2
-rwxr-xr-xtests/test-runner/bin/test-runner.py2
-rwxr-xr-xtests/test-runner/bin/zts-report.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/tests/test-runner/bin/Makefile.am b/tests/test-runner/bin/Makefile.am
index e1ae21548e98..2c031f745503 100644
--- a/tests/test-runner/bin/Makefile.am
+++ b/tests/test-runner/bin/Makefile.am
@@ -9,7 +9,7 @@ dist_pkgdata_SCRIPTS = \
#
if USING_PYTHON_2
install-data-hook:
- sed --in-place 's|^#!/usr/bin/python3|#!/usr/bin/python2|' \
+ sed --in-place 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
$(DESTDIR)$(pkgdatadir)/test-runner.py \
$(DESTDIR)$(pkgdatadir)/zts-report.py
endif
diff --git a/tests/test-runner/bin/test-runner.py b/tests/test-runner/bin/test-runner.py
index bf2c77c18a93..ca08b3754115 100755
--- a/tests/test-runner/bin/test-runner.py
+++ b/tests/test-runner/bin/test-runner.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
#
# This file and its contents are supplied under the terms of the
diff --git a/tests/test-runner/bin/zts-report.py b/tests/test-runner/bin/zts-report.py
index b6f3cf22ca1e..65233c41b938 100755
--- a/tests/test-runner/bin/zts-report.py
+++ b/tests/test-runner/bin/zts-report.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
#
# This file and its contents are supplied under the terms of the