Open beckermr opened 12 hours ago
The issue is the - in the first line. The following fails:
from conda_forge_tick.recipe_parser._parser import CondaMetaYAML
meta1 = """
{% set version = "7.0.0" -%}
{% set python_min = python_min | default("3.11") -%}
"""
CondaMetaYAML(meta1)
with:
Traceback (most recent call last):
File "/home/tom/tmp/reproduce.py", line 8, in <module>
CondaMetaYAML(meta1)
File "/home/tom/tmp/cf-scripts/conda_forge_tick/recipe_parser/_parser.py", line 551, in __init__
v, e = _parse_jinja2_variables(meta_yaml)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tom/tmp/cf-scripts/conda_forge_tick/recipe_parser/_parser.py", line 110, in _parse_jinja2_variables
and _line_is_only_selector(all_nodes[i + 1].nodes[0].data.strip())
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Assign' object has no attribute 'nodes'. Did you mean: 'node'?
The following works:
from conda_forge_tick.recipe_parser._parser import CondaMetaYAML
meta1 = """
{% set version = "7.0.0" %}
{% set python_min = python_min | default("3.11") -%}
"""
CondaMetaYAML(meta1)
Interestingly this works:
from conda_forge_tick.recipe_parser._parser import CondaMetaYAML
meta1 = """
{% set version = "7.0.0" -%}
package:
name: astropy-base
version: {{ version }}
{% set python_min = python_min | default("3.11") -%}
"""
CondaMetaYAML(meta1)
(including the -)
The -
removes newlines and so I suspect shifting elements onto the same line is the issue. TBH there is no reason to include the dashes at all for a single line set
statement and the fix to the parser here is probably just to remove those before parsing.
This recipe has caused a parsing failure: