Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failure to build cython package #53

Open
christian-rauch opened this issue Aug 25, 2022 · 1 comment
Open

failure to build cython package #53

christian-rauch opened this issue Aug 25, 2022 · 1 comment

Comments

@christian-rauch
Copy link

I am trying to build a cython package with version 0.2.7. This fails with invalid syntax:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/package_identification/__init__.py", line 142, in _identify
    retval = extension.identify(_reused_descriptor_instance)
  File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 48, in identify
    config = get_setup_information(setup_py)
  File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 241, in get_setup_information
    _setup_information_cache[hashable_env] = _get_setup_information(
  File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 286, in _get_setup_information
    return ast.literal_eval(output)
  File "/usr/lib/python3.8/ast.py", line 59, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib/python3.8/ast.py", line 47, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    Compiling <PACKAGE> because it changed.
              ^
SyntaxError: invalid syntax

I can trace this down to stdout output in Cython https://github.com/cython/cython/blob/3424926e9c8f03061b55516d2516a9f98999399e/Cython/Build/Dependencies.py#L1074.

colcon-python-setup-py takes this stdout output and tries to evaluate it:

# invoke distutils.core.run_setup() in a separate interpreter
cmd = [
sys.executable, '-c', ';'.join(line.lstrip() for line in code_lines)]
result = subprocess.run(
cmd, stdout=subprocess.PIPE,
cwd=os.path.abspath(str(setup_py.parent)), check=True, env=env)
output = result.stdout.decode('utf-8')
return ast.literal_eval(output)

@christian-rauch
Copy link
Author

A workaround for this is to check for the --dry-run flag in the args and set the quiet flag in cythonize to suppress stdout and stderr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant