Updated
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import os
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
class TechnologyManifestError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def technology_manifest_path(pdks_root: str, foundry: str, technology: str) -> str:
|
||||
base = os.path.abspath(pdks_root)
|
||||
path = os.path.abspath(os.path.join(base, foundry, technology, "technology.yml"))
|
||||
if not path.startswith(base + os.sep):
|
||||
raise TechnologyManifestError("Invalid technology path")
|
||||
return path
|
||||
|
||||
|
||||
def read_technology_manifest(pdks_root: str, foundry: str, technology: str) -> dict:
|
||||
path = technology_manifest_path(pdks_root, foundry, technology)
|
||||
if not os.path.exists(path):
|
||||
raise TechnologyManifestError("technology manifest not generated; run mxpic_forge technology export workflow")
|
||||
with open(path, "r", encoding="utf-8") as file:
|
||||
manifest = yaml.safe_load(file) or {}
|
||||
if not isinstance(manifest.get("xsections"), dict):
|
||||
raise TechnologyManifestError("technology manifest is missing xsections")
|
||||
if not isinstance(manifest.get("defaults"), dict):
|
||||
raise TechnologyManifestError("technology manifest is missing defaults")
|
||||
return manifest
|
||||
Reference in New Issue
Block a user