aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/dbufstat/Makefile.am
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2019-01-06 10:41:16 -0800
committerBrian Behlendorf <[email protected]>2019-01-06 10:54:12 -0800
commitc87db591967507de027d6bb0c683ffd09dd70105 (patch)
treee308115e563c7011194dc55d4f3bd65c0ec664b1 /cmd/dbufstat/Makefile.am
parent0b8e4418b615eb6e46d409b3de61bfffe1000c68 (diff)
parentdffce3c282f74991e740c1e1887001fe059fe05a (diff)
Python 2 and 3 compatibility
With Python 2 (slowly) approaching EOL and its removal from distribitions already being planned (Fedora), the existing Python 2 code needs to be transitioned to Python 3. This patch stack updates the Python code to be compatible with Python 2.7, 3.4, 3.5, 3.6, and 3.7. Reviewed-by: John Ramsden <[email protected]> Reviewed-by: Neal Gompa <[email protected]> Reviewed-by: loli10K <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Wren Kennedy <[email protected]> Reviewed-by: Antonio Russo <[email protected]> Closes #8096
Diffstat (limited to 'cmd/dbufstat/Makefile.am')
-rw-r--r--cmd/dbufstat/Makefile.am14
1 files changed, 13 insertions, 1 deletions
diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am
index 19bffb020..968a76077 100644
--- a/cmd/dbufstat/Makefile.am
+++ b/cmd/dbufstat/Makefile.am
@@ -1 +1,13 @@
-dist_bin_SCRIPTS = dbufstat.py
+dist_bin_SCRIPTS = dbufstat
+
+#
+# The dbufstat script is compatibile with both Python 2.6 and 3.4.
+# As such the python 3 shebang can be replaced at install time when
+# targeting a python 2 system. This allows us to maintain a single
+# version of the source.
+#
+if USING_PYTHON_2
+install-exec-hook:
+ sed --in-place 's|^#!/usr/bin/python3|#!/usr/bin/python2|' \
+ $(DESTDIR)$(bindir)/dbufstat
+endif