openscad.py now works from the command line.
This commit is contained in:
parent
ed1cc8b488
commit
ec44fe96b4
|
@ -24,8 +24,8 @@ from __future__ import print_function
|
||||||
|
|
||||||
import subprocess, sys
|
import subprocess, sys
|
||||||
|
|
||||||
def run_list(args, silent = False):
|
def run_list(args, silent = False, verbose = False):
|
||||||
cmd = ["openscad"] + args
|
cmd = ["openscad.exe"] + args
|
||||||
if not silent:
|
if not silent:
|
||||||
for arg in cmd:
|
for arg in cmd:
|
||||||
print(arg, end=" ")
|
print(arg, end=" ")
|
||||||
|
@ -33,7 +33,7 @@ def run_list(args, silent = False):
|
||||||
with open("openscad.log", "w") as log:
|
with open("openscad.log", "w") as log:
|
||||||
rc = subprocess.call(cmd, stdout = log, stderr = log)
|
rc = subprocess.call(cmd, stdout = log, stderr = log)
|
||||||
for line in open("openscad.log", "rt"):
|
for line in open("openscad.log", "rt"):
|
||||||
if 'ERROR:' in line or 'WARNING:' in line:
|
if verbose or 'ERROR:' in line or 'WARNING:' in line:
|
||||||
print(line[:-1])
|
print(line[:-1])
|
||||||
if rc:
|
if rc:
|
||||||
sys.exit(rc)
|
sys.exit(rc)
|
||||||
|
@ -43,3 +43,6 @@ def run(*args):
|
||||||
|
|
||||||
def run_silent(*args):
|
def run_silent(*args):
|
||||||
run_list(list(args), True);
|
run_list(list(args), True);
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
run_list(sys.argv[1:], True, True)
|
||||||
|
|
Loading…
Reference in New Issue