From 4eafd2664a7fca1d80ef98c5bc9a39e41db08add Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 25 Jun 2021 09:04:49 +0200 Subject: [PATCH] FootprintWizardBase.py: fix use of cmp(), non existing in python3 Fixes #8677 https://gitlab.com/kicad/code/kicad/issues/8677 --- pcbnew/python/plugins/FootprintWizardBase.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pcbnew/python/plugins/FootprintWizardBase.py b/pcbnew/python/plugins/FootprintWizardBase.py index bd6a3c3275..1c057ce69d 100644 --- a/pcbnew/python/plugins/FootprintWizardBase.py +++ b/pcbnew/python/plugins/FootprintWizardBase.py @@ -518,6 +518,16 @@ class FootprintWizardDrawingAids: circle.SetStartEnd(start, end) self.module.Add(circle) + def MyCmp(self, n1, n2): + """ + replace the cmp() of python2 + """ + if n1 < n2: + return -1 + if n1 > n2: + return 1 + return 0 + def Arc(self, cx, cy, sx, sy, a): """! Draw an arc based on centre, start and angle @@ -543,7 +553,7 @@ class FootprintWizardDrawingAids: circle.SetShape(pcbnew.S_ARC) # check if the angle needs to be reverse (a flip scaling) - if cmp(self.dc['transform'][0], 0) != cmp(self.dc['transform'][4], 0): + if self.MyCmp(self.dc['transform'][0], 0) != self.MyCmp(self.dc['transform'][4], 0): a = -a circle.SetAngle(a)