mamba-org / conda-specs

A collection of specs, and spec proposals for Mamba packages, recipes and repositories
3 stars 3 forks source link

Proposal for meta.yaml selectors #4

Open mariusvniekerk opened 4 years ago

mariusvniekerk commented 4 years ago

In the proposed new meta.yaml specification (circa 2020-07) selectors are currently handled with the following construct

- sel(condition): entry

which supercedes the legacy form

- entry  # [condition]

This is a somewhat atypical (but valid) construction as it causes keys to contain punctuation and would potentially force these keys to be quoted in the case of complex conditions.

Inspired by some of the other yaml centric config systems like ansible, I propose the following system

 - select: entry
   when: condition

This also opens up the concept of potentially specifying requirements as a full matchspec.

For example if we want to link to the non-gpl version of libreadline (actually libedit) we could specify the following

 - req: libreadline
   version: ">=7"
   channel: conda-forge
   license_family: bsd
   # may as well support the conditional here
   when: condition
Alternative stylings

Full python style: rather than modelled on ansible we could basically just do something python-like ```yaml - select: - if: condition value: a - elif: condition value: b - else: value ``` This has the advantage of nearly dealing with something like ``` - rust =1 # [win or osx] - rust >=1 # [linux] ```