Use #!/usr/bin/env for python scripts

This is recommended for upstream, but not for downstream, like Fedora.
So change /usr/bin/env to /usr/bin/python2 at RPM install time to
match the ideal Fedora config.

https://fedoraproject.org/wiki/Features/SystemPythonExecutablesUseSystemPython
https://bugzilla.redhat.com/show_bug.cgi?id=1303282
This commit is contained in:
Cole Robinson 2016-06-17 12:56:14 -04:00
parent 246e3c9c59
commit 47dd38eb3e
7 changed files with 14 additions and 6 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 -tt
#!/usr/bin/env python2 -tt
# Copyright (C) 2013, 2014 Red Hat, Inc.
import atexit

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 -tt
#!/usr/bin/env python2 -tt
#
# Copyright(c) FUJITSU Limited 2007.
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 -tt
#!/usr/bin/env python2 -tt
#
# Copyright 2008, 2013, 2014 Red Hat, Inc.
# Joey Boggs <jboggs@redhat.com>

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 -tt
#!/usr/bin/env python2 -tt
#
# Copyright 2005-2014 Red Hat, Inc.
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 -tt
#!/usr/bin/env python2 -tt
#
# Copyright (C) 2006, 2014 Red Hat, Inc.
# Copyright (C) 2006 Daniel P. Berrange <berrange@redhat.com>

View File

@ -106,6 +106,7 @@ machine).
%prep
%setup -q
%build
%if %{qemu_user}
%global _qemu_user --qemu-user=%{qemu_user}
@ -151,6 +152,13 @@ python setup.py \
install -O1 --root=%{buildroot}
%find_lang %{name}
# Replace '#!/usr/bin/env python2' with '#!/usr/bin/python2'
# The format is ideal for upstream, but not a distro. See:
# https://fedoraproject.org/wiki/Features/SystemPythonExecutablesUseSystemPython
for f in $(find %{buildroot} -type f -executable -print); do
sed -i "1 s|^#!/usr/bin/env python2|#!%{__python2}|" $f || :
done
# The conversion script was only added to virt-manager after several
# Fedora cycles of using gsettings. Installing it now could convert old data
# and wipe out recent settings.

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2 -tt
#!/usr/bin/env python2 -tt
#
# Copyright 2013-2014 Red Hat, Inc.
# Cole Robinson <crobinso@redhat.com>