buildtools/wafsamba: re-write shebang for delivered python scripts
authorNoel Power <noel.power@suse.com>
Wed, 12 Dec 2018 20:30:32 +0000 (20:30 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 13 Dec 2018 23:51:33 +0000 (00:51 +0100)
commitbae5364bf39f863d25e3c7caac59c6af28b4f441
tree20e2b3191729858b1357c3c810693d37c86ba920
parent0756b59f810ee9d4bf9b6d5eac02d8951751ff79
buildtools/wafsamba: re-write shebang for delivered python scripts

Can't see how the orig code would have worked though
a)
  task.env["PYTHON"] is a list
b) task.env["PYTHON_SPECIFIED"] can (and is in our case false) looks
   like it would only be true for python2 but in anycase no harm we
   always rewrite the shebang

So now it works as follows,

1. PYTHON (which is where the shebang is got) is set to python3 by default
2. To override the default you need to set PYTHON (e.g. to build with python2)
3. If you give a full path in PYTHON then shebang is of the format
   "#!{FULL_PYTHON_INTERPRETER_PATH)
4. If you specify PYTHON=python or PYTHON=python2 etc. shebang format is
   "#!!/usr/bin/env python", "#!!/usr/bin/env python2" etc.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
buildtools/wafsamba/samba_python.py
buildtools/wafsamba/wafsamba.py