From d203763f31428bee3edba4383d37f992b0f8e186 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 3 Jun 2019 08:46:51 +0200 Subject: ninja: o Reading list of suppliers from Project. The project still has a hard-coded list, but at least now there is only one list. o Using Project.public_dir instead of "ee". Also in generated ninja files. o Removing part_dbs list from internal code, only use suppliers. If the user want to have it's own internal list of parts that should become a supplier. --- src/ee/project/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/ee/project') diff --git a/src/ee/project/__init__.py b/src/ee/project/__init__.py index 6c04c07..395d204 100644 --- a/src/ee/project/__init__.py +++ b/src/ee/project/__init__.py @@ -1,6 +1,7 @@ import configparser import uuid from pathlib import Path +from typing import List from ee import EeException from ee.digikey import DigikeyStore @@ -29,9 +30,9 @@ class SupplierDescriptor(object): class Project(object): def __init__(self, project_dir: Path, cfg: configparser.ConfigParser): - self.report_dir = project_dir / "ee" / "reports" self.public_dir = project_dir / "ee" - self.cache_dir = project_dir / "ee" / "cache" + self.report_dir = self.public_dir / "reports" + self.cache_dir = self.public_dir / "cache" self.project_dir = project_dir self._cfg = cfg @@ -47,6 +48,10 @@ class Project(object): digikey_store = DigikeyStore.from_store_code("us") self._suppliers.append(SupplierDescriptor("digikey", digikey_store.url, "Digikey")) + @property + def suppliers(self) -> List[SupplierDescriptor]: + return self._suppliers + def get_supplier_by_key(self, key) -> SupplierDescriptor: sd = next((s for s in self._suppliers if s.key == key), None) if sd: -- cgit v1.2.3