Skip to content

Commit

Permalink
address pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah committed Dec 19, 2024
1 parent 0b6b877 commit 1f6b41c
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions ci/rust_ci_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ def predicate(package):

def find_flavored_crates(*, workspace_crates):
def predicate(package):
tmp = package.get("metadata") or {}
tmp = tmp.get("orb") or {}
flavors = tmp.get("flavors") or {}
if flavors == {}:
flavors = package.get("metadata", {}).get("orb", {}).get("flavors", {})
if not flavors:
return False
if not isinstance(flavors, list):
raise ValueError("`flavors` must be a list")
Expand All @@ -75,12 +73,12 @@ def predicate(package):

def find_unsupported_platform_crates(*, host_platform, workspace_crates):
def predicate(package):
tmp = package.get("metadata") or {}
tmp = tmp.get("orb") or {}
tmp = tmp.get("unsupported_targets") or {}
if tmp == {}:
unsupported_targets = (
package.get("metadata", {}).get("orb", {}).get("unsupported_targets", {})
)
if not unsupported_targets:
return False
return host_platform in tmp
return host_platform in unsupported_targets

return {n: p for n, p in workspace_crates.items() if predicate(p)}

Expand Down Expand Up @@ -165,9 +163,7 @@ def get_binaries(*, crate):
def get_crate_flavors(*, crate):
"""extracts a dictionary of flavor_name => list[feature] for a given
crate's metadata"""
flavors = crate.get("metadata") or {}
flavors = flavors.get("orb") or {}
flavors = flavors.get("flavors") or {}
flavors = crate.get("metadata", {}).get("orb", {}).get("flavors", {})
return {f["name"]: f["features"] for f in flavors}


Expand Down

0 comments on commit 1f6b41c

Please sign in to comment.