Merge branch 'hkleen-feature_variable_expansion'

This commit is contained in:
Salvador E. Tropea 2022-07-11 12:42:32 -03:00
commit b59a77d900
5 changed files with 12 additions and 4 deletions

View File

@ -1844,7 +1844,7 @@ Notes:
- **`format`**: [string='HTML'] [HTML,CSV,XML,XLSX] Format for the BoM. - **`format`**: [string='HTML'] [HTML,CSV,XML,XLSX] Format for the BoM.
- **`number`**: [number=1] Number of boards to build (components multiplier). - **`number`**: [number=1] Number of boards to build (components multiplier).
- **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i=bom). Affected by global options. - **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i=bom). Affected by global options.
- `conf`: [string|dict] BoM configuration file, relative to PCB. - `conf`: [string|dict] BoM configuration file, relative to PCB. Environment variables and ~ allowed.
You can also define the configuration here, will be stored in `config.kibom.ini`. You can also define the configuration here, will be stored in `config.kibom.ini`.
* Valid keys: * Valid keys:
- **`columns`**: [list(dict)|list(string)] List of columns to display. - **`columns`**: [list(dict)|list(string)] List of columns to display.
@ -2588,6 +2588,7 @@ Notes:
In Debian/Ubuntu environments: install `pandoc`, `texlive-latex-base` and `texlive-latex-recommended`. In Debian/Ubuntu environments: install `pandoc`, `texlive-latex-base` and `texlive-latex-recommended`.
- **`output`**: [string='%f-%i%I%v.%x'] Output file name (%i='report', %x='txt'). Affected by global options. - **`output`**: [string='%f-%i%I%v.%x'] Output file name (%i='report', %x='txt'). Affected by global options.
- **`template`**: [string='full'] Name for one of the internal templates (full, full_svg, simple) or a custom template file. - **`template`**: [string='full'] Name for one of the internal templates (full, full_svg, simple) or a custom template file.
Environment variables and ~ are allowed.
Note: when converting to PDF PanDoc can fail on some Unicode values (use `simple_ASCII`). Note: when converting to PDF PanDoc can fail on some Unicode values (use `simple_ASCII`).
- `convert_from`: [string='markdown'] Original format for the report conversion. Current templates are `markdown`. See `do_convert`. - `convert_from`: [string='markdown'] Original format for the report conversion. Current templates are `markdown`. See `do_convert`.
- `converted_output`: [string='%f-%i%I%v.%x'] Converted output file name (%i='report', %x=`convert_to`). - `converted_output`: [string='%f-%i%I%v.%x'] Converted output file name (%i='report', %x=`convert_to`).

View File

@ -797,7 +797,7 @@ outputs:
type: 'kibom' type: 'kibom'
dir: 'Example/kibom_dir' dir: 'Example/kibom_dir'
options: options:
# [string|dict] BoM configuration file, relative to PCB. # [string|dict] BoM configuration file, relative to PCB. Environment variables and ~ allowed.
# You can also define the configuration here, will be stored in `config.kibom.ini` # You can also define the configuration here, will be stored in `config.kibom.ini`
conf: conf:
# [list(dict)|list(string)] List of columns to display. # [list(dict)|list(string)] List of columns to display.
@ -1546,6 +1546,7 @@ outputs:
# [string='%f-%i%I%v.%x'] Output file name (%i='report', %x='txt'). Affected by global options # [string='%f-%i%I%v.%x'] Output file name (%i='report', %x='txt'). Affected by global options
output: '%f-%i%I%v.%x' output: '%f-%i%I%v.%x'
# [string='full'] Name for one of the internal templates (full, full_svg, simple) or a custom template file. # [string='full'] Name for one of the internal templates (full, full_svg, simple) or a custom template file.
# Environment variables and ~ are allowed.
# Note: when converting to PDF PanDoc can fail on some Unicode values (use `simple_ASCII`) # Note: when converting to PDF PanDoc can fail on some Unicode values (use `simple_ASCII`)
template: 'full' template: 'full'
# Schematic with variant generator: # Schematic with variant generator:

View File

@ -357,6 +357,7 @@ class CfgYamlReader(object):
config_error("`import` entry without `file` ({})".format(str(entry))) config_error("`import` entry without `file` ({})".format(str(entry)))
else: else:
config_error("`import` items must be strings or dicts ({})".format(str(entry))) config_error("`import` items must be strings or dicts ({})".format(str(entry)))
fn = os.path.expandvars(os.path.expanduser(fn))
if not os.path.isabs(fn): if not os.path.isabs(fn):
fn = os.path.join(dir, fn) fn = os.path.join(dir, fn)
if not os.path.isfile(fn): if not os.path.isfile(fn):

View File

@ -342,7 +342,7 @@ class KiBoMOptions(BaseOptions):
variants with the ';' (semicolon) character. variants with the ';' (semicolon) character.
This isn't related to the KiBot concept of variants """ This isn't related to the KiBot concept of variants """
self.conf = KiBoMConfig self.conf = KiBoMConfig
""" [string|dict] BoM configuration file, relative to PCB. """ [string|dict] BoM configuration file, relative to PCB. Environment variables and ~ allowed.
You can also define the configuration here, will be stored in `config.kibom.ini` """ You can also define the configuration here, will be stored in `config.kibom.ini` """
self.separator = ',' self.separator = ','
""" CSV Separator """ """ CSV Separator """
@ -378,7 +378,9 @@ class KiBoMOptions(BaseOptions):
kibom_command = self.ensure_tool('KiBoM') kibom_command = self.ensure_tool('KiBoM')
format = self.format.lower() format = self.format.lower()
prj = GS.sch_no_ext prj = GS.sch_no_ext
config = os.path.join(GS.sch_dir, self.conf) config = os.path.expandvars(os.path.expanduser(self.conf))
if not os.path.isabs(config):
config = os.path.join(GS.sch_dir, config)
if self.output: if self.output:
force_output = True force_output = True
output = name output = name

View File

@ -177,6 +177,7 @@ class ReportOptions(BaseOptions):
""" *Output file name (%i='report', %x='txt') """ """ *Output file name (%i='report', %x='txt') """
self.template = 'full' self.template = 'full'
""" *Name for one of the internal templates (full, full_svg, simple) or a custom template file. """ *Name for one of the internal templates (full, full_svg, simple) or a custom template file.
Environment variables and ~ are allowed.
Note: when converting to PDF PanDoc can fail on some Unicode values (use `simple_ASCII`) """ Note: when converting to PDF PanDoc can fail on some Unicode values (use `simple_ASCII`) """
self.convert_from = 'markdown' self.convert_from = 'markdown'
""" Original format for the report conversion. Current templates are `markdown`. See `do_convert` """ """ Original format for the report conversion. Current templates are `markdown`. See `do_convert` """
@ -212,6 +213,8 @@ class ReportOptions(BaseOptions):
if self.template.lower() in ('full', 'simple', 'full_svg'): if self.template.lower() in ('full', 'simple', 'full_svg'):
self.template = os.path.abspath(os.path.join(os.path.dirname(__file__), 'report_templates', self.template = os.path.abspath(os.path.join(os.path.dirname(__file__), 'report_templates',
'report_'+self.template.lower()+'.txt')) 'report_'+self.template.lower()+'.txt'))
if not os.path.isabs(self.template):
self.template = os.path.expandvars(os.path.expanduser(self.template))
if not os.path.isfile(self.template): if not os.path.isfile(self.template):
raise KiPlotConfigurationError("Missing report template: `{}`".format(self.template)) raise KiPlotConfigurationError("Missing report template: `{}`".format(self.template))
m = re.match(r'(\d+)([A-F])', self.eurocircuits_class_target) m = re.match(r'(\d+)([A-F])', self.eurocircuits_class_target)