[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] python: Use hardcoded python path in libvirt.py

On 03/11/2011 05:55 AM, Jiri Denemark wrote:
> This partially reverts (and fixes that part in a different way) commit
> e4384459c93e3e786aa483c7f077d1d22148f689, which replaced all
> examples or scripts used during build to generate other files.
> However, python bindings module is compiled and linked against a
> specific python discovered or explicitly provided in configure phase.

Yeah, I agree that build-time programs and examples should be flexible,
but installed python code should be configured.

> Thus libvirt.py which is generated and installed into the system we
> should use the same python binary for which the module has been built.
> The hunk in Makefile.am replaces $(srcdir) with $(PYTHON), which might
> seem wrong but it is not. generator.py didn't use any of its command
> line arguments so passing $(srcdir) to it was redundant.

Thanks for that comment, otherwise I was really confused.

> @@ -1012,7 +1017,7 @@ def buildWrappers():
>      classes = open("libvirt.py", "w")
>      extra = open(os.path.join(srcPref,"libvirt-override.py"), "r")
> -    classes.write("#!/usr/bin/env python\n")
> +    classes.write("#! " + python + " -i\n")

Is the addition of -i intentional?

>      classes.write("#\n")
>      classes.write("# WARNING WARNING WARNING WARNING\n")
>      classes.write("#\n")
> diff --git a/python/libvirt-override.py b/python/libvirt-override.py
> index 909ebe3..d544a0e 100644
> --- a/python/libvirt-override.py
> +++ b/python/libvirt-override.py
> @@ -2,11 +2,6 @@
>  # 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"

Ah, so it is - now that we don't have /usr/bin/env stealing argv[0], we
can go back to the simpler provision of -i via argv[1] (it's a shame
that she-bang parsing is so limited).


Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]