History

python/lib/gen_external.py: clean-up

Paul Brossier committed 10 years ago

Commit 41fc24f1 parent 67f00921 file · +17 −9Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/lib/gen_external.py+17−9
@@ -119,11 +119,8 @@ def get_cpp_objects(header=header): · 118 unmodified lines
119119
120120 return cpp_output, cpp_objects
121121
122−def generate_external(header=header, output_path=output_path, usedouble=False, overwrite=True):
123− if not os.path.isdir(output_path): os.mkdir(output_path)
124− elif not overwrite: return glob.glob(os.path.join(output_path, '*.c'))
125− sources_list = []
126− cpp_output, cpp_objects = get_cpp_objects(header)
122+
123+def analyze_cpp_output(cpp_objects, cpp_output):
127124 lib = {}
128125
129126 for o in cpp_objects:
@@ -153,8 +150,9 @@ def generate_external(header=header, output_path=output_path, usedouble=False, o · 23 unmodified lines
153150 else:
154151 #print "no idea what to do about", fn
155152 lib[shortname]['other'].append(fn)
153+ return lib
156154
157− """
155+def print_cpp_output_results(lib, cpp_output):
158156 for fn in cpp_output:
159157 found = 0
160158 for o in lib:
@@ -162,7 +160,7 @@ def generate_external(header=header, output_path=output_path, usedouble=False, o · 1 unmodified line
162160 if fn in lib[o][family]:
163161 found = 1
164162 if found == 0:
165− print "missing", fn
163+ print ("missing", fn)
166164
167165 for o in lib:
168166 for family in lib[o]:
@@ -171,9 +169,19 @@ def generate_external(header=header, output_path=output_path, usedouble=False, o · 2 unmodified lines
171169 elif len(lib[o][family]) == 1:
172170 print ( "{:15s} {:10s} {:s}".format(o, family, lib[o][family][0] ) )
173171 else:
174− print ( "{:15s} {:10s} {:d}".format(o, family, len(lib[o][family]) ) )
175− """
172+ print ( "{:15s} {:10s} {:s}".format(o, family, lib[o][family] ) )
173+
176174
175+def generate_external(header=header, output_path=output_path, usedouble=False, overwrite=True):
176+ if not os.path.isdir(output_path): os.mkdir(output_path)
177+ elif not overwrite: return glob.glob(os.path.join(output_path, '*.c'))
178+
179+ cpp_output, cpp_objects = get_cpp_objects(header)
180+
181+ lib = analyze_cpp_output(cpp_objects, cpp_output)
182+ # print_cpp_output_results(lib, cpp_output)
183+
184+ sources_list = []
177185 try:
178186 from .gen_code import MappedObject
179187 except (SystemError, ValueError):

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t