Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

import sys 

import os 

 

# The datasource factory loader uses dlopen, as does python 

# for its modules. Some dynamic linkers do not play nice if  

# modules are not loaded with RTLD_GLOBAL, a symptom of which 

# is that exceptions are not recognized by type. So to make 

# sure this doesn't happen, we temporarily set RTLD_GLOBAL 

# during the loading of the datasource wrappers. 

import ctypes 

flags = sys.getdlopenflags() 

sys.setdlopenflags(flags | ctypes.RTLD_GLOBAL) 

 

# 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 

 

28if intree: 

    from datasrc import * 

else: 

    from isc.datasrc.datasrc import * 

 

# revert to the default dlopen flags 

sys.setdlopenflags(flags) 

 

from isc.datasrc.sqlite3_ds import * 

from isc.datasrc.master import *