Browse Source

[1273] workaround for the hidden old python classes problem

Jelte Jansen 13 years ago
parent
commit
39e529c506
2 changed files with 12 additions and 4 deletions
  1. 2 3
      src/lib/python/isc/datasrc/Makefile.am
  2. 10 1
      src/lib/python/isc/datasrc/__init__.py

+ 2 - 3
src/lib/python/isc/datasrc/Makefile.am

@@ -1,17 +1,16 @@
 SUBDIRS = . tests
 
 # old data, should be removed in the near future once conversion is done
+pythondir = $(pyexecdir)/isc/datasrc
 python_PYTHON = __init__.py master.py sqlite3_ds.py
 
-#pythondir = $(pyexecdir)/isc/pydatasrc
 
 # new data
 
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += $(SQLITE_CFLAGS)
 
-pythondir = $(pyexecdir)/isc
-pyexec_LTLIBRARIES = datasrc.la
+python_LTLIBRARIES = datasrc.la
 datasrc_la_SOURCES = datasrc.cc datasrc.h
 datasrc_la_SOURCES += client_python.cc client_python.h
 datasrc_la_SOURCES += iterator_python.cc iterator_python.h

+ 10 - 1
src/lib/python/isc/datasrc/__init__.py

@@ -1,12 +1,21 @@
 import sys
 import os
 
+# this setup is a temporary workaround to deal with the problem of
+# having both 'normal' python modules and a wrapper module
+# Once all programs use the new interface, we should remove the
+# old, and the setup can be made similar to that of the log wrappers.
+intree = False
 for base in sys.path[:]:
     datasrc_libdir = os.path.join(base, 'isc/datasrc/.libs')
     if os.path.exists(datasrc_libdir):
         sys.path.insert(0, datasrc_libdir)
+        intree = True
 
-from datasrc import *
+if intree:
+    from datasrc import *
+else:
+    from isc.datasrc.datasrc import *
 from isc.datasrc.sqlite3_ds import *
 from isc.datasrc.master import *