Skip to content

Commit

Permalink
Gardening + Use gh auth token to get ghcli token
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Aug 20, 2024
1 parent 0dea0d1 commit 3d3ad49
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 259 deletions.
3 changes: 0 additions & 3 deletions volare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
)
from .common import (
get_volare_home,
get_current_version,
get_installed_list,
Version,
root_for,
)
from .families import Family
from .github import (
Expand Down
2 changes: 1 addition & 1 deletion volare/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "0.18.1"
__version__ = "0.19.0"

if __name__ == "__main__":
print(__version__, end="")
1 change: 0 additions & 1 deletion volare/build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
Version,
mkdirp,
resolve_version,
get_version_dir,
date_to_iso8601,
)
from ..click_common import (
Expand Down
158 changes: 0 additions & 158 deletions volare/build/asap7.py

This file was deleted.

7 changes: 0 additions & 7 deletions volare/build/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
from volare.github import GitHubSession


class RepoMetadata(object):
def __init__(self, repo, default_commit, default_branch="main"):
self.repo = repo
self.default_commit = default_commit
self.default_branch = default_branch


def open_pdks_fix_makefile(at_path: str):
backup_path = f"{at_path}.bak"
shutil.move(at_path, backup_path)
Expand Down
26 changes: 6 additions & 20 deletions volare/build/gf180mcu.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,15 @@
from rich.progress import Progress

from .git_multi_clone import GitMultiClone
from .common import RepoMetadata, patch_open_pdks
from .common import patch_open_pdks
from ..families import Family
from ..github import opdks_repo
from ..common import (
get_version_dir,
Version,
get_volare_dir,
mkdirp,
)

repo_metadata = {
"open_pdks": RepoMetadata(
opdks_repo.link,
"cc0029b45c68137aa21323912f50d2fc17eeea13",
"master",
),
"gf180mcu": RepoMetadata(
"https://github.com/google/gf180mcu-pdk",
"08c628b77c4683cad8441d7d0c2df1c8ab58cbc2",
"main",
),
}

MAGIC_DEFAULT_TAG = "085131b090cb511d785baf52a10cf6df8a657d44"


Expand All @@ -62,13 +49,12 @@ def get_open_pdks(
with Progress() as progress:
with ThreadPoolExecutor(max_workers=jobs) as executor:
gmc = GitMultiClone(build_directory, progress)
open_pdks = repo_metadata["open_pdks"]
open_pdks_future = executor.submit(
GitMultiClone.clone,
gmc,
open_pdks.repo,
opdks_repo.link,
version,
open_pdks.default_branch,
default_branch="master",
)
open_pdks_repo = open_pdks_future.result()
repo_path = open_pdks_repo.path
Expand Down Expand Up @@ -201,7 +187,7 @@ def run_sh(script, log_to):
def install_gf180mcu(build_directory, pdk_root, version):
console = Console()
with console.status("Adding build to list of installed versions…"):
version_directory = get_version_dir(pdk_root, "gf180mcu", version)
version_directory = Version(version, "gf180mcu").get_dir(pdk_root)
if (
os.path.exists(version_directory)
and len(os.listdir(version_directory)) != 0
Expand All @@ -210,7 +196,7 @@ def install_gf180mcu(build_directory, pdk_root, version):
it = 0
while os.path.exists(backup_path) and len(os.listdir(backup_path)) != 0:
it += 1
backup_path = get_version_dir(pdk_root, "gf180mcu", f"{version}.bk{it}")
backup_path = Version(f"{version}.bk{it}", "gf180mcu").get_dir(pdk_root)
console.log(
f"Build already found at {version_directory}, moving to {backup_path}…"
)
Expand Down
26 changes: 6 additions & 20 deletions volare/build/sky130.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,15 @@
from rich.progress import Progress

from .git_multi_clone import GitMultiClone
from .common import RepoMetadata, patch_open_pdks
from .common import patch_open_pdks
from ..families import Family
from ..github import opdks_repo
from ..common import (
get_version_dir,
Version,
get_volare_dir,
mkdirp,
)

repo_metadata = {
"open_pdks": RepoMetadata(
opdks_repo.link,
"34eeb2743e99d44a21c2cedd467675a2e0f3bb91",
"master",
),
"sky130": RepoMetadata(
"https://github.com/google/skywater-pdk",
"f70d8ca46961ff92719d8870a18a076370b85f6c",
"main",
),
}

MAGIC_DEFAULT_TAG = "085131b090cb511d785baf52a10cf6df8a657d44"


Expand All @@ -63,13 +50,12 @@ def get_open_pdks(
with Progress() as progress:
with ThreadPoolExecutor(max_workers=jobs) as executor:
gmc = GitMultiClone(build_directory, progress)
open_pdks = repo_metadata["open_pdks"]
open_pdks_future = executor.submit(
GitMultiClone.clone,
gmc,
open_pdks.repo,
opdks_repo.link,
version,
open_pdks.default_branch,
default_branch="master",
)
open_pdks_repo = open_pdks_future.result()
repo_path = open_pdks_repo.path
Expand Down Expand Up @@ -298,7 +284,7 @@ def run_sh(script, log_to):
def install_sky130(build_directory, pdk_root, version):
console = Console()
with console.status("Adding build to list of installed versions…"):
version_directory = get_version_dir(pdk_root, "sky130", version)
version_directory = Version("sky130", version).get_dir(pdk_root)
if (
os.path.exists(version_directory)
and len(os.listdir(version_directory)) != 0
Expand All @@ -307,7 +293,7 @@ def install_sky130(build_directory, pdk_root, version):
it = 0
while os.path.exists(backup_path) and len(os.listdir(backup_path)) != 0:
it += 1
backup_path = get_version_dir(pdk_root, "sky130", f"{version}.bk{it}")
backup_path = Version(f"{version}.bk{it}", version).get_dir(pdk_root)
console.log(
f"Build already found at {version_directory}, moving to {backup_path}…"
)
Expand Down
34 changes: 2 additions & 32 deletions volare/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
import re
import shutil
import pathlib
import warnings
from datetime import datetime
from dataclasses import dataclass
from typing import Iterable, Optional, List, Dict, Tuple, Union
from typing import Iterable, Optional, List, Dict, Tuple

from . import github
from .families import Family
Expand Down Expand Up @@ -86,7 +85,7 @@ def __str__(self) -> str:
return self.name

def is_installed(self, pdk_root: str) -> bool:
version_dir = get_version_dir(pdk_root, self.pdk, self.name)
version_dir = self.get_dir(pdk_root)
return os.path.isdir(version_dir)

def is_current(self, pdk_root: str) -> bool:
Expand Down Expand Up @@ -255,32 +254,3 @@ def resolve_version(
version = open_pdks_list[0]["commit"]

return version


# -- The Deprecation Zone


def get_current_version(pdk_root: str, pdk: str) -> Optional[str]:
warnings.warn("get_current_version() is deprecated, use Version.get_current()")
return _get_current_version(pdk_root, pdk)


def get_installed_list(pdk_root: str, pdk: str) -> list:
warnings.warn("get_installed_list() is deprecated, use Version.get_all_installed()")
return Version.get_all_installed(pdk_root, pdk)


def get_version_dir(pdk_root: str, pdk: str, version: Union[str, Version]) -> str:
warnings.warn("get_version_dir() is deprecated, use Version().get_dir()")
if not isinstance(version, Version):
version = Version(version, pdk)
return version.get_dir(pdk_root)


def root_for(
pdk_root: str,
pdk: str,
version: str,
) -> str:
warnings.warn("root_for() has been deprecated: use Version().get_dir()")
return Version(version, pdk).get_dir(pdk_root)
3 changes: 0 additions & 3 deletions volare/families.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,3 @@ def resolve_libraries(
"gf180mcu_fd_ip_sram",
],
)
# Family.by_name["asap7"] = Family(
# name="asap7", variants=["asap7"], default_includes=[], all_libraries=[]
# )
Loading

0 comments on commit 3d3ad49

Please sign in to comment.