A mechanism to avoid running some outputs by default.

Related to #112
This commit is contained in:
Salvador E. Tropea 2021-12-02 18:47:40 -03:00
parent 9885270f56
commit 70fb334856
9 changed files with 168 additions and 3 deletions

View File

@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Outputs can use the options of other outputs as base (extend them). (#112)
- Another experimental mechanism to change 3D models according to the variant.
(#103)
- A mechanism to avoid running some outputs by default. (#112)
### Changed
- Internal BoM: now components with different Tolerance, Voltage, Current

View File

@ -667,11 +667,14 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `boardview` output.
* Valid keys:
- `output`: [string='%f-%i%v.%x'] Filename for the output (%i=boardview, %x=brd). Affected by global options.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* BoM (Bill of Materials)
* Type: `bom`
@ -685,6 +688,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `bom` output.
@ -803,6 +808,7 @@ Next time you need this list just use an alias, like this:
- `max_col_width`: [number=60] [20,999] Maximum column width (characters).
- `style`: [string='modern-blue'] Head style: modern-blue, modern-green, modern-red and classic.
- `title`: [string='KiBot Bill of Materials'] BoM title.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* Archiver (files compressor)
* Type: `compress`
@ -811,6 +817,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `compress` output.
@ -826,6 +834,7 @@ Next time you need this list just use an alias, like this:
Note this pattern is applied to the output dir specified with -d comman line option.
- `format`: [string='ZIP'] [ZIP,TAR,RAR] Output file format.
- `output`: [string='%f-%i%v.%x'] Name for the generated archive (%i=name of the output %x=according to format). Affected by global options.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* DXF (Drawing Exchange Format)
* Type: `dxf`
@ -834,6 +843,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `layers`: [list(dict)|list(string)|string] [all,selected,copper,technical,user]
List of PCB layers to plot.
@ -870,6 +881,7 @@ Next time you need this list just use an alias, like this:
- `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions.
- `use_aux_axis_as_origin`: [boolean=false] Use the auxiliary axis as origin for coordinates.
- `variant`: [string=''] Board variant to apply.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* Excellon drill format
* Type: `excellon`
@ -879,6 +891,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `excellon` output.
@ -904,6 +918,7 @@ Next time you need this list just use an alias, like this:
- `route_mode_for_oval_holes`: Undocumented.
- `use_aux_axis_as_origin`: [boolean=false] Use the auxiliary axis as origin for coordinates.
- `zeros_format`: [string='DECIMAL_FORMAT'] [DECIMAL_FORMAT,SUPPRESS_LEADING,SUPPRESS_TRAILING,KEEP_ZEROS] How to handle the zeros.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* Gerber drill format
* Type: `gerb_drill`
@ -913,6 +928,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `gerb_drill` output.
@ -930,6 +947,7 @@ Next time you need this list just use an alias, like this:
- `filename`: [string=''] Name of the drill report. Not generated unless a name is specified.
(%i='drill_report' %x='txt').
- `use_aux_axis_as_origin`: [boolean=false] Use the auxiliary axis as origin for coordinates.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* Gerber format
* Type: `gerber`
@ -938,6 +956,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `layers`: [list(dict)|list(string)|string] [all,selected,copper,technical,user]
List of PCB layers to plot.
@ -980,6 +1000,7 @@ Next time you need this list just use an alias, like this:
- `use_gerber_x2_attributes`: [boolean=true] Use the extended X2 format (otherwise use X1 formerly RS-274X).
- `use_protel_extensions`: [boolean=false] Use legacy Protel file extensions.
- `variant`: [string=''] Board variant to apply.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* HPGL (Hewlett & Packard Graphics Language)
* Type: `hpgl`
@ -988,6 +1009,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `layers`: [list(dict)|list(string)|string] [all,selected,copper,technical,user]
List of PCB layers to plot.
@ -1026,6 +1049,7 @@ Next time you need this list just use an alias, like this:
- `tent_vias`: [boolean=true] Cover the vias.
- `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions.
- `variant`: [string=''] Board variant to apply.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* IBoM (Interactive HTML BoM)
* Type: `ibom`
@ -1035,6 +1059,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `ibom` output.
@ -1087,6 +1113,7 @@ Next time you need this list just use an alias, like this:
IBoM option, avoid using in conjunction with KiBot variants/filters.
- `variants_whitelist`: [string=''] List of board variants to include in the BOM.
IBoM option, avoid using in conjunction with KiBot variants/filters.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* KiBoM (KiCad Bill of Materials)
* Type: `kibom`
@ -1098,6 +1125,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `kibom` output.
@ -1181,6 +1210,7 @@ Next time you need this list just use an alias, like this:
with a BOM file exported for each variant, separate
variants with the ';' (semicolon) character.
This isn't related to the KiBot concept of variants.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* KiCost (KiCad Cost calculator)
* Type: `kicost`
@ -1190,6 +1220,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `kicost` output.
@ -1219,6 +1251,7 @@ Next time you need this list just use an alias, like this:
- `name`: [string=''] New name.
- `variant`: [string=''] Board variant to apply.
Internal variants and filters are currently ignored.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* PcbDraw - Beautiful 2D PCB render
* Type: `pcbdraw`
@ -1228,6 +1261,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `pcbdraw` output.
@ -1261,6 +1296,7 @@ Next time you need this list just use an alias, like this:
- `variant`: [string=''] Board variant to apply.
- `vcuts`: [boolean=false] Render V-CUTS on the Cmts.User layer.
- `warnings`: [string='visible'] [visible,all,none] Using visible only the warnings about components in the visible side are generated.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* PDF (Portable Document Format)
* Type: `pdf`
@ -1275,6 +1311,8 @@ Next time you need this list just use an alias, like this:
Use ${filename(LAYER)} for the file corresponding to LAYER.
- `output`: [string='Custom_report.txt'] File name for the custom report.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- `drill_marks`: [string='full'] what to use to indicate the drill places, can be none, small or full (for real scale).
@ -1324,6 +1362,7 @@ Next time you need this list just use an alias, like this:
- `plot_footprint_refs`: [boolean=true] Include the footprint references.
- `plot_footprint_values`: [boolean=true] Include the footprint values.
- `plot_sheet_reference`: [boolean=false] Currently without effect.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
- `tent_vias`: [boolean=true] Cover the vias.
- `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions.
- `variant`: [string=''] Board variant to apply.
@ -1336,6 +1375,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `layers`: [list(dict)|list(string)|string] [all,selected,copper,technical,user]
List of PCB layers to include in the PDF.
@ -1360,6 +1401,7 @@ Next time you need this list just use an alias, like this:
- `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
If it starts with `+` the text is concatenated.
- `variant`: [string=''] Board variant to apply.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* PDF Schematic Print (Portable Document Format)
* Type: `pdf_sch_print`
@ -1369,6 +1411,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `pdf_sch_print` output.
@ -1380,6 +1424,7 @@ Next time you need this list just use an alias, like this:
- `output`: [string='%f-%i%v.%x'] Filename for the output PDF (%i=schematic %x=pdf). Affected by global options.
- `variant`: [string=''] Board variant to apply.
Not fitted components are crossed.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* Pick & place
* Type: `position`
@ -1388,6 +1433,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `position` output.
@ -1406,6 +1453,7 @@ Next time you need this list just use an alias, like this:
- `units`: [string='millimeters'] [millimeters,inches] Units used for the positions.
- `use_aux_axis_as_origin`: [boolean=true] Use the auxiliary axis as origin for coordinates (KiCad default).
- `variant`: [string=''] Board variant to apply.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* PS (Postscript)
* Type: `ps`
@ -1414,6 +1462,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `layers`: [list(dict)|list(string)|string] [all,selected,copper,technical,user]
List of PCB layers to plot.
@ -1456,6 +1506,7 @@ Next time you need this list just use an alias, like this:
- `variant`: [string=''] Board variant to apply.
- `width_adjust`: [number=0] This width factor is intended to compensate PS printers/plotters that do not strictly obey line width settings.
Only used to plot pads and tracks.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* 3D render of the PCB
* Type: `render_3d`
@ -1463,6 +1514,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `render_3d` output.
@ -1497,6 +1550,7 @@ Next time you need this list just use an alias, like this:
- `width`: [number=1280] Image width (aprox.).
- `zoom`: [number=0] Zoom steps. Use positive to enlarge, get closer, and negative to reduce.
Same result as using the mouse wheel in the 3D viewer.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* Schematic with variant generator
* Type: `sch_variant`
@ -1506,6 +1560,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `sch_variant` output.
@ -1513,6 +1569,7 @@ Next time you need this list just use an alias, like this:
- `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- `variant`: [string=''] Board variant to apply.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* STEP (ISO 10303-21 Clear Text Encoding of the Exchange Structure)
* Type: `step`
@ -1522,6 +1579,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `step` output.
@ -1538,6 +1597,7 @@ Next time you need this list just use an alias, like this:
You can define any other origin using the format 'X,Y', i.e. '3.2,-10'.
- `output`: [string='%f-%i%v.%x'] Name for the generated STEP file (%i='3D' %x='step'). Affected by global options.
- `variant`: [string=''] Board variant to apply.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* SVG (Scalable Vector Graphics)
* Type: `svg`
@ -1547,6 +1607,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `layers`: [list(dict)|list(string)|string] [all,selected,copper,technical,user]
List of PCB layers to plot.
@ -1582,6 +1644,7 @@ Next time you need this list just use an alias, like this:
- `tent_vias`: [boolean=true] Cover the vias.
- `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions.
- `variant`: [string=''] Board variant to apply.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
* SVG Schematic Print
* Type: `svg_sch_print`
@ -1590,6 +1653,8 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `comment`: [string=''] A comment for documentation purposes.
- `dir`: [string='./'] Output directory for the generated files. If it starts with `+` the rest is concatenated to the default dir.
- `disable_run_by_default`: [string=''] Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original..
- `extends`: [string=''] Copy the options from the indicated output.
- `name`: [string=''] Used to identify this particular output definition.
- `options`: [dict] Options for the `svg_sch_print` output.
@ -1599,6 +1664,7 @@ Next time you need this list just use an alias, like this:
- `output`: [string='%f-%i%v.%x'] Filename for the output SVG (%i=schematic %x=svg). Affected by global options.
- `variant`: [string=''] Board variant to apply.
Not fitted components are crossed.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
#### Consolidating BoMs
@ -1899,7 +1965,8 @@ Note that this will use the `options` of the other output as base, not other dat
Also note that you can use YAML anchors, but this won't work if you are importing the base output from other file.
Additionally you must be aware that extending an output doesn't disable the base output.
For this reason you could need to deselect the base output from the command line.
If you need to disable the original output use `disable_run_by_default` option.
#### Importing filters and variants from another file
@ -2002,6 +2069,8 @@ If you want to generate all outputs with some exceptions use:
kibot --invert-sel OUTPUT_1 OUTPUT_2
```
Note that you can use the `run_by_default` option of the output you want to exclude from the default runs.
If you want to skip the DRC and ERC use:
```shell

View File

@ -817,7 +817,8 @@ Note that this will use the `options` of the other output as base, not other dat
Also note that you can use YAML anchors, but this won't work if you are importing the base output from other file.
Additionally you must be aware that extending an output doesn't disable the base output.
For this reason you could need to deselect the base output from the command line.
If you need to disable the original output use `disable_run_by_default` option.
#### Importing filters and variants from another file
@ -920,6 +921,8 @@ If you want to generate all outputs with some exceptions use:
kibot --invert-sel OUTPUT_1 OUTPUT_2
```
Note that you can use the `run_by_default` option of the output you want to exclude from the default runs.
If you want to skip the DRC and ERC use:
```shell

View File

@ -38,6 +38,7 @@ class CfgYamlReader(object):
def __init__(self):
super().__init__()
self.imported_globals = {}
self.no_run_by_default = []
def _check_version(self, v):
if not isinstance(v, dict):
@ -86,6 +87,16 @@ class CfgYamlReader(object):
o_out.type = otype
o_out.comment = comment
o_out.extends = o_tree.get('extends', '')
# Pre-parse the run_by_default option
o_out.run_by_default = o_tree.get('run_by_default', True)
if not isinstance(o_out.run_by_default, bool):
o_out.run_by_default = True
o_out.disable_run_by_default = o_tree.get('disable_run_by_default', '')
# Pre-parse the disable_run_by_default option
if not isinstance(o_out.disable_run_by_default, str):
o_out.disable_run_by_default = ''
elif o_out.disable_run_by_default:
self.no_run_by_default.append(o_out.disable_run_by_default)
return o_out
@ -406,6 +417,13 @@ class CfgYamlReader(object):
GS.solved_global_variant = RegOutput.check_variant(GS.global_variant)
except KiPlotConfigurationError as e:
config_error("In global section: "+str(e))
# Ok, now we have all the outputs loaded, so we can apply the disable_run_by_default
for name in self.no_run_by_default:
o = RegOutput.get_output(name)
if o:
o.run_by_default = False
logger.debug("Disabling the default run for `{}`".format(o))
return RegOutput.get_outputs()

View File

@ -359,7 +359,9 @@ def generate_outputs(outputs, target, invert, skip_pre):
return
# Generate outputs
for out in outputs:
if (n == 0) or ((out.name in target) ^ invert):
if (((n == 0 or ((out.name not in target) and invert)) and out.run_by_default) or
((out.name in target) and not invert)):
# Exclude
config_output(out)
logger.info('- '+str(out))
run_output(out)

View File

@ -37,6 +37,11 @@ class BaseOutput(RegOutput):
""" A comment for documentation purposes """
self.extends = ''
""" Copy the options from the indicated output """
self.run_by_default = True
""" When enabled this output will be created when no specific outputs are requested """
self.disable_run_by_default = ''
""" Use it to disable the `run_by_default` status of other output.
Useful when this output extends another and you don't want to generate the original. """
if GS.global_dir:
self.dir = GS.global_dir
self._sch_related = False
@ -88,6 +93,11 @@ class BaseOutput(RegOutput):
self._tree['options'] = options
# logger.error("New options: "+str(options))
super().config(parent)
to_dis = self.disable_run_by_default
if to_dis:
out = RegOutput.get_output(to_dis)
if out is None:
raise KiPlotConfigurationError('Unknown output `{}` in `disable_run_by_default`'.format(to_dis))
if self.dir[0] == '+':
self.dir = (GS.global_dir if GS.global_dir is not None else './') + self.dir[1:]
if getattr(self, 'options', None) and isinstance(self.options, type):

View File

@ -836,3 +836,23 @@ def test_import_3(test_dir):
ctx.run(extra=['position_mine'])
ctx.expect_out_file(POS_DIR+'/test_v5_(both_pos).csv')
ctx.clean_up()
def test_import_4(test_dir):
""" Import an output and change it, also disable the original """
prj = 'test_v5'
ctx = context.TestContext(test_dir, 'test_import_4', prj, 'import_test_4', '')
ctx.run(extra=[])
ctx.expect_out_file(POS_DIR+'/test_v5_(both_pos).csv')
ctx.dont_expect_out_file(POS_DIR+'/test_v5_(bottom_pos).csv')
ctx.clean_up()
def test_disable_default_1(test_dir):
""" Disable in the same file and out-of-order """
prj = 'test_v5'
ctx = context.TestContext(test_dir, 'test_disable_default_1', prj, 'disable_default_1', '')
ctx.run(extra=[])
ctx.expect_out_file(POS_DIR+'/test_v5_(both_pos).csv')
ctx.dont_expect_out_file(POS_DIR+'/test_v5_(bottom_pos).csv')
ctx.clean_up()

View File

@ -0,0 +1,24 @@
kibot:
version: 1
global:
output: '%f_(%i).%x'
outputs:
- name: 'position_mine'
comment: "Pick and place file"
type: position
dir: positiondir
extends: position
disable_run_by_default: position
options:
separate_files_for_front_and_back: false
- name: 'position'
type: position
dir: positiondir
options:
format: CSV # CSV or ASCII format
units: millimeters # millimeters or inches
separate_files_for_front_and_back: true
only_smd: true

View File

@ -0,0 +1,18 @@
kibot:
version: 1
import:
# Here we change the global.output pattern
- file: global_import.kibot.yaml
- simple_position_csv.kibot.yaml
outputs:
- name: 'position_mine'
comment: "Pick and place file"
type: position
dir: positiondir
extends: position
disable_run_by_default: position
options:
separate_files_for_front_and_back: false