Ejemplo n.º 1
0
def command(args):
    import sys

    import sr.tools.bom.schem as schem
    import sr.tools.bom.parts_db as parts_db

    SCHEMATIC = args.schematic

    lib = parts_db.get_db()
    parts = schem.open_schem(SCHEMATIC)

    error = 0
    found = 0

    # Erroneous parts (key is type)
    err_parts = {}

    for id in parts.keys():
        if parts[id] not in lib:
            err_parts.setdefault(parts[id], []).append(id)
            error += 1
        else:
            found += 1

    print("%i correct parts found." % found)

    if len(err_parts) > 0:
        print("The following %i parts are not in the SR parts database:" %
              error)

        for name, components in err_parts.items():
            print("\t'%s': %s" % (name, " ".join(components)))

        sys.exit(2)
Ejemplo n.º 2
0
def command(args):
    import sys

    import sr.tools.bom.schem as schem
    import sr.tools.bom.parts_db as parts_db

    SCHEMATIC = args.schematic

    lib = parts_db.get_db()
    parts = schem.open_schem(SCHEMATIC)

    error = 0
    found = 0

    # Erroneous parts (key is type)
    err_parts = {}

    for id in parts.keys():
        if parts[id] not in lib:
            err_parts.setdefault(parts[id], []).append(id)
            error += 1
        else:
            found += 1

    print("%i correct parts found." % found)

    if len(err_parts) > 0:
        print("The following %i parts are not in the SR parts database:" % error)

        for name, components in err_parts.items():
            print("\t'%s': %s" % (name, " ".join(components)))

        sys.exit(2)
Ejemplo n.º 3
0
    def __init__(self, db, fname, name):
        """Create a new ``BoardBom`` object."""
        Bom.__init__(self)
        self.db = db
        self.name = name

        s = schem.open_schem(fname)

        for des, srcode in s.items():
            if srcode == "unknown":
                print("No value set for %s" % des)
                continue
            if srcode not in self:
                self[srcode] = PartGroup(db[srcode], name)
            self[srcode].append((name, des))