From 733701b6623853647c2e9166d787a04bd8988650 Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Mon, 13 Jan 2025 15:30:28 +0100 Subject: [PATCH] =?UTF-8?q?FIX:=20bug=20in=20create=20pin=20group,=20repla?= =?UTF-8?q?ce=20logger.error=20with=20raise=20Value=20e=E2=80=A6=20(#967)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FIX: bug in create pin group, replace logger.error with raise Value error * Update src/pyedb/configuration/cfg_pin_groups.py Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> * Update src/pyedb/configuration/cfg_pin_groups.py Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> * Update src/pyedb/dotnet/edb_core/siwave.py Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> --------- Co-authored-by: ring630 <@gmail.com> Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> --- src/pyedb/configuration/cfg_pin_groups.py | 15 +++++++-------- src/pyedb/dotnet/edb_core/siwave.py | 3 +-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/pyedb/configuration/cfg_pin_groups.py b/src/pyedb/configuration/cfg_pin_groups.py index 14838d288e..c60cf44b1d 100644 --- a/src/pyedb/configuration/cfg_pin_groups.py +++ b/src/pyedb/configuration/cfg_pin_groups.py @@ -67,17 +67,16 @@ def __init__(self, pedb, **kwargs): def create(self): """Apply pin group on layout.""" if self.pins: - self._pedb.siwave.create_pin_group(self.reference_designator, list(self.pins), self.name) + pins = self.pins if isinstance(self.pins, list) else [self.pins] + self._pedb.siwave.create_pin_group(self.reference_designator, pins, self.name) elif self.net: - if self.reference_designator in self._pedb.components.instances: - comp = self._pedb.components.instances[self.reference_designator] - else: - raise Exception(f"Component not found for creating pin group {self.name}.") - pins = [p for p, obj in comp.pins.items() if obj.net_name in self.net] + nets = self.net if isinstance(self.net, list) else [self.net] + comp = self._pedb.components.instances[self.reference_designator] + pins = [p for p, obj in comp.pins.items() if obj.net_name in nets] if not self._pedb.siwave.create_pin_group(self.reference_designator, pins, self.name): - self._pedb.logger.error(f"Failed to create pin group {self.name}") + raise RuntimeError(f"Failed to create pin group {self.name}") else: - self._pedb.logger.error(f"No net and pins defined for defining pin group {self.name}") + raise RuntimeError(f"No net and pins defined for defining pin group {self.name}") def export_properties(self): if self.pins: diff --git a/src/pyedb/dotnet/edb_core/siwave.py b/src/pyedb/dotnet/edb_core/siwave.py index 8025510ed5..7a0a4fe481 100644 --- a/src/pyedb/dotnet/edb_core/siwave.py +++ b/src/pyedb/dotnet/edb_core/siwave.py @@ -1242,8 +1242,7 @@ def create_pin_group(self, reference_designator, pin_numbers, group_name=None): ) if edb_pingroup.IsNull(): # pragma: no cover - self._logger.error(f"Failed to create pin group {group_name}.") - return False + raise RuntimeError(f"Failed to create pin group {group_name}.") else: names = [i for i in pins if i.GetNet().GetName()] edb_pingroup.SetNet(names[0].GetNet())