Skip to content

Commit

Permalink
Remove/avoid redundant function calls
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Bargull <[email protected]>
  • Loading branch information
mbargull committed Mar 21, 2024
1 parent d5b12f0 commit fda44cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,6 @@ def build_id(self):
raise RuntimeError(
f"Couldn't extract raw recipe text for {self.name()} output"
)
raw_recipe_text = self.extract_package_and_build_text()
raw_manual_build_string = re.search(r"\s*string:", raw_recipe_text)
# user setting their own build string. Don't modify it.
if manual_build_string and not (
Expand Down Expand Up @@ -2640,12 +2639,13 @@ def get_loop_vars(self):
return variants.get_vars(_variants, loop_only=True)

def get_used_loop_vars(self, force_top_level=False, force_global=False):
loop_vars = set(self.get_loop_vars())
return {
var
for var in self.get_used_vars(
force_top_level=force_top_level, force_global=force_global
)
if var in self.get_loop_vars()
if var in loop_vars
}

def get_rendered_recipe_text(
Expand Down
7 changes: 4 additions & 3 deletions conda_build/variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,16 @@ def get_package_variants(recipedir_or_metadata, config=None, variants=None):
def get_vars(variants, loop_only=False):
"""For purposes of naming/identifying, provide a way of identifying which variables contribute
to the matrix dimensionality"""
first_variant, *other_variants = variants
special_keys = {"pin_run_as_build", "zip_keys", "ignore_version"}
special_keys.update(set(ensure_list(variants[0].get("extend_keys"))))
special_keys.update(set(ensure_list(first_variant.get("extend_keys"))))
loop_vars = [
k
for k in variants[0]
for k, v in first_variant.items()
if k not in special_keys
and (
not loop_only
or any(variant[k] != variants[0][k] for variant in variants[1:])
or any(variant[k] != v for variant in other_variants)
)
]
return loop_vars
Expand Down

0 comments on commit fda44cd

Please sign in to comment.