[Diff] Now the %i is diff_pcb for the PCB and diff_sch for the sch

Related to #265
This commit is contained in:
Salvador E. Tropea 2022-09-01 14:13:28 -03:00
parent 61bee6e9cc
commit d8d8552883
8 changed files with 11 additions and 7 deletions

View File

@ -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.

View File

@ -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

View File

@ -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)]

View File

@ -1 +0,0 @@
../5_1_6/light_control-diff.pdf

View File

@ -0,0 +1 @@
../5_1_6/light_control-diff_pcb.pdf

View File

@ -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)