aboutsummaryrefslogtreecommitdiff
path: root/src/ee/part
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-03-04 00:06:32 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-03-04 00:06:32 +0100
commit5a6ab34565fa3d783337a68e07e3500361c8fcf5 (patch)
treec0d4fd9f6986351a543838fabc3dacf8d9ad5fb1 /src/ee/part
parent650b4ad3774c4cc454a02073808d981f6873036d (diff)
downloadee-python-5a6ab34565fa3d783337a68e07e3500361c8fcf5.tar.gz
ee-python-5a6ab34565fa3d783337a68e07e3500361c8fcf5.tar.bz2
ee-python-5a6ab34565fa3d783337a68e07e3500361c8fcf5.tar.xz
ee-python-5a6ab34565fa3d783337a68e07e3500361c8fcf5.zip
o PartDB: don't die if the directory exist *and* is empty. Ninja creates
empty parent directories. o PartDB: escape some path names. o new comamnd: "ninja". Generates a build.ninja from a sch. Not done!
Diffstat (limited to 'src/ee/part')
-rw-r--r--src/ee/part/__init__.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ee/part/__init__.py b/src/ee/part/__init__.py
index cf60dd5..d4d99ac 100644
--- a/src/ee/part/__init__.py
+++ b/src/ee/part/__init__.py
@@ -81,7 +81,9 @@ def save_db(dir_path: Path, db: PartDb):
idx_path = dir_path / "index.xml"
if not idx_path.is_file():
- raise EeException("The given db directory exists, but does not look like a part db dir")
+ # Ninja creates the parent directories out the output..
+ if len(list(dir_path.iterdir())) > 0:
+ raise EeException("The given db directory exists, but does not look like a part db dir")
for p in dir_path.iterdir():
if not p.is_file():
@@ -100,7 +102,7 @@ def save_db(dir_path: Path, db: PartDb):
for part in parts:
id_ = part.id
- path = dir_path / "{}.xml".format(id_)
+ path = dir_path / "{}.xml".format(id_.replace("/", "_"))
with path.open("w") as f:
part.export(outfile=f, level=0, name_=find_root_tag(part))