python: Set program name to the true name instead of 'python'.

As in commit e102bcf3cf (for Perl), any
Python program has the handle program name field set to 'python'.  Set
it to the true name (derived from sys.argv[0]).
This commit is contained in:
Richard W.M. Jones
2015-09-13 13:45:32 +01:00
parent bb7d088eda
commit 38be2da9be

View File

@@ -671,6 +671,8 @@ logvols = g.lvs ()
\"\"\"
import os
import sys
import libguestfsmod
";
@@ -714,6 +716,10 @@ class GuestFS(object):
self._o = libguestfsmod.create (flags)
self._python_return_dict = python_return_dict
# If we don't do this, the program name is always set to 'python'.
program = os.path.basename (sys.argv[0])
libguestfsmod.set_program (self._o, program)
def __del__ (self):
if self._o:
libguestfsmod.close (self._o)