Internal BoM: added `no_conflict` option.

Used to exclude fields from conflict detection.
This commit is contained in:
Salvador E. Tropea 2021-01-05 12:09:29 -03:00
parent 2da936ec11
commit 9a1e1f39e7
7 changed files with 27 additions and 1 deletions

View File

@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- The multipart id to references of multipart components others than part 1.
- Internal BoM: `no_conflict` option to exclude fields from conflict detection.
## [0.9.0] - 2021-01-04
### Added

View File

@ -619,6 +619,9 @@ Next time you need this list just use an alias, like this:
- `title`: [string='KiBot Bill of Materials'] BoM title.
- `ignore_dnf`: [boolean=true] Exclude DNF (Do Not Fit) components.
- `merge_blank_fields`: [boolean=true] Component groups with blank fields will be merged into the most compatible group, where possible.
- `no_conflict`: [list(string)] List of fields where we tolerate conflicts.
Use it to avoid undesired warnings.
By default the field indicated in `fit_field` and the field `part` are excluded.
- `normalize_locale`: [boolean=false] When normalizing values use the locale decimal point.
- `normalize_values`: [boolean=false] Try to normalize the R, L and C values, producing uniform units and prefixes.
- `number`: [number=1] Number of boards to build (components multiplier).

View File

@ -111,6 +111,10 @@ outputs:
ignore_dnf: true
# [boolean=true] Component groups with blank fields will be merged into the most compatible group, where possible
merge_blank_fields: true
# [list(string)] List of fields where we tolerate conflicts.
# Use it to avoid undesired warnings.
# By default the field indicated in `fit_field` and the field `part` are excluded
no_conflict:
# [boolean=false] When normalizing values use the locale decimal point
normalize_locale: false
# [boolean=false] Try to normalize the R, L and C values, producing uniform units and prefixes

View File

@ -214,7 +214,7 @@ class ComponentGroup(object):
else:
# Config contains variant information, which is different for each component
# Part can be one of the defined aliases
if field != self.cfg.fit_field and field != 'part':
if field not in self.cfg.no_conflict:
logger.warning(W_FIELDCONF + "Field conflict: ({refs}) [{name}] : '{flds}' <- '{fld}' (in {ref})".format(
refs=self.get_refs(),
name=field,

View File

@ -243,6 +243,10 @@ class BoMOptions(BaseOptions):
- ['sw', 'switch']
- ['zener', 'zenersmall']
- ['d', 'diode', 'd_small'] """
self.no_conflict = Optionable
""" [list(string)] List of fields where we tolerate conflicts.
Use it to avoid undesired warnings.
By default the field indicated in `fit_field` and the field `part` are excluded """
super().__init__()
@staticmethod
@ -317,6 +321,15 @@ class BoMOptions(BaseOptions):
self._normalize_variant()
# Field names are handled in lowercase
self.fit_field = self.fit_field.lower()
# Fields excluded from conflict warnings
no_conflict = set()
if isinstance(self.no_conflict, type):
no_conflict.add(self.fit_field)
no_conflict.add('part')
else:
for field in self.no_conflict:
no_conflict.add(field.lower())
self.no_conflict = no_conflict
# Columns
self.column_rename = {}
self.join = []

View File

@ -1302,6 +1302,7 @@ def test_int_bom_fil_dummy():
rows, header, info = ctx.load_csv(prj+'-bom.csv')
ref_column = header.index(REF_COLUMN_NAME)
check_kibom_test_netlist(rows, ref_column, 4, None, ['R1-R2', 'R3-R4', 'R5-R6', 'C1-C2'])
ctx.search_err('Field conflict', invert=True)
ctx.clean_up()
@ -1322,6 +1323,7 @@ def test_int_bom_fil_1():
check_kibom_test_netlist(rows, ref_column, 2, None, ['R1', 'C1-C2'])
rows, header, info = ctx.load_csv('multi.csv')
check_kibom_test_netlist(rows, ref_column, 1, None, ['C1-C2'])
ctx.search_err('Field conflict')
ctx.clean_up()

View File

@ -10,4 +10,5 @@ outputs:
options:
use_alt: true
exclude_filter: ''
no_conflict: ['bb']