diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-06-03 08:46:51 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-06-14 08:57:12 +0200 |
commit | d203763f31428bee3edba4383d37f992b0f8e186 (patch) | |
tree | f5709efbeee38fa593bad25b8e15523478c7accc /src/ee/project | |
parent | 2554f0e774be0e473d650fc206ac7668d4561412 (diff) | |
download | ee-python-d203763f31428bee3edba4383d37f992b0f8e186.tar.gz ee-python-d203763f31428bee3edba4383d37f992b0f8e186.tar.bz2 ee-python-d203763f31428bee3edba4383d37f992b0f8e186.tar.xz ee-python-d203763f31428bee3edba4383d37f992b0f8e186.zip |
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.
Diffstat (limited to 'src/ee/project')
-rw-r--r-- | src/ee/project/__init__.py | 9 |
1 files changed, 7 insertions, 2 deletions
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: |