Skip to content

Commit

Permalink
fix open_pdks assumptions when pushing/getting dates
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Jan 8, 2025
1 parent abf7325 commit a782d9d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
10 changes: 6 additions & 4 deletions volare/build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from ..github import (
GitHubSession,
get_open_pdks_commit_date,
get_commit_date,
volare_repo,
)
from ..common import (
Expand Down Expand Up @@ -141,6 +141,8 @@ def push(
push_libraries=None,
session: Optional[GitHubSession] = None,
):
family = Family.by_name[pdk]

if session is None:
session = GitHubSession()
if session.github_token is None:
Expand All @@ -149,7 +151,7 @@ def push(
console = Console()

if push_libraries is None or len(push_libraries) == 0:
push_libraries = Family.by_name[pdk].all_libraries
push_libraries = family.all_libraries
library_list = set(push_libraries)

version_object = Version(version, pdk)
Expand Down Expand Up @@ -199,9 +201,9 @@ def push(
console.log("Starting upload…")

body = f"{pdk} variants built using volare"
date = get_open_pdks_commit_date(version, session)
date = get_commit_date(version, family.repo, session)
if date is not None:
body = f"{pdk} variants built using open_pdks {version} (released on {date_to_iso8601(date)})"
body = f"{pdk} variants (released on {date_to_iso8601(date)})"

for tarball_path in final_tarballs:
subprocess.check_call(
Expand Down
2 changes: 1 addition & 1 deletion volare/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _from_github(
for release in releases:
if release["draft"]:
continue
family, hash = release["tag_name"].split("-")
family, hash = release["tag_name"].rsplit("-", maxsplit=1)

upload_date = date_from_iso8601(release["published_at"])
commit_date = None
Expand Down
6 changes: 6 additions & 0 deletions volare/families.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from dataclasses import dataclass
from typing import Iterable, List, Dict, Optional, Set, ClassVar

from .github import RepoInfo, opdks_repo, ihp_repo


@dataclass
class Family(object):
Expand All @@ -22,6 +24,7 @@ class Family(object):
name: str
variants: List[str]
all_libraries: List[str]
repo: RepoInfo
# lol no implicitly unwrapped optionals
default_variant: str = None # type: ignore
default_includes: List[str] = None # type: ignore
Expand Down Expand Up @@ -79,6 +82,7 @@ def resolve_libraries(
"sky130_ml_xx_hd",
"sky130_sram_macros",
],
repo=opdks_repo,
)
Family.by_name["gf180mcu"] = Family(
name="gf180mcu",
Expand All @@ -100,6 +104,7 @@ def resolve_libraries(
"gf180mcu_fd_sc_mcu9t5v0",
"gf180mcu_fd_ip_sram",
],
repo=opdks_repo,
)
Family.by_name["ihp-sg13g2"] = Family(
name="ihp-sg13g2",
Expand All @@ -110,4 +115,5 @@ def resolve_libraries(
"sg13g2_sram",
"sg13g2_stdcell",
],
repo=ihp_repo,
)
8 changes: 5 additions & 3 deletions volare/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,16 @@ def get_user_agent(Self) -> str:
return f"volare/{__version__}"


def get_open_pdks_commit_date(
commit: str, session: Optional[GitHubSession] = None
def get_commit_date(
commit: str,
repo: RepoInfo,
session: Optional[GitHubSession] = None,
) -> Optional[datetime]:
if session is None:
session = GitHubSession()

try:
response = session.api(opdks_repo, f"/commits/{commit}", "get")
response = session.api(repo, f"/commits/{commit}", "get")
except httpx.HTTPError:
return None

Expand Down

0 comments on commit a782d9d

Please sign in to comment.