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

Fails to identify package that specifies python_requires. #33

Open
rotu opened this issue Apr 22, 2020 · 1 comment
Open

Fails to identify package that specifies python_requires. #33

rotu opened this issue Apr 22, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@rotu
Copy link
Contributor

rotu commented Apr 22, 2020

If you use a package that specifies a python version, colcon_setup_py chokes. This is because we assume that repr and ast.literal_eval are inverse operations. This is not guaranteed, and in fact not true for SpecifierSet:

$ colcon info --packages-select tox
/usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'use_scm_version'
  warnings.warn(msg)
[1.315s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'python_setup_py' in 'src/tox': invalid syntax (<unknown>, line 1)
Traceback (most recent call last):
  File "/home/dan/Documents/rostools/src/colcon-core/colcon_core/package_identification/__init__.py", line 143, in _identify
    retval = extension.identify(_reused_descriptor_instance)
  File "/home/dan/Documents/rostools/src/colcon-python-setup-py/colcon_python_setup_py/package_identification/python_setup_py.py", line 47, in identify
    config = get_setup_information(setup_py)
  File "/home/dan/Documents/rostools/src/colcon-python-setup-py/colcon_python_setup_py/package_identification/python_setup_py.py", line 267, in get_setup_information
    _setup_information_cache[hashable_env] = _get_setup_information(
  File "/home/dan/Documents/rostools/src/colcon-python-setup-py/colcon_python_setup_py/package_identification/python_setup_py.py", line 309, 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
    {'package_data': {}, 

...

 'python_requires': <SpecifierSet('!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7')>}}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ^
SyntaxError: invalid syntax

[1.860s] WARNING:colcon.colcon_core.package_selection:ignoring unknown package 'tox' in --packages-select
@XYudong
Copy link

XYudong commented Nov 11, 2020

Hi, I got similar error as "ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'python_setup_py' in 'my_package': invalid syntax (, line 1)". Do you have any clue to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants