From 38be2da9bec9311c268d48c385cafa6049f67434 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 13 Sep 2015 13:45:32 +0100 Subject: [PATCH] python: Set program name to the true name instead of 'python'. As in commit e102bcf3cfcbcb2b47ad88334f03d5abf636f1e5 (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]). --- generator/python.ml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/generator/python.ml b/generator/python.ml index c1128f832..1e043fc33 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -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)