| 463 | |
| 464 | |
| 465 | def compile_time_constants(): |
| 466 | print("[cython_setup.py] Generate compile_time_constants.pxi") |
| 467 | with open(os.path.join(SRC_DIR, "compile_time_constants.pxi"), "wb") as fo: |
| 468 | contents = "# This file was generated by setup.py\n" |
| 469 | # A way around Python 3.2 bug: UNAME_SYSNAME is not set |
| 470 | contents += 'DEF UNAME_SYSNAME = "%s"\n' % platform.uname()[0] |
| 471 | contents += 'DEF PY_MAJOR_VERSION = %s\n' % sys.version_info.major |
| 472 | contents += 'cdef extern from "limits.h":\n' |
| 473 | contents += ' cdef int INT_MIN\n' |
| 474 | contents += ' cdef int INT_MAX\n' |
| 475 | fo.write(contents.encode("utf-8")) |
| 476 | |
| 477 | |
| 478 | if __name__ == "__main__": |