skvadrik / re2c

Lexer generator for C, C++, Go and Rust.
https://re2c.org
Other
1.07k stars 169 forks source link

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

Closed dmacks closed 1 year ago

dmacks commented 2 years ago

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.

skvadrik commented 2 years ago

Hi, thanks for reporting. Here is a fix: https://github.com/skvadrik/re2c/commit/ce8501e27bbbdf25e926b810b36d4236face27be for both build systems.