From ef04782a9aa2a103a6065305f882f3f6ee53797f Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 18 May 2023 09:07:17 -0300 Subject: [PATCH] [Groups][Added] outputs can request to be added to one or more groups - Also list groups - Allow empty groups so the user can catch typos Closes #435 --- CHANGELOG.md | 4 ++ README.md | 156 +++++++++++++++++++++++++++++++++++++++-- kibot/__main__.py | 49 ++++++++----- kibot/config_reader.py | 30 +++++--- kibot/misc.py | 1 + kibot/out_base.py | 5 ++ kibot/registrable.py | 17 +++++ 7 files changed, 228 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39283e84..3e5f4504 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - General: - OS environment expansion in ${VAR} + - Now outputs can request to be added to one or more groups (#435) - Command line: - `--list-variants` List all available variants (See #434) - `--only-names` to make `--list` list only output names - `--only-pre` to list only the preflights + - `--only-groups` to list only the groups - Global options: - `use_os_env_for_expand` to disable OS environment expansion - `environment`.`extra_os` to define environment variables @@ -33,6 +35,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `_value_split_replace` splits the Value field and replaces it ### Changed +- Command line: + - `--list` also lists groups - KiCad v6/7 schematic: - The hierarchy is expanded only if needed, i.e. value of an instance changed - List actions: diff --git a/README.md b/README.md index 4f4ad4c7..63fbf7b0 100644 --- a/README.md +++ b/README.md @@ -1780,6 +1780,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -1813,6 +1816,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2047,6 +2053,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2091,6 +2100,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=10] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2151,6 +2163,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=11] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2231,6 +2246,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2267,6 +2285,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2339,6 +2360,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2379,6 +2403,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2432,6 +2459,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2470,6 +2500,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2515,6 +2548,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2589,6 +2625,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2661,6 +2700,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2703,6 +2745,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2789,6 +2834,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2819,6 +2867,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2931,6 +2982,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -2990,6 +3044,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -3074,6 +3131,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -3100,6 +3160,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=10] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -3136,6 +3199,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -3467,6 +3533,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -3518,6 +3587,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -3653,6 +3725,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -3690,6 +3765,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -3800,6 +3878,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -3892,6 +3973,9 @@ Notes: - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. - `force_plot_invisible_refs_vals`: [boolean=false] Include references and values even when they are marked as invisible. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `individual_page_scaling`: [boolean=true] Tell KiCad to apply the scaling for each layer as a separated entity. Disabling it the pages are coherent and can be superposed. - `inner_extension_pattern`: [string=''] Used to change the Protel style extensions for inner layers. @@ -3964,6 +4048,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4005,6 +4092,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4041,6 +4131,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4087,6 +4180,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4133,6 +4229,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4210,6 +4309,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4250,6 +4352,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4294,6 +4399,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=90] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4381,6 +4489,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4426,6 +4537,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4461,6 +4575,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4515,6 +4632,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4570,6 +4690,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4617,6 +4740,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4708,6 +4834,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4766,6 +4895,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4807,6 +4939,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -4864,6 +4999,9 @@ Notes: Use the boolean true value to disable the output you are extending. - `extends`: [string=''] Copy the `options` section from the indicated output. Used to inherit options from another output of the same type. + - `groups`: [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. @@ -5533,9 +5671,10 @@ Usage: [-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ... [-E DEF] ... [-w LIST] [--banner N] [TARGET...] kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N] - [-E DEF] [--config-outs] [--only-pre] [--only-names] ... --list - kibot [-v...] [-c PLOT_CONFIG] [--banner N] [-E DEF] [--only-names] ... - --list-variants + [-E DEF] ... [--config-outs] [--only-pre|--only-groups] [--only-names] + --list + kibot [-v...] [-c PLOT_CONFIG] [--banner N] [-E DEF] ... [--only-names] + --list-variants kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [--banner N] [-t, --type TYPE]... --quick-start @@ -5567,7 +5706,8 @@ Options: -E DEF, --define DEF Define preprocessor value (VAR=VAL) -g DEF, --global-redef DEF Overwrite a global value (VAR=VAL) -i, --invert-sel Generate the outputs not listed as targets - -l, --list List available outputs (in the config file). + -l, --list List available outputs, preflights and + groups (in the config file). You don't need to specify an SCH/PCB unless using --config-outs --list-variants List the available variants and exit @@ -5576,9 +5716,11 @@ Options: -m MKFILE, --makefile MKFILE Generate a Makefile (no targets created) -n, --no-priority Don't sort targets by priority -p, --copy-options Copy plot options from the PCB file - --only-names Print only the names - --only-pre Print only the preflights. Note that - `--only-names` alone prints only the outputs + --only-names Print only the names. Note that for --list + if no other --only-* option is provided it + also acts as a virtual --only-outputs + --only-groups Print only the groups. + --only-pre Print only the preflights -P, --copy-and-expand As -p but expand the list of layers -q, --quiet Remove information logs -s PRE, --skip-pre PRE Skip preflights, comma separated or `all` diff --git a/kibot/__main__.py b/kibot/__main__.py index 9a179c2a..71e163c2 100644 --- a/kibot/__main__.py +++ b/kibot/__main__.py @@ -12,9 +12,10 @@ Usage: [-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ... [-E DEF] ... [-w LIST] [--banner N] [TARGET...] kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N] - [-E DEF] [--config-outs] [--only-pre] [--only-names] ... --list - kibot [-v...] [-c PLOT_CONFIG] [--banner N] [-E DEF] [--only-names] ... - --list-variants + [-E DEF] ... [--config-outs] [--only-pre|--only-groups] [--only-names] + --list + kibot [-v...] [-c PLOT_CONFIG] [--banner N] [-E DEF] ... [--only-names] + --list-variants kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [--banner N] [-t, --type TYPE]... --quick-start @@ -46,7 +47,8 @@ Options: -E DEF, --define DEF Define preprocessor value (VAR=VAL) -g DEF, --global-redef DEF Overwrite a global value (VAR=VAL) -i, --invert-sel Generate the outputs not listed as targets - -l, --list List available outputs (in the config file). + -l, --list List available outputs, preflights and + groups (in the config file). You don't need to specify an SCH/PCB unless using --config-outs --list-variants List the available variants and exit @@ -55,9 +57,11 @@ Options: -m MKFILE, --makefile MKFILE Generate a Makefile (no targets created) -n, --no-priority Don't sort targets by priority -p, --copy-options Copy plot options from the PCB file - --only-names Print only the names - --only-pre Print only the preflights. Note that - `--only-names` alone prints only the outputs + --only-names Print only the names. Note that for --list + if no other --only-* option is provided it + also acts as a virtual --only-outputs + --only-groups Print only the groups. + --only-pre Print only the preflights -P, --copy-and-expand As -p but expand the list of layers -q, --quiet Remove information logs -s PRE, --skip-pre PRE Skip preflights, comma separated or `all` @@ -127,7 +131,7 @@ from .registrable import RegOutput GS.kibot_version = __version__ -def list_pre_and_outs_names(logger, outputs, do_config, only_pre): +def list_pre_and_outs_names(logger, outputs, do_config, only_pre, only_groups): pf = BasePreFlight.get_in_use_names() if len(pf) and only_pre: for c in pf: @@ -140,17 +144,17 @@ def list_pre_and_outs_names(logger, outputs, do_config, only_pre): logger.info(o.name) -def list_pre_and_outs(logger, outputs, do_config, only_names, only_pre): +def list_pre_and_outs(logger, outputs, do_config, only_names, only_pre, only_groups): if only_names: - return list_pre_and_outs_names(logger, outputs, do_config, only_pre) + return list_pre_and_outs_names(logger, outputs, do_config, only_pre, only_groups) pf = BasePreFlight.get_in_use_objs() - if len(pf): + groups = RegOutput.get_groups() + if pf and not only_groups: logger.info('Available pre-flights:') for c in pf: logger.info('- '+str(c)) - if len(outputs) and not only_pre: - logger.info("") - if len(outputs) and not only_pre: + logger.info("") + if outputs and not only_pre and not only_groups: logger.info("Available outputs: 'comment/description' (name) [type]") for o in outputs: # Note: we can't do a `dry` config because some layer and field names can be validated only if we @@ -158,14 +162,23 @@ def list_pre_and_outs(logger, outputs, do_config, only_names, only_pre): if do_config: config_output(o, dry=False) logger.info('- '+str(o)) - if len(pf): logger.info("") + if groups and not only_pre: + logger.info("Available groups:") + for g, items in groups.items(): + logger.info('- '+g+': '+', '.join(items)) + logger.info("") + if pf: logger.info("You can use e.g. `kibot --skip-pre preflight_name1,preflight_name2` to") logger.info("skip specific preflights (or pass `all` to skip them all).") - if len(outputs): logger.info("") - logger.info("You can use e.g. `kibot output_name1 output_name1` to generate only") + if outputs: + logger.info("You can use e.g. `kibot output_name1 output_name2` to generate only") logger.info("specific outputs by name.") + logger.info("") + if groups: + logger.info("You can use the name of a group instead of an output name.") + logger.info("") def list_variants(logger, only_names): @@ -482,7 +495,7 @@ def main(): # Is just "list the available targets"? if args.list: - list_pre_and_outs(logger, outputs, args.config_outs, args.only_names, args.only_pre) + list_pre_and_outs(logger, outputs, args.config_outs, args.only_names, args.only_pre, args.only_groups) sys.exit(0) if args.list_variants: diff --git a/kibot/config_reader.py b/kibot/config_reader.py index d9dfce83..e725c82d 100644 --- a/kibot/config_reader.py +++ b/kibot/config_reader.py @@ -10,6 +10,7 @@ Class to read KiBot config files """ import collections +import difflib import io import os import json @@ -18,7 +19,7 @@ from collections import OrderedDict from .error import KiPlotConfigurationError, config_error from .misc import (NO_YAML_MODULE, EXIT_BAD_ARGS, EXAMPLE_CFG, WONT_OVERWRITE, W_NOOUTPUTS, W_UNKOUT, W_NOFILTERS, - W_NOVARIANTS, W_NOGLOBALS, TRY_INSTALL_CHECK, W_NOPREFLIGHTS, W_NOGROUPS) + W_NOVARIANTS, W_NOGLOBALS, TRY_INSTALL_CHECK, W_NOPREFLIGHTS, W_NOGROUPS, W_NEWGROUP) from .gs import GS from .registrable import RegOutput, RegVariant, RegFilter, RegDependency from .pre_base import BasePreFlight @@ -150,6 +151,10 @@ class CfgYamlReader(object): self.no_run_by_default.append(o_out.extends) else: o_out.disable_run_by_default = '' + # Pre-parse the groups + o_out.groups = o_tree.get('groups', []) + if isinstance(o_out.groups, str): + o_out.groups = [o_out.groups] return o_out def _parse_outputs(self, v): @@ -168,12 +173,7 @@ class CfgYamlReader(object): raise KeyError except KeyError: raise KiPlotConfigurationError("Group needs a name in: "+str(tree)) - try: - outs = tree['outputs'] - if not outs: - raise KeyError - except KeyError: - raise KiPlotConfigurationError("Group `"+name+"` must contain outputs") + outs = tree.get('outputs', []) if not isinstance(outs, list): raise KiPlotConfigurationError("'outputs' in group `"+name+"` must be a list (not {})".format(type(outs))) for v in outs: @@ -665,8 +665,20 @@ class CfgYamlReader(object): if o: o.run_by_default = False logger.debug("Disabling the default run for `{}`".format(o)) - - return RegOutput.get_outputs() + # Apply the groups selection from the outputs + outs = RegOutput.get_outputs() + for o in outs: + for g in o.groups: + if not RegOutput.add_to_group(o.name, g): + grps = list(RegOutput.get_group_names()) + grps.remove(g) + best_matches = difflib.get_close_matches(g, grps) + logger.warning(W_NEWGROUP+'Added {} to a new group `{}`'.format(o, g)) + if best_matches: + logger.warning(W_NEWGROUP+"Did you mean {}?".format(' or '.join(best_matches))) + else: + logger.warning(W_NEWGROUP+"Suggestion: declare it first so we know it isn't a typo") + return outs def trim(docstring): diff --git a/kibot/misc.py b/kibot/misc.py index b2bffafa..3f1cf0f0 100644 --- a/kibot/misc.py +++ b/kibot/misc.py @@ -280,6 +280,7 @@ W_ESCINV = '(W126) ' W_BADVAL4 = '(W127) ' W_ENVEXIST = '(W128) ' W_FLDCOLLISION = '(W129) ' +W_NEWGROUP = '(W130) ' # Somehow arbitrary, the colors are real, but can be different PCB_MAT_COLORS = {'fr1': "937042", 'fr2': "949d70", 'fr3': "adacb4", 'fr4': "332B16", 'fr5': "6cc290"} PCB_FINISH_COLORS = {'hal': "8b898c", 'hasl': "8b898c", 'imag': "8b898c", 'enig': "cfb96e", 'enepig': "cfb96e", diff --git a/kibot/out_base.py b/kibot/out_base.py index a6233fd1..ae6732af 100644 --- a/kibot/out_base.py +++ b/kibot/out_base.py @@ -85,6 +85,10 @@ class BaseOutput(RegOutput): self.priority = 50 """ [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs """ + self.groups = Optionable + """ [string|list(string)=''] One or more groups to add this output. In order to catch typos + we recommend to add outputs only to existing groups. You can create an empty group if + needed """ if GS.global_dir: self.dir = GS.global_dir self._sch_related = False @@ -161,6 +165,7 @@ class BaseOutput(RegOutput): self.category = self.force_list(self.category) if not self.category: self.category = self._category + self.groups = self.force_list(self.groups, comma_sep=False) def expand_dirname(self, out_dir): return self.options.expand_filename_both(out_dir, is_sch=self._sch_related) diff --git a/kibot/registrable.py b/kibot/registrable.py index 80f58daf..8d71ea5d 100644 --- a/kibot/registrable.py +++ b/kibot/registrable.py @@ -145,6 +145,23 @@ class RegOutput(Optionable, Registrable): for n, lst in objs.items(): RegOutput.add_group(n, lst, file) + @staticmethod + def add_to_group(out, group): + items = RegOutput._def_groups.get(group) + if items is not None: + if out not in items: + items.append(out) + return True + RegOutput.add_group(group, [out]) + + @staticmethod + def get_groups(): + return RegOutput._def_groups + + @staticmethod + def get_group_names(): + return RegOutput._def_groups.keys() + @staticmethod def get_outputs(): return RegOutput._def_outputs.values()