Re: [PATCH] Add virConnectGetHostname and virConnectGetURI calls, virsh commands, and some related fixes

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

 



Daniel Veillard wrote:
On Tue, Jun 26, 2007 at 11:09:21AM +0100, Richard W.M. Jones wrote:
I haven't updated the Python bindings, but will do so next.

  it's probable that those 2 calles will be handled automatically
since the arg is a known structure and the return value is a string.
It's a matter of rebuilding the API xml with the new headers once applied
and let the generator do its job.

Rather obscurely, docs/apibuild.py was having trouble parsing remote_internal.c, which was causing the API XML files not to build, which was causing the Python API not to build correctly either. Attached patch corrects that, corrects a bug in python/Makefile.am (libvirt.py not being rebuilt), and rearranges python/Makefile.am to make it a bit easier to understand.

So now it does build Python bindings for getHostname and getURI.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
Index: src/remote_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/remote_internal.c,v
retrieving revision 1.8
diff -u -p -r1.8 remote_internal.c
--- src/remote_internal.c	26 Jun 2007 11:42:46 -0000	1.8
+++ src/remote_internal.c	26 Jun 2007 12:17:15 -0000
@@ -104,15 +104,6 @@ static void query_free (struct query_fie
 static int initialise_gnutls (virConnectPtr conn);
 static gnutls_session_t negotiate_gnutls_on_connection (virConnectPtr conn, int sock, int no_verify, const char *hostname);
 
-/* Supported transports. */
-enum transport {
-    trans_tls,
-    trans_unix,
-    trans_ssh,
-    trans_ext,
-    trans_tcp,
-};
-
 static int
 remoteOpen (virConnectPtr conn, const char *uri_str, int flags)
 {
@@ -131,7 +122,14 @@ remoteOpen (virConnectPtr conn, const ch
         return VIR_DRV_OPEN_DECLINED; /* Decline - not a remote URL. */
 
     /* What transport? */
-    enum transport transport;
+    enum {
+        trans_tls,
+        trans_unix,
+        trans_ssh,
+        trans_ext,
+        trans_tcp,
+    } transport;
+
     if (!transport_str || strcasecmp (transport_str, "tls") == 0)
         transport = trans_tls;
     else if (strcasecmp (transport_str, "unix") == 0)
Index: python/Makefile.am
===================================================================
RCS file: /data/cvs/libvirt/python/Makefile.am,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile.am
--- python/Makefile.am	6 Mar 2007 21:55:44 -0000	1.8
+++ python/Makefile.am	26 Jun 2007 12:17:15 -0000
@@ -37,35 +37,31 @@ libvirtmod_la_LIBADD = $(mylibs)
 # Python header files contain a redundant decl, hence:
 libvirtmod_la_CFLAGS = -Wno-redundant-decls
 
-libvirt.py: $(srcdir)/libvir.py libvirtclass.py
-	cat $(srcdir)/libvir.py libvirtclass.py > libvirt.py
-
-install-data-local:
-	$(mkinstalldirs) $(DESTDIR)$(pythondir)
-	@INSTALL@ -m 0644 libvirt.py $(DESTDIR)$(pythondir)
-	$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
-	@(for doc in $(DOCS) ; \
-	   do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
-
 GENERATE = generator.py
 API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-python-api.xml
-GENERATED= libvirt.py \
-           libvirt-export.c \
+GENERATED= libvirt-export.c \
            libvirtclass.txt \
 	   libvirt-py.c \
 	   libvirt-py.h \
 	   libvirtclass.py
 
-CLEANFILES= $(GENERATED) gen_prog libvirt.py
-
-$(GENERATED): gen_prog
-
-gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
+$(GENERATED): $(srcdir)/$(GENERATE) $(API_DESC)
 	$(PYTHON) $(srcdir)/$(GENERATE) $(srcdir)
-	touch gen_prog
+
+libvirt.py: $(srcdir)/libvir.py libvirtclass.py
+	cat $(srcdir)/libvir.py libvirtclass.py > libvirt.py
 
 $(libvirtmod_la_OBJECTS): $(GENERATED)
 
+install-data-local:
+	$(mkinstalldirs) $(DESTDIR)$(pythondir)
+	@INSTALL@ -m 0644 libvirt.py $(DESTDIR)$(pythondir)
+	$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
+	@(for doc in $(DOCS) ; \
+	   do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
+
+CLEANFILES= $(GENERATED) libvirt.py
+
 else
 all: 
 endif

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]