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 b03698b
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions ci/rust_ci_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# TODO: Rewrite this whole script in rust using cargo xtask. Its ridiculous how
# annoying it is to not have any type info.

from collections import defaultdict

import argparse
import json
import os
Expand Down Expand Up @@ -53,10 +51,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") or {}).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 +71,14 @@ 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") or {})
.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 b03698b

Please sign in to comment.