conda / constructor

tool for creating installers from conda packages
https://conda.github.io/constructor/
Other
457 stars 168 forks source link

Fix `channels_remap` handling in `extra_envs` configuration #808

Closed jaimergp closed 3 months ago

jaimergp commented 3 months ago

Description

An oversight in the strip logic does not handle channel_remaps correctly (it assumed list of str, but we have list of dict[str, str] there).

This input file:

...
extra_envs:
  napari-0.5.0a2.dev751+g3b0612ec:
    channels:
    - https://github.com/napari/pins/releases/download/napari-v0.5
    channels_remap:  # THIS IS THE PROBLEM
    - src: https://github.com/napari/pins/releases/download/napari-v0.5
      dest: napari-v0.5.0a2.dev751+g3b0612ec
    specs:
    - python=3.9.*=*_cpython
    - napari=0.5.0a2.dev751+g3b0612ec
    - napari-menu=0.5.0a2.dev751+g3b0612ec
    - napari-plugin-manager
    - pyside2=*
    - conda
    - mamba
    - pip
    menu_packages:
    - napari-menu
...

results in the following error:

Traceback (most recent call last):
  File "/home/runner/micromamba/envs/build-bundle/bin/constructor", line 10, in <module>
    sys.exit(main())
  File "/home/runner/micromamba/envs/build-bundle/lib/python3.9/site-packages/constructor/main.py", line 424, in main
    main_build(dir_path, output_dir=out_dir, platform=args.platform,
  File "/home/runner/micromamba/envs/build-bundle/lib/python3.9/site-packages/constructor/main.py", line 153, in main_build
    env_config[config_key] = [val.strip() for val in value]
  File "/home/runner/micromamba/envs/build-bundle/lib/python3.9/site-packages/constructor/main.py", line 153, in <listcomp>
    env_config[config_key] = [val.strip() for val in value]
AttributeError: 'CommentedMap' object has no attribute 'strip'

Checklist - did you ...