| 205 | |
| 206 | |
| 207 | def check_cython_version(): |
| 208 | print("[build.py] Check Cython version") |
| 209 | with open(os.path.join(TOOLS_DIR, "requirements.txt"), "rb") as fileobj: |
| 210 | contents = fileobj.read().decode("utf-8") |
| 211 | match = re.search(r"cython\s*==\s*([\d.]+)", contents, |
| 212 | flags=re.IGNORECASE) |
| 213 | assert match, "cython package not found in requirements.txt" |
| 214 | require_version = match.group(1) |
| 215 | try: |
| 216 | import Cython |
| 217 | version = Cython.__version__ |
| 218 | except ImportError: |
| 219 | # noinspection PyUnusedLocal |
| 220 | Cython = None |
| 221 | print("[build.py] ERROR: Cython is not installed ({0} required)" |
| 222 | .format(require_version)) |
| 223 | sys.exit(1) |
| 224 | if version != require_version: |
| 225 | print("[build.py] ERROR: Wrong Cython version: {0}. Required: {1}" |
| 226 | .format(version, require_version)) |
| 227 | sys.exit(1) |
| 228 | print("[build.py] Cython version: {0}".format(version)) |
| 229 | |
| 230 | |
| 231 | def check_directories(): |