From 5940e7bcd6003049dfb86a7e83bb3c49883e6ade Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 24 Mar 2022 14:05:48 -0300 Subject: [PATCH] Fixed missing BoardViewOptions.get_targets Fixes #167 --- CHANGELOG.md | 6 ++++-- kibot/kiplot.py | 2 +- kibot/out_boardview.py | 3 +++ tests/test_plot/test_misc.py | 9 +++++++++ tests/yaml_samples/makefile_1.kibot.yaml | 4 ++++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c2da6bd..94d91e60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,8 +95,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Position files now defaults to use the auxiliary origin as KiCad. Can be disabled to use absolute coordinates. (#87) -- Board View: flipped output. (#89) -- Board View: problems with netnames using spaces. (#90) +- Board View: + - flipped output. (#89) + - problems with netnames using spaces. (#90) + - get_targets not implemented. (#167) - Schematic - load: problems with fields containing double quotes. (#98) - Paper orientation was discarded on v5 files. (#150) diff --git a/kibot/kiplot.py b/kibot/kiplot.py index c8f8bcd0..ef215cee 100644 --- a/kibot/kiplot.py +++ b/kibot/kiplot.py @@ -558,7 +558,7 @@ def generate_makefile(makefile, cfg_file, outputs, kibot_sys=False): skip = filter(lambda n: n != name, is_pre) f.write('{} -s {} -i{}\n\n'.format(kibot_cmd, ','.join(skip), log_action)) else: - f.write('{} -s all {}{}\n\n'.format(kibot_cmd, ori_names[name], log_action)) + f.write('{} -s all "{}"{}\n\n'.format(kibot_cmd, ori_names[name], log_action)) # Mark all outputs as PHONY f.write('.PHONY: '+' '.join(extra_targets+list(targets.keys()))+'\n') diff --git a/kibot/out_boardview.py b/kibot/out_boardview.py index b0dfa8a0..d7fc5227 100644 --- a/kibot/out_boardview.py +++ b/kibot/out_boardview.py @@ -163,6 +163,9 @@ class BoardViewOptions(BaseOptions): with open(output, 'wt') as f: convert(GS.board, f) + def get_targets(self, out_dir): + return [self._parent.expand_filename(out_dir, self.output)] + @output_class class BoardView(BaseOutput): # noqa: F821 diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index f09d6d01..d7885989 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -704,6 +704,15 @@ def check_makefile(ctx, mkfile, prj, dbg, txt): assert ctx.get_out_path(prj+'.pdf') in deps check_test_v5_sch_deps(ctx, targets[targets['pdf_sch_def']].split(' ')) logging.debug('- Target `pdf_sch_def` OK') + # boardview + deps = targets['Board_View_Test'].split(' ') + assert len(deps) == 1, deps + assert ctx.get_out_path(prj+'-boardview.brd') in deps + deps = targets[targets['Board_View_Test']].split(' ') + assert len(deps) == 2 + assert board_file in deps + assert yaml in deps + logging.debug('- Target `Board View Test` OK') # pdf_sch_int deps = targets['pdf_sch_int'].split(' ') assert len(deps) == 1, deps diff --git a/tests/yaml_samples/makefile_1.kibot.yaml b/tests/yaml_samples/makefile_1.kibot.yaml index 0df42451..06cd9612 100644 --- a/tests/yaml_samples/makefile_1.kibot.yaml +++ b/tests/yaml_samples/makefile_1.kibot.yaml @@ -109,6 +109,10 @@ outputs: comment: "Schematic with variants applied" type: sch_variant + - name: 'Board View Test' + comment: "Example of board view export" + type: boardview + - name: 'archive' comment: 'Compressed files' type: compress