Conversation
cpresser
left a comment
There was a problem hiding this comment.
This looks simple enough.
But I have no clue why this change is needed. Can you elaborate on that?
Do you have an example footprint where this patch changes the outcome of the check script?
| if not str(val['value']) == mod.name: | ||
| errors.append("Value text should match footprint name:") | ||
| errors.append("Value text is '{v}', expected: '{n}'".format( | ||
| v = val['value'], |
There was a problem hiding this comment.
also convert to str here.
| if module.value['value'] != module.name: | ||
| if str(module.value['value']) != module.name: | ||
| self.error("Value label '{lbl}' does not match filename '{fn}'".format( | ||
| lbl=module.value['value'], |
There was a problem hiding this comment.
For example Molex uses numeric-only part numbers.
You can see the error message below if the module name contains only numeric characters:
./check_kicad_mod.py ~/work/sharkrf-kicad-library/footprints/srf_Molex.pretty/5051100892.kicad_modTraceback (most recent call last):
File "./check_kicad_mod.py", line 117, in <module>
rule.check()
File "/home/makos/work/kicad-library-utils/pcb/rules/F7_4.py", line 140, in check
return any([self.checkPads(module.pads)])
File "/home/makos/work/kicad-library-utils/pcb/rules/F7_4.py", line 46, in checkPads
exposed_pad_search = re.search('\-\d+[EP]{2}', fpName, re.IGNORECASE)
File "/usr/lib64/python3.8/re.py", line 201, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object|
That is not a valid footprint name for this library. See our footprint naming scheme at https://kicad-pcb.org/libraries/klc/F3.6/. And these check scripts are for those guidelines/rules. So as @cpresser said, this doesn't hurt anything but it's not needed when building footprints that conform to the rules of this library. |
|
I think this is a use full addition anyway. The scripts should not throw a cryptic error message just because the user put in stupid input. The next logical step is to create a |
Those are still considered evil? |
|
Bad jokes aside, we might have to (and be able to) relax naming rules. See KiCad/kicad-symbols#2938 |
|
Nevertheless, we can have a script output a warning if non latin chars are used. Somewhat off-topic |
|
Yes, I'm not opposed to this PR. OT: True, the π example is a symbol. But all supported platforms can handle multibyte filenames and assuming there have already been users calling their schematics Even more OT: I wonder how many ERP systems these π parts broke along the supply chain ;) Edit: Not to mention Cyrillic/Greek/Arabic/whatever users in general. |

If the footprint name contains only numeric characters, it should be converted to string to ensure the proper rules checking.