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
119 119
120 return cpp_output, cpp_objects120 return cpp_output, cpp_objects
121 121
122def generate_external(header=header, output_path=output_path, usedouble=False, overwrite=True):122
123 if not os.path.isdir(output_path): os.mkdir(output_path)123def analyze_cpp_output(cpp_objects, cpp_output):
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)
127 lib = {}124 lib = {}
128 125
129 for o in cpp_objects:126 for o in cpp_objects:
@@ -153,8 +150,9 @@ def generate_external(header=header, output_path=output_path, usedouble=False, o · 23 unmodified lines
153 else:150 else:
154 #print "no idea what to do about", fn151 #print "no idea what to do about", fn
155 lib[shortname]['other'].append(fn)152 lib[shortname]['other'].append(fn)
153 return lib
156 154
157 """155def print_cpp_output_results(lib, cpp_output):
158 for fn in cpp_output:156 for fn in cpp_output:
159 found = 0157 found = 0
160 for o in lib:158 for o in lib:
@@ -162,7 +160,7 @@ def generate_external(header=header, output_path=output_path, usedouble=False, o · 1 unmodified line
162 if fn in lib[o][family]:160 if fn in lib[o][family]:
163 found = 1161 found = 1
164 if found == 0:162 if found == 0:
165 print "missing", fn163 print ("missing", fn)
166 164
167 for o in lib:165 for o in lib:
168 for family in lib[o]:166 for family in lib[o]:
@@ -171,9 +169,19 @@ def generate_external(header=header, output_path=output_path, usedouble=False, o · 2 unmodified lines
171 elif len(lib[o][family]) == 1:169 elif len(lib[o][family]) == 1:
172 print ( "{:15s} {:10s} {:s}".format(o, family, lib[o][family][0] ) )170 print ( "{:15s} {:10s} {:s}".format(o, family, lib[o][family][0] ) )
173 else:171 else:
174 print ( "{:15s} {:10s} {:d}".format(o, family, len(lib[o][family]) ) )172 print ( "{:15s} {:10s} {:s}".format(o, family, lib[o][family] ) )
175 """173
176 174
175def 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 = []
177 try:185 try:
178 from .gen_code import MappedObject186 from .gen_code import MappedObject
179 except (SystemError, ValueError):187 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