(root_dir)
| 165 | |
| 166 | |
| 167 | def find_process_files(root_dir): |
| 168 | hash_db = load_hashes(HASH_FILE) |
| 169 | files = [x for x in os.listdir(root_dir) if not os.path.isdir(x)] |
| 170 | # .pxi or .pxi.in files are most likely dependencies for |
| 171 | # .pyx files, so we need to process them first |
| 172 | files.sort(key=lambda name: (name.endswith('.pxi') or |
| 173 | name.endswith('.pxi.in') or |
| 174 | name.endswith('.pxd.in')), |
| 175 | reverse=True) |
| 176 | |
| 177 | for filename in files: |
| 178 | in_file = os.path.join(root_dir, filename + ".in") |
| 179 | for fromext, value in rules.items(): |
| 180 | if filename.endswith(fromext): |
| 181 | if not value: |
| 182 | break |
| 183 | function, toext = value |
| 184 | if toext == '.c': |
| 185 | with open(os.path.join(root_dir, filename), 'rb') as f: |
| 186 | data = f.read() |
| 187 | m = re.search(br"^\s*#\s*distutils:\s*language\s*=\s*c\+\+\s*$", data, re.I|re.M) |
| 188 | if m: |
| 189 | toext = ".cxx" |
| 190 | fromfile = filename |
| 191 | tofile = filename[:-len(fromext)] + toext |
| 192 | process(root_dir, fromfile, tofile, function, hash_db) |
| 193 | save_hashes(hash_db, HASH_FILE) |
| 194 | break |
| 195 | |
| 196 | def main(): |
| 197 | try: |
no test coverage detected