File name patterns are allowed for the `netlist_file` option.

- Closes #33
- File name patterns: %F is the name of the source file without
  extension, but with the path.
This commit is contained in:
Salvador E. Tropea 2020-12-16 11:10:36 -03:00
parent 351e734dd6
commit d201843b6a
8 changed files with 17 additions and 5 deletions

View File

@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- iBoM output: file name patterns are allowed for the `netlist_file` option.
- File name patterns: %F is the name of the source file without extension, but
with the path.
## [0.8.1] - 2020-12-09
### Added

View File

@ -192,6 +192,7 @@ You can always choose the file name for a particular output.
The pattern uses the following expansions:
- **%f** original pcb/sch file name without extension.
- **%F** original pcb/sch file name without extension. Including the directory part of the name.
- **%p** pcb/sch title from pcb metadata.
- **%c** company from pcb/sch metadata.
- **%r** revision from pcb/sch metadata.
@ -820,7 +821,7 @@ Next time you need this list just use an alias, like this:
%T : bom generation time.
Extension .html will be added automatically.
Note that this name is used only when output is ''.
- `netlist_file`: [string=''] Path to netlist or xml file.
- `netlist_file`: [string=''] Path to netlist or xml file. You can use '%F.xml' to avoid specifying the project name.
- `no_blacklist_virtual`: [boolean=false] Do not blacklist virtual components.
IBoM option, avoid using in conjunction with KiBot variants/filters.
- `no_redraw_on_drag`: [boolean=false] Do not redraw pcb on drag by default.

View File

@ -174,6 +174,7 @@ You can always choose the file name for a particular output.
The pattern uses the following expansions:
- **%f** original pcb/sch file name without extension.
- **%F** original pcb/sch file name without extension. Including the directory part of the name.
- **%p** pcb/sch title from pcb metadata.
- **%c** company from pcb/sch metadata.
- **%r** revision from pcb/sch metadata.

View File

@ -399,7 +399,7 @@ outputs:
# Extension .html will be added automatically.
# Note that this name is used only when output is ''
name_format: 'ibom'
# [string=''] Path to netlist or xml file
# [string=''] Path to netlist or xml file. You can use '%F.xml' to avoid specifying the project name
netlist_file: ''
# [boolean=false] Do not blacklist virtual components.
# IBoM option, avoid using in conjunction with KiBot variants/filters

View File

@ -193,6 +193,7 @@ class Optionable(object):
name = name.replace('%c', GS.pcb_comp)
name = name.replace('%d', GS.pcb_date)
name = name.replace('%D', GS.today)
name = name.replace('%F', GS.pcb_no_ext)
name = name.replace('%f', GS.pcb_basename)
name = name.replace('%i', id)
name = name.replace('%p', GS.pcb_title)
@ -214,6 +215,7 @@ class Optionable(object):
name = name.replace('%c', GS.sch_comp)
name = name.replace('%d', GS.sch_date)
name = name.replace('%D', GS.today)
name = name.replace('%F', GS.sch_no_ext)
name = name.replace('%f', GS.sch_basename)
name = name.replace('%i', id)
name = name.replace('%p', GS.sch_title)

View File

@ -54,7 +54,7 @@ class IBoMOptions(VariantOptions):
self.sort_order = 'C,R,L,D,U,Y,X,F,SW,A,~,HS,CNN,J,P,NT,MH'
""" Default sort order for components. Must contain '~' once """
self.netlist_file = ''
""" Path to netlist or xml file """
""" Path to netlist or xml file. You can use '%F.xml' to avoid specifying the project name """
self.extra_fields = ''
""" Comma separated list of extra fields to pull from netlist or xml file """
self.normalize_field_case = False
@ -85,6 +85,10 @@ class IBoMOptions(VariantOptions):
self.add_to_doc('variant', WARNING_MIX)
self.add_to_doc('dnf_filter', WARNING_MIX)
def config(self):
super().config()
self.netlist_file = self.expand_filename('', self.netlist_file, 'ibom', 'xml')
def run(self, output_dir, board):
super().run(output_dir, board)
check_script(CMD_IBOM, URL_IBOM)

View File

@ -25,7 +25,7 @@ outputs:
blacklist: 'DNF*'
no_blacklist_virtual: true
blacklist_empty_val: true
netlist_file: 'tests/board_samples/kicad_5/bom.xml'
netlist_file: '%F.xml'
extra_fields: 'EF'
normalize_field_case: true
variant_field: 'DL'

View File

@ -25,7 +25,7 @@ outputs:
blacklist: 'DNF*'
no_blacklist_virtual: true
blacklist_empty_val: true
netlist_file: 'tests/board_samples/kicad_6/bom.xml'
netlist_file: '%F.xml'
extra_fields: 'EF'
normalize_field_case: true
variant_field: 'DL'