diff options
author | Peter Johnson <peter@tortall.net> | 2012-08-30 23:34:49 -0700 |
---|---|---|
committer | Peter Johnson <peter@tortall.net> | 2012-08-30 23:36:39 -0700 |
commit | 85f4120b6aa485a4a611a06adce8835e95bcb163 (patch) | |
tree | 8482fc26cde8c3b2a15daa085d640ac9d52f2eed | |
parent | 96edd8aa0e86611091aff4d6ec11f35d7f8cc7c1 (diff) | |
download | yasm-85f4120b6aa485a4a611a06adce8835e95bcb163.tar.gz |
Improve check for Cython version.
[#249 state:resolved]
-rw-r--r-- | m4/cython.m4 | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/m4/cython.m4 b/m4/cython.m4 index ba6b3cab..e56bfba0 100644 --- a/m4/cython.m4 +++ b/m4/cython.m4 @@ -2,13 +2,14 @@ dnl a macro to check for the installed Cython version; note PYTHON needs to dnl be set before this function is called. dnl CYTHON_CHECK_VERSION([MIN-VERSION], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) AC_DEFUN([CYTHON_CHECK_VERSION], - [prog="import sys + [prog="import re, sys from Cython.Compiler.Version import version def get_int(arg): - try: - return int(arg) - except ValueError: + matched = re.match(r'\d+', arg) + if matched is None: return 0 + else: + return int(matched.group(0)) # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. ver = map(get_int, version.rstrip('abcdefghijklmnopqrstuvwxyz').split('.')) + [[0, 0, 0]] |