mirror of
https://github.com/ervanalb/keygen.git
synced 2025-12-16 13:25:25 +00:00
put it all together into a JSON file
This commit is contained in:
8
Makefile
8
Makefile
@@ -27,16 +27,18 @@ POLYFLAGS =
|
||||
SCADFLAGS =
|
||||
|
||||
# Targets
|
||||
all: stl
|
||||
all: stl $(JSON_DIR)/keys.json
|
||||
poly: $(POLY_OBJ)
|
||||
$(STL_DIR)/%.d: $(SCAD_DIR)/%.scad
|
||||
bin/parse.py $< $(STL_DIR)/$*.d $(JSON_DIR)/$*.json
|
||||
$(JSON_DIR)/%.json: $(SCAD_DIR)/%.scad
|
||||
bin/parse.py $< $(STL_DIR)/$*.d $(JSON_DIR)/$*.json
|
||||
clean:
|
||||
-rm -f $(POLY_DIR)/*.gen.scad $(STL_DIR)/*.stl $(STL_DIR)/*.d $(JSON_DIR)/*.json
|
||||
$(POLY_DIR)/%.gen.scad: $(SVG_DIR)/%.svg
|
||||
$(POLY) $(POLYFLAGS) --fname $@ $<
|
||||
$(JSON_DIR)/keys.json: $(JSON_OBJ)
|
||||
bin/json_merge.py $^ >$(JSON_DIR)/keys.json
|
||||
clean:
|
||||
-rm -f $(POLY_DIR)/*.gen.scad $(STL_DIR)/*.stl $(STL_DIR)/*.d $(JSON_DIR)/*.json
|
||||
|
||||
include $(patsubst $(SCAD_DIR)/%.scad,$(STL_DIR)/%.d,$(SCAD_SRC))
|
||||
|
||||
|
||||
12
bin/json_merge.py
Executable file
12
bin/json_merge.py
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import json
|
||||
|
||||
def read_json_file(fn):
|
||||
with open(fn) as f:
|
||||
return json.load(f)
|
||||
|
||||
combined = [read_json_file(fn) for fn in sys.argv[1:]]
|
||||
|
||||
print(json.dumps(combined))
|
||||
Reference in New Issue
Block a user