diff options
author | jaseg <git@jaseg.de> | 2021-09-29 18:44:09 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-09-29 18:44:09 +0200 |
commit | 29c8245d0a28d70851b0be8635a88cf2c70316f0 (patch) | |
tree | a91910d317ddc285148fb4bb07fd5c9307ae8cee /gerbolyze | |
parent | a1e25a0cfbad464a85321c6f67c7b7f131ab9a23 (diff) | |
download | gerbolyze-2.2.2.tar.gz gerbolyze-2.2.2.tar.bz2 gerbolyze-2.2.2.zip |
Auto-discover usvg and svg-flatten properlyv2.2.2
Diffstat (limited to 'gerbolyze')
-rwxr-xr-x | gerbolyze/gerbolyze.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gerbolyze/gerbolyze.py b/gerbolyze/gerbolyze.py index d4b4ab5..53b10a4 100755 --- a/gerbolyze/gerbolyze.py +++ b/gerbolyze/gerbolyze.py @@ -624,17 +624,24 @@ def svg_to_gerber(infile, outfile, candidates = [os.environ['SVG_FLATTEN']] else: - # By default, try three options: + # By default, try four options: candidates = [ # somewhere in $PATH 'svg-flatten', + 'wasi-svg-flatten', # in user-local pip installation Path.home() / '.local' / 'bin' / 'svg-flatten', - # next to our current python interpreter (e.g. in virtualenv + Path.home() / '.local' / 'bin' / 'wasi-svg-flatten', + # next to our current python interpreter (e.g. in virtualenv) str(Path(sys.executable).parent / 'svg-flatten'), + str(Path(sys.executable).parent / 'wasi-svg-flatten'), # next to this python source file in the development repo str(Path(__file__).parent.parent / 'svg-flatten' / 'build' / 'svg-flatten') ] + # if SVG_FLATTEN envvar is set, try that first. + if 'SVG_FLATTEN' in os.environ: + candidates = [os.environ['SVG_FLATTEN'], *candidates] + args = [ '--format', ('gerber-outline' if outline_mode else 'gerber'), '--precision', '6', # intermediate file, use higher than necessary precision '--trace-space', str(trace_space) ] |