Add logging
This commit is contained in:
parent
36df29ba71
commit
e39e1c7205
2 changed files with 10 additions and 4 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
|
import logging
|
||||||
from utils import *
|
from utils import *
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
_py2capi_fmtmap = {
|
_py2capi_fmtmap = {
|
||||||
str: 's#',
|
str: 's#',
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
import sys
|
import sys, logging
|
||||||
from binding import *
|
from binding import *
|
||||||
from utils import *
|
from utils import *
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
extension_entry = '''
|
extension_entry = '''
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -143,7 +146,6 @@ class Context(object):
|
||||||
println2('return capsule.wrap(ret)')
|
println2('return capsule.wrap(ret)')
|
||||||
println('')
|
println('')
|
||||||
|
|
||||||
|
|
||||||
def add_module(self, module):
|
def add_module(self, module):
|
||||||
allsyms = [(k, v) for k, v in vars(module).items()
|
allsyms = [(k, v) for k, v in vars(module).items()
|
||||||
if isinstance(v, Binding)]
|
if isinstance(v, Binding)]
|
||||||
|
|
@ -159,6 +161,7 @@ class Context(object):
|
||||||
def println_to_def(s):
|
def println_to_def(s):
|
||||||
buf.write(s)
|
buf.write(s)
|
||||||
buf.write('\n')
|
buf.write('\n')
|
||||||
|
logger.info('compiling %s', k)
|
||||||
v.compile(k, println_to_def)
|
v.compile(k, println_to_def)
|
||||||
self.definitions.append(buf.getvalue())
|
self.definitions.append(buf.getvalue())
|
||||||
buf.close()
|
buf.close()
|
||||||
|
|
@ -200,11 +203,11 @@ if __name__ == '__main__':
|
||||||
outputfilename = sys.argv[1]
|
outputfilename = sys.argv[1]
|
||||||
srcdir = sys.argv[2]
|
srcdir = sys.argv[2]
|
||||||
modnames = sys.argv[3:]
|
modnames = sys.argv[3:]
|
||||||
|
|
||||||
modules = []
|
modules = []
|
||||||
for m in modnames:
|
for m in modnames:
|
||||||
path = '%s.%s' % (srcdir, m)
|
path = '%s.%s' % (srcdir, m)
|
||||||
print path
|
logger.info("import module %s", path)
|
||||||
module = __import__(path)
|
module = __import__(path)
|
||||||
for token in path.split('.')[1:]:
|
for token in path.split('.')[1:]:
|
||||||
module = getattr(module, token)
|
module = getattr(module, token)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue