diff options
author | Michael Schwarz <michi.schwarz@gmail.com> | 2015-09-14 15:02:57 +0200 |
---|---|---|
committer | Michael Schwarz <michi.schwarz@gmail.com> | 2015-09-16 01:50:23 +0200 |
commit | 2bd7e1e3d72da6b78f1946d508fa8f50f7e9ef67 (patch) | |
tree | fb49e589dd51dca9dd8c7ee0844b507e6d78435a | |
parent | 096db19a9a465cc667aa5d0ef92df2eeac5955b2 (diff) | |
download | pogojig-2bd7e1e3d72da6b78f1946d508fa8f50f7e9ef67.tar.gz pogojig-2bd7e1e3d72da6b78f1946d508fa8f50f7e9ef67.tar.bz2 pogojig-2bd7e1e3d72da6b78f1946d508fa8f50f7e9ef67.zip |
Separate module for make file stuff.
-rw-r--r-- | support/lib/make.py | 5 | ||||
-rw-r--r-- | support/openscad/__main__.py | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/support/lib/make.py b/support/lib/make.py new file mode 100644 index 0000000..3502ef6 --- /dev/null +++ b/support/lib/make.py @@ -0,0 +1,5 @@ +from . import util + + +def write_dependencies(path, target, dependencies): + util.write_file(path, '{}: {}\n'.format(target, ' '.join(dependencies)).encode()) diff --git a/support/openscad/__main__.py b/support/openscad/__main__.py index 0eae27e..7aeaa31 100644 --- a/support/openscad/__main__.py +++ b/support/openscad/__main__.py @@ -1,17 +1,13 @@ import os -from lib import util +from lib import util, make def _openscad(in_path, out_path, deps_path): util.command([os.environ['OPENSCAD'], '-o', out_path, '-d', deps_path, in_path]) -def _write_dependencies(path, target, dependencies): - util.write_file(path, '{}: {}\n'.format(target, ' '.join(dependencies)).encode()) - - @util.main -def main(in_path, out_path, deps_path): +def main(in_path, out_path): cwd = os.getcwd() def relpath(path): @@ -42,5 +38,5 @@ def main(in_path, out_path, deps_path): ignored_files = set(map(relpath, [in_path, temp_deps_path, temp_mk_path, temp_out_path])) # Write output files. - _write_dependencies(deps_path, relpath(out_path), deps - ignored_files) + make.write_dependencies(out_path + '.d', out_path, deps - ignored_files) util.rename_atomic(temp_out_path, out_path) |