skvadrik / re2c

Lexer generator for C, C++, Go and Rust.

Home Page:https://re2c.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Insufficient version-check for python (run_tests.py failures)

dmacks opened this issue · comments

Building re2c-3.0 on OS X 10.13, I have "python" in my PATH (v2.7) and no "python3" in my path. Using the autotools build system:

checking for python3... no
checking for python... python

which results in run_tests.py generated with a first line of:

#!/usr/bin/env python

That leads to a test failure, with test-suite.log:

FAIL: run_tests.py
==================

  File "./run_tests.py", line 48
    re2c: str = ''
        ^
SyntaxError: invalid syntax
FAIL run_tests.py (exit status: 1)

That syntax is only valid starting around python3.6. But even if I use python3.6, run_tests.py fails:

Traceback (most recent call last):
  File "run_tests.py", line 15, in <module>
    from dataclasses import dataclass
ModuleNotFoundError: No module named 'dataclasses'

That module is only available starting with python3.7. So the build system needs to check that the python it finds is >= 3.7.

The cmake build system is similarly broken, looking for python3 but not specifically >= 3.7.

Hi, thanks for reporting. Here is a fix: ce8501e for both build systems.