aboutsummaryrefslogtreecommitdiff
path: root/src/ee/project
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-03-25 15:46:08 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-03-25 15:46:08 +0100
commit52401b170d8f1c9deaa153acca76e7d6060a06df (patch)
treeffbe1722e5c88ab841fd8661ca085a1b1cdf7842 /src/ee/project
parent50ee4b871bc9d0076cabaa5d2ea4ad1ba7b8e15a (diff)
downloadee-python-52401b170d8f1c9deaa153acca76e7d6060a06df.tar.gz
ee-python-52401b170d8f1c9deaa153acca76e7d6060a06df.tar.bz2
ee-python-52401b170d8f1c9deaa153acca76e7d6060a06df.tar.xz
ee-python-52401b170d8f1c9deaa153acca76e7d6060a06df.zip
New command: init. Looks for kicad schematic and pcb files, creates
.ee/config. ninja tool: o Use project's config to check for sch and pcb files. o Use some more conditionals in build.ninja.j2. unlockoslo: Adding demo project.
Diffstat (limited to 'src/ee/project')
-rw-r--r--src/ee/project/__init__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ee/project/__init__.py b/src/ee/project/__init__.py
index 5943a7c..6851256 100644
--- a/src/ee/project/__init__.py
+++ b/src/ee/project/__init__.py
@@ -1,6 +1,8 @@
import configparser
from pathlib import Path
+from ee.tools import mk_parents
+
def load_config(project_dir: Path) -> configparser.ConfigParser:
config = configparser.ConfigParser()
@@ -18,12 +20,23 @@ def load_config(project_dir: Path) -> configparser.ConfigParser:
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.project_dir = project_dir
self._cfg = cfg
+ @property
+ def cfg(self):
+ return self._cfg
+
@classmethod
def load(cls):
project_dir = Path(".")
cfg = load_config(project_dir)
return Project(project_dir, cfg)
+
+ def save(self):
+ path = self.project_dir / ".ee" / "config"
+ mk_parents(path)
+ with (path).open("w") as f:
+ self._cfg.write(f)