Skip to content

Commit f668421

Browse files
committed
add progress info
1 parent 67bd008 commit f668421

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

generate

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ class Class(object):
6161
class Module(object):
6262

6363
def __init__(self, name):
64+
print('Looking for module "{name}":'.format(name=name))
6465
self.module = importlib.import_module(name)
66+
print('Found {mod}'.format(mod=self.module))
6567
self.year = datetime.datetime.now().year
6668
self.name = name
6769
self.NAME = name.upper()
@@ -82,6 +84,7 @@ class Module(object):
8284
if isinstance(b, types.FunctionType): # method
8385
c.add_method(m, inspect.getargspec(b))
8486
self.classes.append(c)
87+
print('Parsed OK ... loaded {f} functions and {c} classes with {m} methods'.format(f=len(self.functions), c=len(self.classes), m=sum([ len(c.methods) for c in self.classes ])))
8588

8689

8790
class Source(object):
@@ -97,8 +100,10 @@ class Source(object):
97100
self.lines.append(line.format(**kwargs))
98101

99102
def save(self):
100-
with open('mod{module}.c'.format(module=self.module.name), 'w') as f:
103+
fn = 'mod{module}.c'.format(module=self.module.name)
104+
with open(fn, 'w') as f:
101105
f.write('\n'.join(self.lines))
106+
print('Saved as {fn}'.format(fn=fn))
102107

103108

104109
def generate_function(src, f):
@@ -171,6 +176,7 @@ def generate_class(src, c):
171176

172177
def generate(module):
173178

179+
print('Generating source code:')
174180
src = Source(module)
175181

176182
for f in module.functions:
@@ -199,6 +205,8 @@ def generate(module):
199205
src.append(' .globals = (mp_obj_dict_t*)&mp_module_{module}_globals,')
200206
src.append('}};')
201207

208+
209+
print('Done')
202210
src.save()
203211

204212

0 commit comments

Comments
 (0)