conda / conda-build

Commands and tools for building conda packages
https://docs.conda.io/projects/conda-build/
Other
379 stars 420 forks source link

Building with variants in conda_build_config.yaml fails with packages with "-" in their name #5477

Open agrossfield opened 1 week ago

agrossfield commented 1 week ago

Checklist

What happened?

Hi,

I support a package that compiles against boost, and I'm trying to support multiple versions of the library. To specify both boost and libboost-devel at the same versions, I'm using the zip_keys functionality.

My conda_build_config.yaml looks like:

boost:
  - 1.84
  - 1.85
  - 1.86
libboost: 
  - 1.84
  - 1.85
  - 1.86
libboost-devel: 
  - 1.84
  - 1.85
  - 1.86
zip_keys:
  - boost
  - libboost
  - libboost-devel
pin_run_as_build:
  boost: x.x

When conda-forge runs the tests on the pull request, everything works fine on linux, but on OSX I get the following error:

 conda-build ./recipe -m ./.ci_support/osx_64_python3.11.____cpython.yaml --suppress-variables --clobber-file ./.ci_support/clobber_osx_64_python3.11.____cpython.yaml --extra-meta flow_run_id=azure_20240904.5.1 remote_url=*** sha=c545751cf7a124951e3a868a578a8c41b811e0d1
WARNING: No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.26
Traceback (most recent call last):
  File "/Users/runner/miniforge3/bin/conda-build", line 11, in <module>
    sys.exit(execute())
             ^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/cli/main_build.py", line 589, in execute
    api.build(
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/api.py", line 209, in build
    return build_tree(
           ^^^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/build.py", line 3686, in build_tree
    metadata_tuples = render_recipe(
                      ^^^^^^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/render.py", line 990, in render_recipe
    variants = get_package_variants(m, variants=variants)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/variants.py", line 697, in get_package_variants
    combined_spec, specs = get_package_combined_spec(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/variants.py", line 661, in get_package_combined_spec
    validate_spec(f, spec)
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/variants.py", line 200, in validate_spec
    raise ValueError(
ValueError: Variant configuration errors in /Users/runner/work/1/s/conda_build_config.yaml:
  libboost-devel key contains an invalid character '-'

Basically, if you try to zipper on a package that has a "-" in the name, it fails, but only on OS X. This seems like a bug.

I'm going to try to work around it, but I thought you'd want to know.

Thanks,

Alan

Conda Info

irrelevant, the bug occurs in the conda-forge azure testing pipeline

Conda Config

irrelevant, the bug occurs in the conda-forge azure testing pipeline

Conda list

irrelevant, the bug occurs in the conda-forge azure testing pipeline

Additional Context

No response

agrossfield commented 1 week ago

Follow-up: The bug isn't specific to using zip_keys. The following conda_build_config.yaml also triggers the same error:

libboost-devel: 
  - 1.84
  - 1.85
  - 1.86
pin_run_as_build:
  libboost-boost: x.x

The error is:


+ [[ -f LICENSE.txt ]]
+ cp LICENSE.txt recipe/recipe-scripts-license.txt
+ [[ 0 == 1 ]]
+ conda-build ./recipe -m ./.ci_support/osx_64_python3.9.____cpython.yaml --suppress-variables --clobber-file ./.ci_support/clobber_osx_64_python3.9.____cpython.yaml --extra-meta flow_run_id=azure_20240904.6.1 remote_url=*** sha=36b62a3eb44c1dc16bb4a1eb696ec95cd9888797
WARNING: No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.26
Traceback (most recent call last):
  File "/Users/runner/miniforge3/bin/conda-build", line 11, in <module>
    sys.exit(execute())
             ^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/cli/main_build.py", line 589, in execute
    api.build(
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/api.py", line 209, in build
    return build_tree(
           ^^^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/build.py", line 3686, in build_tree
    metadata_tuples = render_recipe(
                      ^^^^^^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/render.py", line 990, in render_recipe
    variants = get_package_variants(m, variants=variants)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/variants.py", line 697, in get_package_variants
    combined_spec, specs = get_package_combined_spec(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/variants.py", line 661, in get_package_combined_spec
    validate_spec(f, spec)
  File "/Users/runner/miniforge3/lib/python3.12/site-packages/conda_build/variants.py", line 200, in validate_spec
    raise ValueError(
ValueError: Variant configuration errors in /Users/runner/work/1/s/conda_build_config.yaml:
  libboost-devel key contains an invalid character '-'
agrossfield commented 6 days ago

One more detail I forgot to mention: This bug occurs in every OS X version that conda-forge tries to build with, so it happens with python 3.8. 3.10, 3.11, and 3.12. The same python versions are fine under linux.