-
Notifications
You must be signed in to change notification settings - Fork 30
add recipe extension cep #72
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
9f45b38
138b910
e46d8a9
3809c58
ea7aa7d
a1b32a5
e2ba466
f501df2
3619ae2
575fd78
7a9c87b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Extensions to the recipe spec | ||
|
|
||
| This document describes extensions to the recipe specification as merged in cep-14. | ||
|
|
||
| ## The `build.post_process` section | ||
|
|
||
| We became aware that the `conda_build_config.yaml` has ways to specify post-processing steps. These are regex replacements that are performed on any new files. | ||
|
|
||
| Instead of adding these instructions to the `conda_build_config.yaml`, we decided to add a new section to the recipe spec: `build.post_process`. This section is a list of dictionaries, each with the following keys: | ||
|
|
||
| - `files`: globs to select files to process | ||
| - `regex`: the regex to apply | ||
| - `replacement`: the replacement string | ||
|
|
||
| The regex specification follows Rust `regex` syntax. Most notably, the replacement string can refer to capture groups with `$1`, `$2`, etc. | ||
| This also means that replacement strings need to escape `$` with `$$`. | ||
|
|
||
| Internally, we use `replace_all` from the `regex` crate. This means that the regex is applied to the entire file, not line by line. | ||
|
|
||
| ### Example | ||
|
|
||
| ```yaml | ||
| build: | ||
| post_process: | ||
| - files: | ||
| - "*.txt" | ||
| regex: "foo" | ||
| replacement: "bar" | ||
| - files: | ||
| - "*.cmake" | ||
| regex: "/sysroot/" | ||
| replacement: "$${PREFIX}/" | ||
| ``` | ||
|
|
||
| ## Globs, positive and negative | ||
|
||
|
|
||
| Following some community discussion we would like to extend the recipe format in such a way that anywhere where a list of globs is accepted, we alternatively accept a dictionary with `include` and `exclude` keys. The values of these keys are lists of globs that are included or excluded respectively. | ||
|
|
||
| For example: | ||
|
|
||
| ```yaml | ||
| files: | ||
| include: | ||
| - "*.txt" | ||
| exclude: | ||
| - "foo.txt" | ||
| ``` | ||
|
|
||
| The evaluation would go as follows: | ||
|
|
||
| - first record all matches for the `include` globs | ||
| - then remove all matches for the `exclude` globs | ||
|
|
||
| In conda-build, this is discussed here: [Link to PR 5216](https://github.com/conda/conda-build/pull/5216) | ||
Uh oh!
There was an error while loading. Please reload this page.