aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-03-29 16:41:25 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-03-29 16:41:25 +0100
commit73c63d8c307bdbeb534c24fb51d4093c2fcbb86d (patch)
treed568efbdbc05d16de5635fa0011f96286f807b7e /src/ee/tools
parent87e603088ad8e311c11e3e072340588175cc4e6e (diff)
downloadee-python-73c63d8c307bdbeb534c24fb51d4093c2fcbb86d.tar.gz
ee-python-73c63d8c307bdbeb534c24fb51d4093c2fcbb86d.tar.bz2
ee-python-73c63d8c307bdbeb534c24fb51d4093c2fcbb86d.tar.xz
ee-python-73c63d8c307bdbeb534c24fb51d4093c2fcbb86d.zip
Project:
o adding cache_dir field, useful for controlling where cached data is placed from a central place. o Updating tools to use this new variable.
Diffstat (limited to 'src/ee/tools')
-rw-r--r--src/ee/tools/digikey_search_parts.py6
-rw-r--r--src/ee/tools/element14_search_parts.py12
-rw-r--r--src/ee/tools/seeed_download_opl.py6
3 files changed, 14 insertions, 10 deletions
diff --git a/src/ee/tools/digikey_search_parts.py b/src/ee/tools/digikey_search_parts.py
index 9f35e33..6cf104d 100644
--- a/src/ee/tools/digikey_search_parts.py
+++ b/src/ee/tools/digikey_search_parts.py
@@ -2,6 +2,7 @@ import argparse
from pathlib import Path
from ee.digikey.search_parts import search_parts
+from ee.project import Project
parser = argparse.ArgumentParser()
@@ -16,6 +17,7 @@ parser.add_argument("--out",
args = parser.parse_args()
-cache_dir = ".ee/cache/digikey"
+project = Project.load()
+cache_dir = project.cache_dir / "digikey"
-search_parts(Path(args.in_path), Path(args.out), Path(cache_dir))
+search_parts(Path(args.in_path), Path(args.out), cache_dir)
diff --git a/src/ee/tools/element14_search_parts.py b/src/ee/tools/element14_search_parts.py
index 11fd3e1..e2ef414 100644
--- a/src/ee/tools/element14_search_parts.py
+++ b/src/ee/tools/element14_search_parts.py
@@ -1,9 +1,9 @@
import argparse
from pathlib import Path
-from ee import project
from ee.element14 import Element14Config
from ee.element14.search_parts import search_parts
+from ee.project import Project
parser = argparse.ArgumentParser()
@@ -18,13 +18,13 @@ parser.add_argument("--out",
args = parser.parse_args()
-cache_dir = ".ee/cache/element14"
+project = Project.load()
-config = project.load_config(Path("."))
+cache_dir = project.cache_dir / "element14"
e14_config = Element14Config(
- store=config.get("element14", "store", fallback=None),
- api_key=config.get("element14", "api-key", fallback=None)
+ store=project.cfg.get("element14", "store", fallback=None),
+ api_key=project.cfg.get("element14", "api-key", fallback=None)
)
-search_parts(Path(args.in_path), Path(args.out), Path(cache_dir), e14_config)
+search_parts(Path(args.in_path), Path(args.out), cache_dir, e14_config)
diff --git a/src/ee/tools/seeed_download_opl.py b/src/ee/tools/seeed_download_opl.py
index 3f8b07b..efbdfb3 100644
--- a/src/ee/tools/seeed_download_opl.py
+++ b/src/ee/tools/seeed_download_opl.py
@@ -1,6 +1,7 @@
import argparse
from pathlib import Path
+from ee.project import Project
from ee.supplier import seeed
parser = argparse.ArgumentParser()
@@ -15,6 +16,7 @@ parser.add_argument("--opl",
args = parser.parse_args()
-cache_dir = ".ee/cache/seeed"
+project = Project.load()
+cache_dir = project.cache_dir / "seeed"
-seeed.download_opl(Path(args.out), Path(cache_dir), args.opl)
+seeed.download_opl(Path(args.out), cache_dir, args.opl)