diff --git a/README.md b/README.md index aea4d142..b7c2daf8 100644 --- a/README.md +++ b/README.md @@ -1502,7 +1502,7 @@ Notes: - **`name`**: [string=''] Used to identify this particular output definition. - **`options`**: [dict] Options for the `diff` output. * Valid keys: - - **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i=diff, %x=pdf). Affected by global options. + - **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i=diff_pcb/diff_sch, %x=pdf). Affected by global options. - `add_link_id`: [boolean=false] When enabled we create a symlink to the output file with a name that contains the git hashes involved in the comparison. If you plan to compress the output don't forget to disable the `follow_links` option. diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index 0c1b26d4..f6417e32 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -442,7 +442,7 @@ outputs: # [string='git'] [git,file] How to interpret the `old` name. Use `git` for a git hash, branch, etc. # Use `file` for a file name old_type: 'git' - # [string='%f-%i%I%v.%x'] Filename for the output (%i=diff, %x=pdf). Affected by global options + # [string='%f-%i%I%v.%x'] Filename for the output (%i=diff_pcb/diff_sch, %x=pdf). Affected by global options output: '%f-%i%I%v.%x' # [boolean=true] Compare the PCB, otherwise compare the schematic pcb: true diff --git a/kibot/out_diff.py b/kibot/out_diff.py index 1e3116b9..5086dce5 100644 --- a/kibot/out_diff.py +++ b/kibot/out_diff.py @@ -58,7 +58,7 @@ class DiffOptions(BaseOptions): def __init__(self): with document: self.output = GS.def_global_output - """ *Filename for the output (%i=diff, %x=pdf) """ + """ *Filename for the output (%i=diff_pcb/diff_sch, %x=pdf) """ self.pcb = True """ Compare the PCB, otherwise compare the schematic """ self.old = 'HEAD' @@ -95,6 +95,10 @@ class DiffOptions(BaseOptions): self._expand_id = 'diff' self._expand_ext = 'pdf' + def config(self, parent): + super().config(parent) + self._expand_id = 'diff'+'_pcb' if self.pcb else '_sch' + def get_targets(self, out_dir): return [self._parent.expand_filename(out_dir, self.output)] diff --git a/tests/reference/5_1_6/light_control-diff.pdf b/tests/reference/5_1_6/light_control-diff_pcb.pdf similarity index 100% rename from tests/reference/5_1_6/light_control-diff.pdf rename to tests/reference/5_1_6/light_control-diff_pcb.pdf diff --git a/tests/reference/5_1_7/light_control-diff.pdf b/tests/reference/5_1_7/light_control-diff.pdf deleted file mode 120000 index 023b0694..00000000 --- a/tests/reference/5_1_7/light_control-diff.pdf +++ /dev/null @@ -1 +0,0 @@ -../5_1_6/light_control-diff.pdf \ No newline at end of file diff --git a/tests/reference/5_1_7/light_control-diff_pcb.pdf b/tests/reference/5_1_7/light_control-diff_pcb.pdf new file mode 120000 index 00000000..bff03d07 --- /dev/null +++ b/tests/reference/5_1_7/light_control-diff_pcb.pdf @@ -0,0 +1 @@ +../5_1_6/light_control-diff_pcb.pdf \ No newline at end of file diff --git a/tests/reference/6_0_4/light_control-diff.pdf b/tests/reference/6_0_4/light_control-diff_pcb.pdf similarity index 100% rename from tests/reference/6_0_4/light_control-diff.pdf rename to tests/reference/6_0_4/light_control-diff_pcb.pdf diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index 354bb32e..479bb747 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -1304,7 +1304,7 @@ def test_diff_git_1(test_dir): shutil.copy2(ctx.board_file.replace(prj, prj+'_diff'), file) # Run the test ctx.run(extra=['-b', file], no_board_file=True) - ctx.compare_pdf(prj+'-diff.pdf') + ctx.compare_pdf(prj+'-diff_pcb.pdf') ctx.clean_up(keep_project=True) @@ -1339,7 +1339,7 @@ def test_diff_git_2(test_dir): shutil.copy2(ctx.board_file.replace(prj, '3Rs'), file) # Run the test ctx.run(extra=['-b', file], no_board_file=True, extra_debug=True) - ctx.compare_pdf(prj+'-diff.pdf') + ctx.compare_pdf(prj+'-diff_pcb.pdf') ctx.clean_up(keep_project=True) @@ -1372,5 +1372,5 @@ def test_diff_git_3(test_dir): ctx.run_command(['git', 'commit', '-m', 'New version'], chdir_out=True) # Run the test ctx.run(extra=['-b', file], no_board_file=True, extra_debug=True) - ctx.compare_pdf(prj+'-diff.pdf') + ctx.compare_pdf(prj+'-diff_pcb.pdf') ctx.clean_up(keep_project=True)