Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -119,11 +119,8 @@ def get_cpp_objects(header=header): · 118 unmodified lines | ||
| 119 | 119 | |
| 120 | 120 | return cpp_output, cpp_objects |
| 121 | 121 | |
| 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): | |
| 127 | 124 | lib = {} |
| 128 | 125 | |
| 129 | 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 | 150 | else: |
| 154 | 151 | #print "no idea what to do about", fn |
| 155 | 152 | lib[shortname]['other'].append(fn) |
| 153 | + return lib | |
| 156 | 154 | |
| 157 | − """ | |
| 155 | +def print_cpp_output_results(lib, cpp_output): | |
| 158 | 156 | for fn in cpp_output: |
| 159 | 157 | found = 0 |
| 160 | 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 | 160 | if fn in lib[o][family]: |
| 163 | 161 | found = 1 |
| 164 | 162 | if found == 0: |
| 165 | − print "missing", fn | |
| 163 | + print ("missing", fn) | |
| 166 | 164 | |
| 167 | 165 | for o in lib: |
| 168 | 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 | 169 | elif len(lib[o][family]) == 1: |
| 172 | 170 | print ( "{:15s} {:10s} {:s}".format(o, family, lib[o][family][0] ) ) |
| 173 | 171 | 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 | + | |
| 176 | 174 | |
| 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 = [] | |
| 177 | 185 | try: |
| 178 | 186 | from .gen_code import MappedObject |
| 179 | 187 | except (SystemError, ValueError): |