summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2016-06-17 12:56:14 -0400
committerCole Robinson <crobinso@redhat.com>2016-06-17 12:56:14 -0400
commit47dd38eb3eb604b72687afec7463c7303caac133 (patch)
treef6ee1dce2f34d5f099ff16bb8be1f154f9e90831
parent246e3c9c591ffc54ce5591aa93cc178c060d8af9 (diff)
downloadvirt-manager-47dd38eb3eb604b72687afec7463c7303caac133.tar.gz
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
-rwxr-xr-xtests/test_inject.py2
-rwxr-xr-xvirt-clone2
-rwxr-xr-xvirt-convert2
-rwxr-xr-xvirt-install2
-rwxr-xr-xvirt-manager2
-rw-r--r--virt-manager.spec.in8
-rwxr-xr-xvirt-xml2
7 files changed, 14 insertions, 6 deletions
diff --git a/tests/test_inject.py b/tests/test_inject.py
index 508a8240..3b1848ac 100755
--- a/tests/test_inject.py
+++ b/tests/test_inject.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2 -tt
+#!/usr/bin/env python2 -tt
# Copyright (C) 2013, 2014 Red Hat, Inc.
import atexit
diff --git a/virt-clone b/virt-clone
index 176509d9..e0b35465 100755
--- a/virt-clone
+++ b/virt-clone
@@ -1,4 +1,4 @@
-#!/usr/bin/python2 -tt
+#!/usr/bin/env python2 -tt
#
# Copyright(c) FUJITSU Limited 2007.
#
diff --git a/virt-convert b/virt-convert
index 04371678..5a28b504 100755
--- a/virt-convert
+++ b/virt-convert
@@ -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>
diff --git a/virt-install b/virt-install
index b48f2108..43f6cd3f 100755
--- a/virt-install
+++ b/virt-install
@@ -1,4 +1,4 @@
-#!/usr/bin/python2 -tt
+#!/usr/bin/env python2 -tt
#
# Copyright 2005-2014 Red Hat, Inc.
#
diff --git a/virt-manager b/virt-manager
index 9f5b6ffb..a4cf99f1 100755
--- a/virt-manager
+++ b/virt-manager
@@ -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>
diff --git a/virt-manager.spec.in b/virt-manager.spec.in
index 0788edb8..8c4a811a 100644
--- a/virt-manager.spec.in
+++ b/virt-manager.spec.in
@@ -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.
diff --git a/virt-xml b/virt-xml
index 74762ab7..8fa95196 100755
--- a/virt-xml
+++ b/virt-xml
@@ -1,4 +1,4 @@
-#!/usr/bin/python2 -tt
+#!/usr/bin/env python2 -tt
#
# Copyright 2013-2014 Red Hat, Inc.
# Cole Robinson <crobinso@redhat.com>