Mercurial > hgrepos > Python > libs > ConfigMix
comparison setup.py @ 546:adf65c31f8fc
Automatically select the proper API when building the speedup C-extension:
Build the C-extension for Python 3.5+ and build against the stable API
for Python 3.7+.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 01 Jan 2022 21:03:05 +0100 |
| parents | 6501fe0e116c |
| children | 059260191371 |
comparison
equal
deleted
inserted
replaced
| 545:6501fe0e116c | 546:adf65c31f8fc |
|---|---|
| 51 # | 51 # |
| 52 # Handle the optinal C-extension for Python3.7+ and CPython only. | 52 # Handle the optinal C-extension for Python3.7+ and CPython only. |
| 53 # PyPy does not need this. | 53 # PyPy does not need this. |
| 54 # | 54 # |
| 55 | 55 |
| 56 # The C-extension uses multi-phase module initialization (PEP 489, PY 3.5+) | |
| 56 if (platform.python_implementation() == "CPython" | 57 if (platform.python_implementation() == "CPython" |
| 57 and (sys.version_info[0] > 3 | 58 and (sys.version_info[0] > 3 |
| 58 or (sys.version_info[0] == 3 and sys.version_info[1] >= 7))): | 59 or (sys.version_info[0] == 3 and sys.version_info[1] >= 5))): |
| 59 | 60 |
| 60 py_limited_api = True | 61 # The stable API for Python 3.7+ is used |
| 62 if sys.version_info[0] == 3 and sys.version_info[1] < 7: | |
| 63 py_limited_api = False | |
| 64 else: | |
| 65 py_limited_api = True | |
| 61 | 66 |
| 62 if py_limited_api: | 67 if py_limited_api: |
| 63 define_macros = [("Py_LIMITED_API", "0x03070000")] | 68 define_macros = [("Py_LIMITED_API", "0x03070000")] |
| 64 else: | 69 else: |
| 65 define_macros = [] | 70 define_macros = [] |
