On Thu, Jun 09, 2011 at 10:04:22AM -0700, Jason Helfman wrote:
On Thu, Jun 09, 2011 at 03:12:42PM +0200, Jiri Denemark thus spake:
>On Thu, Jun 09, 2011 at 20:55:01 +0800, Daniel Veillard wrote:
>>> > another way would be to launch python directly giving the path to
the
>>> > python script, this is likely to solve the issue there.
>>
>> That IMHO avoids the problem completely and I doubt anybody would
>>complain
>
>I agree, and we already use that in one place in python/Makefile.am:
>
> $(PYTHON) $(srcdir)/$(GENERATE) $(PYTHON)
>
>>we should even be able to detect at configure and take specific
>>paths if people want to use a non-system python binary by extending
>>
>>paphio:~/libvirt -> ./configure --help | grep python
>> --with-python Build python bindings [default=yes]
>>
>> to take a path
>
>No extension needed, it already supports that (although it's not advertised
>anywhere). One can use the following forms
>
> --with-python
> --with-python=/usr/local
> --with-python=/usr/local/bin/python
> PYTHON=/usr/local/bin/python --with-python
>
>Jirka
>
Sounds good to me. How would the python script in question support this?
(1) Rename the original script so it is called 'foo.in' (for each
original script called 'foo')
(2) At the top of 'foo.in' place the following two lines:
#!@PYTHON@
# @configure_input@
(3) In configure.ac, you have to make two changes:
(a) in AC_CONFIG_FILES, add an entry for 'foo'
(b) add a new line AC_SUBST([PYTHON]) after the current
line AC_SUBST([PYTHON_INCLUDES])
(4) Run 'autoconf'.
./configure will then generate 'foo' from 'foo.in', replacing all
@...@ sequences, so for example the first line above would be replaced
with #!/usr/local/bin/python.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top