Return current C API checksum and the recorded checksum. Return current C API checksum and the recorded checksum for the given version of the C API version.
(apiversion, codegen_dir)
| 61 | |
| 62 | |
| 63 | def get_api_versions(apiversion, codegen_dir): |
| 64 | """ |
| 65 | Return current C API checksum and the recorded checksum. |
| 66 | |
| 67 | Return current C API checksum and the recorded checksum for the given |
| 68 | version of the C API version. |
| 69 | |
| 70 | """ |
| 71 | # Compute the hash of the current API as defined in the .txt files in |
| 72 | # code_generators |
| 73 | sys.path.insert(0, codegen_dir) |
| 74 | try: |
| 75 | m = __import__('genapi') |
| 76 | numpy_api = __import__('numpy_api') |
| 77 | curapi_hash = m.fullapi_hash(numpy_api.full_api) |
| 78 | apis_hash = m.get_versions_hash() |
| 79 | finally: |
| 80 | del sys.path[0] |
| 81 | |
| 82 | return curapi_hash, apis_hash[apiversion] |
| 83 | |
| 84 | def check_api_version(apiversion, codegen_dir): |
| 85 | """Emits a MismatchCAPIWarning if the C API version needs updating.""" |