]> xenbits.xensource.com Git - libvirt.git/commitdiff
Use python discovered through env instead of hardcoding a path
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 13 Nov 2010 15:34:57 +0000 (16:34 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Sun, 14 Nov 2010 21:45:59 +0000 (22:45 +0100)
This is more flexible regarding the location of the python binary
but doesn't allow to pass the -u flag. The -i flag can be passed
from inside the script using the PYTHONINSPECT env variable.

This fixes a problem with the esx_vi_generator.py on FreeBSD.

examples/python/dominfo.py
examples/python/domrestore.py
examples/python/domsave.py
examples/python/domstart.py
examples/python/esxlist.py
python/generator.py
python/libvirt-override.py
src/esx/esx_vi_generator.py

index e41709c51984900995c2f04c7fdedc7e11ed68e2..2f250e73830ea6e3a76a675e58e8f230c75e618f 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
 # dominfo - print some information about a domain
 
 import libvirt
index b0321388d9863d041229e1b63960cb11990cf9f4..ccc82f633c5e5527082938dfe16c8e9b3a793d3a 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
 # domstart - make sure a given domU is running, if not start it
 
 import libvirt
index 35e2c8a54307eace47be23a493beac0ff208158a..12ffac191d0c4814ec802c917bc3e45612e88a9c 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
 # domstart - make sure a given domU is running, if not start it
 
 import libvirt
index 52fb79e8406bc21a5caa006d7113e3def99dcc44..b1e89b8e4306dea9e8ba29e3e184dc4806038246 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
 # domstart - make sure a given domU is running, if not start it
 
 import libvirt
index a0602e89250d8b3371071b0cc31a311ac80b2847..c55424fe1b2ce9a7c9c69e7e603afde4a078c465 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
 # esxlist - list active domains of an ESX host and print some info.
 #           also demonstrates how to use the libvirt.openAuth() method
 
index 68009b947e74720de9b5f8b7412c575db29da035..15751bd16c358166a57c14aa1a03ecfbbb861dff 100755 (executable)
@@ -1010,7 +1010,7 @@ def buildWrappers():
     classes = open("libvirt.py", "w")
 
     extra = open(os.path.join(srcPref,"libvirt-override.py"), "r")
-    classes.write("#!/usr/bin/python -i\n")
+    classes.write("#!/usr/bin/env python\n")
     classes.write("#\n")
     classes.write("# WARNING WARNING WARNING WARNING\n")
     classes.write("#\n")
index d544a0e64d19cc8b3c27eea2e14f52c5e0705957..909ebe349a7181f0a8cbd582952005f96a29631c 100644 (file)
@@ -2,6 +2,11 @@
 # Manually written part of python bindings for libvirt
 #
 
+# Specify -i commandline option after python was started
+if __name__ == "__main__":
+    import os
+    os.environ["PYTHONINSPECT"] = "1"
+
 # On cygwin, the DLL is called cygvirtmod.dll
 try:
     import libvirtmod
index 01636aa6f1f743ffe49b0a0053133888e2a4a1da..459337975b13591db32fa6cc63cbae95ad6aee7f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 
 #
 # esx_vi_generator.py: generates most of the SOAP type mapping code