conda-build icon indicating copy to clipboard operation
conda-build copied to clipboard

[WIP] Regex replacements and source/no_hoist

Open rrigdon opened this issue 5 years ago • 3 comments

rrigdon avatar Nov 20 '19 17:11 rrigdon

We often need to, after building a recipe but before packaging it, replace some strings in some (usually) generate files. On linux and macOS we often find the build prefix or the sysroot getting baked into files which causes problems because those folders are temporary. Instead, in general, we want to replace those with a token or an environment variable.

It is possible to add keys to your conda_build_config.yaml (variants stuff) called replacements/all_replacements which is a list of replacement instructions for conda-build to perform during its post build phase. Here is an example:

https://github.com/conda/conda-build/blob/496808082439fc4337e8f71b73d1ae83752b6910/tests/test-recipes/variants/31_variant_subkeys/conda_build_config.yaml#L1-L20

mingwandroid avatar Nov 20 '19 17:11 mingwandroid

regex_re is in PCRE2 format and is strictly as tight or tighter matching that regex_rg (rg==ripgrep). regex_rg is optional. If only regex_re is provided then it must be compatible with both PCRE2 and ripgrep regex formats. If your regex is not compatible with both then you must design a simpler, possibly looser one for regex_rg.

tag is informational, conda-build will print this out.

replacement_re is a PRCE2 regex and can contain references to groups mentioned in regex_re to allow more complex substitutions (example not given).

glob_patterns is a list of glob wildcards to consider for this prefix replacement.

mingwandroid avatar Nov 20 '19 18:11 mingwandroid

This is waiting to be merged until future release of conda-build.

rrigdon avatar Dec 16 '19 17:12 rrigdon

Hi there, thank you for your contribution!

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this pull request to remain open please:

  1. Rebase and verify the changes still work
  2. Leave a comment with the current status

NOTE: If this pull request was closed prematurely, please leave a comment.

Thanks!

github-actions[bot] avatar Jul 27 '23 04:07 github-actions[bot]