[apparmor] [patch] utils: stop rewriting shbang lines in setup script

John Johansen john.johansen at canonical.com
Thu Oct 26 06:46:56 UTC 2017


On 10/25/2017 11:05 PM, Steve Beattie wrote:
> utils: stop rewriting shbang lines in setup script
> 
> The python setup tools script is set to rewrite the shbang line of
> scripts installed in ${PREFIX}/bin/ if the PYTHON environment variable
> is set. Unfortunately, this (a) only covers the aa-easyprof script
> as the rest are installed in ${PREFIX}/sbin/, and (b) we've deprecated
> python 2 support, and hardcoded python3 as the interpreter for all of
> the python scripts in the utils/ directory.
> 
> The only use for this feature would be if for some reason the utils did
> not work properly with the default python3 interpreter and a specific
> version was needed to be set, but I don't think that warrants keeping
> the extra bit of code complexity around (and indeed, the snippet that
> does this is forcibly disabled in Debian/Ubuntu).
> 
> Therefore, drop the shbang rewriting entirely.
> 
> Signed-off-by: Steve Beattie <steve at nxnw.org>
Acked-by: John Johansen <john.johansen at canonical.com>

> ---
>  utils/python-tools-setup.py |    9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> Index: b/utils/python-tools-setup.py
> ===================================================================
> --- a/utils/python-tools-setup.py
> +++ b/utils/python-tools-setup.py
> @@ -41,14 +41,7 @@ class Install(_install, object):
>          self.mkpath(prefix + os.path.dirname(scripts[0]))
>          for s in scripts:
>              f = prefix + s
> -            # If we have a defined python version, use it instead of the system
> -            # default
> -            if 'PYTHON' in os.environ:
> -                lines = open(os.path.basename(s)).readlines()
> -                lines[0] = '#! /usr/bin/env %s\n' % os.environ['PYTHON']
> -                open(f, 'w').write("".join(lines))
> -            else:
> -                self.copy_file(os.path.basename(s), f)
> +            self.copy_file(os.path.basename(s), f)
>  
>          configs = ['easyprof/easyprof.conf']
>          self.mkpath(prefix + "/etc/apparmor")
> 
> 
> 




More information about the AppArmor mailing list