summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2007-11-30 11:10:53 +0000
committerRichard W.M. Jones <rjones@redhat.com>2007-11-30 11:10:53 +0000
commit06fa1bfed5aef8d52ee94d09ffc541e0f8d37704 (patch)
treebf24b69ef6611b74996df6c00d223d3f64f7d763
parentb4cd1d2dd90974f3c10751dbbae5067a4eaced89 (diff)
downloadlibvirt-python-v6-06fa1bfed5aef8d52ee94d09ffc541e0f8d37704.tar.gz
libvirt-python-v6-06fa1bfed5aef8d52ee94d09ffc541e0f8d37704.tar.xz
libvirt-python-v6-06fa1bfed5aef8d52ee94d09ffc541e0f8d37704.zip
Fri Nov 30 11:04:00 GMT 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvir.py: Make Python aware that the C bindings module is called cygvirtmod.dll when compiled by CYGWIN. * python/Makefile.am: Remove symlink libvirtmod.dll -> cygvirtmod.dll no longer necessary because of the above. * configure.in: Remove AM_CONDITIONAL(CYGWIN).
-rw-r--r--Makefile.am7
-rw-r--r--libvir.c19
-rw-r--r--libvir.py8
3 files changed, 24 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am
index d021567..5880811 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -63,13 +63,6 @@ install-data-local:
@(for doc in $(DOCS) ; \
do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
-if CYGWIN
-install-data-hook:
- cd $(DESTDIR)$(pythondir) && \
- rm -f libvirtmod.dll && \
- ln -s cygvirtmod.dll libvirtmod.dll
-endif
-
uninstall-local:
rm -f $(DESTDIR)$(pythondir)/libvirt.py
diff --git a/libvir.c b/libvir.c
index 0621eb2..9969c80 100644
--- a/libvir.c
+++ b/libvir.c
@@ -15,7 +15,11 @@
#include "libvirt_wrap.h"
#include "libvirt-py.h"
+#ifndef __CYGWIN__
extern void initlibvirtmod(void);
+#else
+extern void initcygvirtmod(void);
+#endif
PyObject *libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
PyObject *libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
@@ -752,7 +756,12 @@ static PyMethodDef libvirtMethods[] = {
};
void
-initlibvirtmod(void)
+#ifndef __CYGWIN__
+initlibvirtmod
+#else
+initcygvirtmod
+#endif
+ (void)
{
static int initialized = 0;
@@ -762,7 +771,13 @@ initlibvirtmod(void)
virInitialize();
/* intialize the python extension module */
- Py_InitModule((char *) "libvirtmod", libvirtMethods);
+ Py_InitModule((char *)
+#ifndef __CYGWIN__
+ "libvirtmod"
+#else
+ "cygvirtmod"
+#endif
+ , libvirtMethods);
initialized = 1;
}
diff --git a/libvir.py b/libvir.py
index e108b3a..70ceebc 100644
--- a/libvir.py
+++ b/libvir.py
@@ -4,7 +4,13 @@
# Check python/generator.py in the source distribution of libvir
# to find out more about the generation process
#
-import libvirtmod
+
+# On cygwin, the DLL is called cygvirtmod.dll
+try:
+ import libvirtmod
+except:
+ import cygvirtmod as libvirtmod
+
import types
# The root of all libvirt errors.