parent
49ea1bb62a
commit
f9a2aac01b
|
|
@ -35,6 +35,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- JLCPCB example, to match current recommendations
|
- JLCPCB example, to match current recommendations
|
||||||
(g200kg/kicad-gerberzipper#11)
|
(g200kg/kicad-gerberzipper#11)
|
||||||
- Internal BoM: the field used for variants doesn't produce conflicts. (#100)
|
- Internal BoM: the field used for variants doesn't produce conflicts. (#100)
|
||||||
|
- The `%v/%V` expansion patterns now expand to the global variant when used in
|
||||||
|
a context not related to variants. I.e. when a `compress` target expands
|
||||||
|
`%v`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Position files now defaults to use the auxiliar origin as KiCad.
|
- Position files now defaults to use the auxiliar origin as KiCad.
|
||||||
|
|
|
||||||
|
|
@ -209,8 +209,8 @@ The pattern uses the following expansions:
|
||||||
- **%r** revision from pcb/sch metadata.
|
- **%r** revision from pcb/sch metadata.
|
||||||
- **%T** time the script was started.
|
- **%T** time the script was started.
|
||||||
- **%x** a suitable extension for the output type.
|
- **%x** a suitable extension for the output type.
|
||||||
- **%v** the `file_id` of the current variant.
|
- **%v** the `file_id` of the current variant, or the global variant if outside a variant scope.
|
||||||
- **%V** the `name` of the current variant.
|
- **%V** the `name` of the current variant, or the global variant if outside a variant scope.
|
||||||
|
|
||||||
They are compatible with the ones used by IBoM.
|
They are compatible with the ones used by IBoM.
|
||||||
The default value for `global.output` is `%f-%i.%x`.
|
The default value for `global.output` is `%f-%i.%x`.
|
||||||
|
|
|
||||||
|
|
@ -188,8 +188,8 @@ The pattern uses the following expansions:
|
||||||
- **%r** revision from pcb/sch metadata.
|
- **%r** revision from pcb/sch metadata.
|
||||||
- **%T** time the script was started.
|
- **%T** time the script was started.
|
||||||
- **%x** a suitable extension for the output type.
|
- **%x** a suitable extension for the output type.
|
||||||
- **%v** the `file_id` of the current variant.
|
- **%v** the `file_id` of the current variant, or the global variant if outside a variant scope.
|
||||||
- **%V** the `name` of the current variant.
|
- **%V** the `name` of the current variant, or the global variant if outside a variant scope.
|
||||||
|
|
||||||
They are compatible with the ones used by IBoM.
|
They are compatible with the ones used by IBoM.
|
||||||
The default value for `global.output` is `%f-%i.%x`.
|
The default value for `global.output` is `%f-%i.%x`.
|
||||||
|
|
|
||||||
|
|
@ -355,6 +355,9 @@ class CfgYamlReader(object):
|
||||||
config_error('Unknown section `{}` in config.'.format(k))
|
config_error('Unknown section `{}` in config.'.format(k))
|
||||||
if version is None:
|
if version is None:
|
||||||
config_error("YAML config needs `kibot.version`.")
|
config_error("YAML config needs `kibot.version`.")
|
||||||
|
# Solve the global variant
|
||||||
|
if GS.global_variant:
|
||||||
|
GS.solved_global_variant = RegOutput.check_variant(GS.global_variant)
|
||||||
return outputs
|
return outputs
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ class GS(object):
|
||||||
global_output = None
|
global_output = None
|
||||||
global_dir = None
|
global_dir = None
|
||||||
global_variant = None
|
global_variant = None
|
||||||
|
solved_global_variant = None
|
||||||
global_kiauto_wait_start = None
|
global_kiauto_wait_start = None
|
||||||
global_kiauto_time_out_scale = None
|
global_kiauto_time_out_scale = None
|
||||||
global_opts_class = None
|
global_opts_class = None
|
||||||
|
|
|
||||||
|
|
@ -190,21 +190,29 @@ class Optionable(object):
|
||||||
|
|
||||||
def _find_variant(self):
|
def _find_variant(self):
|
||||||
""" Returns the text to add for the current variant.
|
""" Returns the text to add for the current variant.
|
||||||
|
Also try with the globally defined variant.
|
||||||
If no variant is defined an empty string is returned. """
|
If no variant is defined an empty string is returned. """
|
||||||
if hasattr(self, 'variant') and self.variant and hasattr(self.variant, 'file_id'):
|
if hasattr(self, 'variant') and self.variant and hasattr(self.variant, 'file_id'):
|
||||||
return self.variant.file_id
|
return self.variant.file_id
|
||||||
|
if GS.solved_global_variant:
|
||||||
|
return GS.solved_global_variant.file_id
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def _find_variant_name(self):
|
def _find_variant_name(self):
|
||||||
""" Returns the name for the current variant.
|
""" Returns the name for the current variant.
|
||||||
|
Also try with the globally defined variant.
|
||||||
If no variant is defined an empty string is returned. """
|
If no variant is defined an empty string is returned. """
|
||||||
if hasattr(self, 'variant') and self.variant and hasattr(self.variant, 'name'):
|
if hasattr(self, 'variant') and self.variant and hasattr(self.variant, 'name'):
|
||||||
return self.variant.name
|
return self.variant.name
|
||||||
|
if GS.solved_global_variant:
|
||||||
|
return GS.solved_global_variant.name
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def expand_filename_pcb(self, name):
|
def expand_filename_pcb(self, name):
|
||||||
""" Expands %* values in filenames.
|
""" Expands %* values in filenames.
|
||||||
Uses data from the PCB. """
|
Uses data from the PCB. """
|
||||||
|
if GS.debug_level > 3:
|
||||||
|
logger.debug('Expanding `{}` in PCB context for {} parent: {}'.format(name, self, self._parent))
|
||||||
if GS.board:
|
if GS.board:
|
||||||
GS.load_pcb_title_block()
|
GS.load_pcb_title_block()
|
||||||
# Do the replacements
|
# Do the replacements
|
||||||
|
|
@ -223,11 +231,15 @@ class Optionable(object):
|
||||||
# sanitize the name to avoid characters illegal in file systems
|
# sanitize the name to avoid characters illegal in file systems
|
||||||
name = name.replace('\\', '/')
|
name = name.replace('\\', '/')
|
||||||
name = re.sub(r'[?%*:|"<>]', '_', name)
|
name = re.sub(r'[?%*:|"<>]', '_', name)
|
||||||
|
if GS.debug_level > 3:
|
||||||
|
logger.debug('Expanded `{}`'.format(name))
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def expand_filename_sch(self, name):
|
def expand_filename_sch(self, name):
|
||||||
""" Expands %* values in filenames.
|
""" Expands %* values in filenames.
|
||||||
Uses data from the SCH. """
|
Uses data from the SCH. """
|
||||||
|
if GS.debug_level > 3:
|
||||||
|
logger.debug('Expanding `{}` in sch context for {}'.format(name, self))
|
||||||
if GS.sch_file:
|
if GS.sch_file:
|
||||||
GS.load_sch_title_block()
|
GS.load_sch_title_block()
|
||||||
# Do the replacements
|
# Do the replacements
|
||||||
|
|
@ -246,6 +258,8 @@ class Optionable(object):
|
||||||
# sanitize the name to avoid characters illegal in file systems
|
# sanitize the name to avoid characters illegal in file systems
|
||||||
name = name.replace('\\', '/')
|
name = name.replace('\\', '/')
|
||||||
name = re.sub(r'[?%*:|"<>]', '_', name)
|
name = re.sub(r'[?%*:|"<>]', '_', name)
|
||||||
|
if GS.debug_level > 3:
|
||||||
|
logger.debug('Expanded `{}`'.format(name))
|
||||||
return name
|
return name
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue