From ea06a321816e843e44668ea549856aeee9163bcc Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 30 Jan 2024 08:43:25 -0300 Subject: [PATCH] [PCB/SCH Variant] Fixed targets (missing project files) --- CHANGELOG.md | 2 ++ kibot/gs.py | 8 ++++---- kibot/out_kicanvas.py | 4 +--- kibot/out_pcb_variant.py | 5 ++++- kibot/out_sch_variant.py | 5 ++++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c521b4efe..50826558d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -166,6 +166,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Quick Start: - Problems with KiCad 6+ files using KiCad 5 names for layers - Problems scanning dirs without enough privileges +- PCB/SCH Variant + - Makefile/compress targets (missing project) ## [1.6.3] - 2023-06-26 ### Added diff --git a/kibot/gs.py b/kibot/gs.py index 19cd5159e..5b84407a9 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -523,15 +523,15 @@ def copy_project(new_pcb_name, dry=False): return pro_copy, prl_copy, dru_copy @staticmethod - def copy_project_names(pcb_name): + def copy_project_names(pcb_name, ref_dir): pro_copy, prl_copy, dru_copy = GS.copy_project(pcb_name, dry=True) files = [] if pro_copy: - files.append(pro_copy) + files.append(os.path.join(ref_dir, os.path.basename(pro_copy))) if prl_copy: - files.append(prl_copy) + files.append(os.path.join(ref_dir, os.path.basename(prl_copy))) if dru_copy: - files.append(dru_copy) + files.append(os.path.join(ref_dir, os.path.basename(dru_copy))) return files @staticmethod diff --git a/kibot/out_kicanvas.py b/kibot/out_kicanvas.py index 07e474f48..edd61053f 100644 --- a/kibot/out_kicanvas.py +++ b/kibot/out_kicanvas.py @@ -62,9 +62,7 @@ def _get_targets(self, out_dir, only_index=False): elif s == 'schematic' and GS.sch_file: files.extend(GS.sch.file_names_variant(out_dir)) elif s == 'project' and (GS.sch_file or GS.pcb_file): - prj_files = GS.copy_project_names(GS.sch_file or GS.pcb_file) - for f in prj_files: - files.append(os.path.join(out_dir, os.path.basename(f))) + files.extend(GS.copy_project_names(GS.sch_file or GS.pcb_file, ref_dir=out_dir)) return files def get_targets(self, out_dir): diff --git a/kibot/out_pcb_variant.py b/kibot/out_pcb_variant.py index e78552e29..48f9975f7 100644 --- a/kibot/out_pcb_variant.py +++ b/kibot/out_pcb_variant.py @@ -29,7 +29,10 @@ def __init__(self): self._expand_ext = 'kicad_pcb' def get_targets(self, out_dir): - return [self._parent.expand_filename(out_dir, self.output)] + targets = [self._parent.expand_filename(out_dir, self.output)] + if self.copy_project: + targets.extend(GS.copy_project_names(targets[0], ref_dir=out_dir)) + return targets def run(self, output): super().run(output) diff --git a/kibot/out_sch_variant.py b/kibot/out_sch_variant.py index ef17fd95a..8d4db0f24 100644 --- a/kibot/out_sch_variant.py +++ b/kibot/out_sch_variant.py @@ -21,7 +21,10 @@ def __init__(self): super().__init__() def get_targets(self, out_dir): - return GS.sch.file_names_variant(out_dir) + targets = list(GS.sch.file_names_variant(out_dir)) + if self.copy_project: + targets.extend(GS.copy_project_names(GS.sch_file, ref_dir=out_dir)) + return targets def run(self, output_dir): super().run(output_dir)