Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

minor improvements to 3D coverage check #307

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pcb/check_3d_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import argparse

from kicad_mod import *
from kicad_mod import *
from print_color import *

common = os.path.abspath(os.path.join(sys.path[0], '..', 'common'))
Expand Down Expand Up @@ -49,7 +49,7 @@ def footprint_dir_name(self, pretty_name):

def valid_pretty_names(self):
try:
prettys = sorted([f.split('.')[0] for f in os.listdir(self.pretty_root) if os.path.isdir(os.path.join(self.pretty_root, f)) and f.endswith('.pretty')])
prettys = sorted([f.split('.pretty')[0] for f in os.listdir(self.pretty_root) if os.path.isdir(os.path.join(self.pretty_root, f)) and f.endswith('.pretty')])
except FileNotFoundError:
printer.red('EXIT: problem reading from module root: {mr:s}'.format(mr=self.pretty_root))
sys.exit(1)
Expand Down Expand Up @@ -116,12 +116,16 @@ def parse_module(filename, warnings):
try:
long_reference = module.models[0]['file']
except IndexError:
printer.yellow("- No model file specified in {fn:s}".format(fn=filename))
warnings += 1
if module.attribute != 'virtual':
printer.yellow("- No model file specified in {fn:s}".format(fn=filename))
warnings += 1
return None
try:
# Accept both forward and backward slash characters in path
long_reference = '/'.join(long_reference.split('\\'))
if not long_reference.startswith('${KISYS3DMOD}'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that already checked in some other rule?

printer.yellow('No KISYS3DMOD In: {fn:s}'.format(fn=filename))
warnings += 1
return os.path.basename(long_reference)
except:
printer.yellow("- Invalid model reference {f:s}".format(f=full))
Expand Down