Skip to content

Commit

Permalink
Add cdt_arch and cdt_name as used variables (#5599)
Browse files Browse the repository at this point in the history
* Add cdt_arch and cdt_name as used variables

* add news

* Update news/5599-cdt-used-vars.rst

* Update news/5599-cdt-used-vars.rst

---------

Co-authored-by: Matthew R. Becker <[email protected]>
Co-authored-by: Jannis Leidel <[email protected]>
  • Loading branch information
3 people authored Jan 24, 2025
1 parent 8df6493 commit f24c228
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions conda_build/variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,11 @@ def find_used_variables_in_text(variant, recipe_text, selectors_only=False):
variant_lines = [
line for line in recipe_lines if v in line or target_lang in line
]
elif v.startswith("cdt_"):
variant_lines = [
line for line in recipe_lines if v in line or "cdt(" in line
]
all_res.append(r"\{{\s*cdt\(")
else:
variant_lines = [
line for line in recipe_lines if v in line.replace("-", "_")
Expand Down
19 changes: 19 additions & 0 deletions news/5599-cdt-used-vars.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Add `cdt_arch` and `cdt_name` as used vars when cdt jinja is used. (#5599)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ pthread_stubs:
some_package:
- mooo
- llama
cdt_name:
- cos6
cdt_arch:
- baz
# not directly used, but is "used" by virtue of being zipped
zipped_var:
- chicken
Expand Down
2 changes: 2 additions & 0 deletions tests/test-recipes/variants/19_used_variables/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ requirements:
- zlib
# an implicit usage containing a dash
- pthread-stubs
# cdts
- {{ cdt('foo') }} # [linux]
run:
# python is only "used" if it's used in build and run - see above
- python
2 changes: 2 additions & 0 deletions tests/test_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ def test_get_used_loop_vars():
"zlib",
"pthread_stubs",
"target_platform",
"cdt_name",
"cdt_arch",
}


Expand Down

0 comments on commit f24c228

Please sign in to comment.