Beispiel #1
0
def gen_canonical_transform(elec_inven_data_idx, regen=True):
    sdict = config.ELECTRONICS_INVENTORY_DATA[elec_inven_data_idx]
    if sdict['type'] == 'QuazarStockXLS':
        fpath = sdict['fpath']
        if not os.path.isabs(fpath):
            fpath = config.get_svn_path(fpath)
        sname = sdict['sname']
        location = sdict['location']
        tfpath = sdict['tfpath']

        rdr = get_stockxlsreader(fpath, sname, location, tfpath)

        outp = tfpath
        outf = fsutils.VersionedOutputFile(outp)
        outw = csv.writer(outf)
        outw.writerow(
            ('Current', 'gEDA Current', 'Ideal', 'Status', 'In Symlib')
        )
        for line in rdr.row_gen:
            if regen and rdr.tf.has_contextual_repr(line[0]):
                if gsymlib.is_recognized(rdr.tf.get_canonical_repr(line[0])):
                    in_symlib = 'YES'
                else:
                    in_symlib = ''
                outw.writerow((line[0],
                               rdr.tf.get_canonical_repr(line[0]),
                               rdr.tf.get_ideal_repr(line[0]),
                               rdr.tf.get_status(line[0]),
                               in_symlib,))
            else:
                if gsymlib.is_recognized(line[0]):
                    in_symlib = True
                else:
                    in_symlib = False
                outw.writerow((line[0], line[0], line[0], 'NEW', in_symlib))
        outf.close()
Beispiel #2
0
 def update_on_disk(self):
     # TODO this function makes the implementation somewhat specific
     # to inventory transforms. Consider refactoring.
     outf = fsutils.VersionedOutputFile(self._tfpath)
     outw = csv.writer(outf)
     outw.writerow(
         ('Current', 'gEDA Current', 'Ideal', 'Status', 'In Symlib')
     )
     for name in self.names:
         canonical = self.get_canonical_repr(name)
         if gsymlib.is_recognized(canonical):
             in_symlib = 'YES'
         else:
             in_symlib = ''
         outw.writerow((name,
                        canonical,
                        self.get_ideal_repr(name),
                        self.get_status(name),
                        in_symlib,))
     outf.close()
Beispiel #3
0
def in_gsymlib(ident):
    return gsymlib.is_recognized(ident)
Beispiel #4
0
 def in_gsymlib(self):
     if gsymlib.is_recognized(self.ident):
         return "YES"
     return None
Beispiel #5
0
def is_recognized(ident):
    if gsymlib.is_recognized(ident):
        return True
    if ident in pcblib:
        return True
    return False