Fixed compress: not expanding %VALUES in target dirs.

Fixes #111
This commit is contained in:
Salvador E. Tropea 2021-11-19 10:15:58 -03:00
parent 22b946ecf1
commit dd265fa2e0
3 changed files with 8 additions and 3 deletions

View File

@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- KiCost variants: problems when setting a field in a variant that doesn't - KiCost variants: problems when setting a field in a variant that doesn't
exist when no variant is selected. (#105) exist when no variant is selected. (#105)
- PCB Print: to show the real name of the PCB file. (#102) - PCB Print: to show the real name of the PCB file. (#102)
- Compress: not expanding %VALUES in target dirs. (#111)
## [0.11.0] - 2021-04-25 ## [0.11.0] - 2021-04-25

View File

@ -36,6 +36,7 @@ class BaseOutput(RegOutput):
if GS.global_dir: if GS.global_dir:
self.dir = GS.global_dir self.dir = GS.global_dir
self._sch_related = False self._sch_related = False
self._both_related = False
self._unkown_is_error = True self._unkown_is_error = True
self._done = False self._done = False
@ -45,11 +46,11 @@ class BaseOutput(RegOutput):
def is_sch(self): def is_sch(self):
""" True for outputs that works on the schematic """ """ True for outputs that works on the schematic """
return self._sch_related return self._sch_related or self._both_related
def is_pcb(self): def is_pcb(self):
""" True for outputs that works on the PCB """ """ True for outputs that works on the PCB """
return not self._sch_related return (not self._sch_related) or self._both_related
def get_targets(self, out_dir): def get_targets(self, out_dir):
""" Returns a list of targets generated by this output """ """ Returns a list of targets generated by this output """

View File

@ -125,7 +125,7 @@ class CompressOptions(BaseOptions):
for out in GS.outputs: for out in GS.outputs:
if out.name == f.from_output: if out.name == f.from_output:
config_output(out) config_output(out)
files_list = out.get_targets(get_output_dir(out.dir, dry=True)) files_list = out.get_targets(get_output_dir(out.expand_dirname(out.dir), dry=True))
break break
if files_list is None: if files_list is None:
logger.error('Unknown output `{}` selected in {}'.format(f.from_output, self._parent)) logger.error('Unknown output `{}` selected in {}'.format(f.from_output, self._parent))
@ -190,6 +190,9 @@ class Compress(BaseOutput): # noqa: F821
with document: with document:
self.options = CompressOptions self.options = CompressOptions
""" [dict] Options for the `compress` output """ """ [dict] Options for the `compress` output """
# We could need to run targets related to the SCH and/or the PCB.
# So we need both things loaded.
self._both_related = True
def get_dependencies(self): def get_dependencies(self):
return self.options.get_dependencies() return self.options.get_dependencies()