diff options
Diffstat (limited to 'src/ee/project')
-rw-r--r-- | src/ee/project/__init__.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ee/project/__init__.py b/src/ee/project/__init__.py index 0857e7c..6c04c07 100644 --- a/src/ee/project/__init__.py +++ b/src/ee/project/__init__.py @@ -1,4 +1,5 @@ import configparser +import uuid from pathlib import Path from ee import EeException @@ -34,6 +35,13 @@ class Project(object): self.project_dir = project_dir self._cfg = cfg + if "project" not in cfg: + cfg.add_section("project") + + project = cfg["project"] + if "uuid" not in project: + project["uuid"] = str(uuid.uuid4()) + # TODO: read from config self._suppliers = [] digikey_store = DigikeyStore.from_store_code("us") @@ -55,6 +63,10 @@ class Project(object): def cfg(self): return self._cfg + @property + def uuid(self): + return uuid.UUID(hex=self._cfg["project"]["uuid"]) + @classmethod def load(cls): project_dir = Path(".") |