set_config.py now defines $target.

This commit is contained in:
Chris Palmer 2021-02-08 15:00:44 +00:00
parent 1c3f136657
commit 57212b5701
1 changed files with 6 additions and 5 deletions

View File

@ -69,17 +69,18 @@ def set_config(target, usage = None):
sys.exit(1) sys.exit(1)
fname = source_dir + "/target.scad" fname = source_dir + "/target.scad"
text = "include <config_%s.scad>\n" % target; text = ['include <config_%s.scad>\n' % target, '$target = "%s";\n' % target];
line = "" lines = [""]
try: try:
with open(fname,"rt") as f: with open(fname,"rt") as f:
line = f.read() line = f.readlines()
except: except:
pass pass
if line != text: if lines != text:
with open(fname,"wt") as f: with open(fname,"wt") as f:
f. write(text); for t in text:
f. write(t);
return target + "/" return target + "/"
def usage(): def usage():