diff --git a/tools/part-gen-scripts/misc_scripts/bbhack.py b/tools/part-gen-scripts/misc_scripts/bbhack.py deleted file mode 100644 index b3992504f..000000000 --- a/tools/part-gen-scripts/misc_scripts/bbhack.py +++ /dev/null @@ -1,169 +0,0 @@ -# usage: -# bbhack.py -i [breadboard input file] -o [breadboard output file] -# loads the breadboard input file, simplifies the connectors, and saves it to the breadboard output file - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - bbhack.py -i [breadboard input file] -o [breadboard output file] - loads the breadboard input file, simplifies the connectors, and saves it to the breadboard output file. -""" - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hi:o:", ["help", "input", "output"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - input = None - output = None - - for o, a in opts: - #print o - #print a - if o in ("-i", "--input"): - input = a - elif o in ("-o", "--output"): - output = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(input)): - usage() - sys.exit(2) - - if(not(output)): - usage() - sys.exit(2) - - dom = xml.dom.minidom.parse(input) - root = dom.documentElement - gNodes = root.getElementsByTagName("g") - socketsNode = None - for g in gNodes: - if g.getAttribute("id") == "sockets": - socketsNode = g - break - - if not socketsNode: - print "no sockets node found" - sys.exit(0) - - rects = [] - for r in root.childNodes: - if r.nodeType != g.ELEMENT_NODE: - continue - - if r.tagName != "rect": - continue - - id = r.getAttribute("id") - if not id: - continue - - if id.find("pin") >= 0: - rects.append(r) - - for r in rects: - root.removeChild(r) - r.unlink() - - for g in socketsNode.childNodes: - if g.nodeType != g.ELEMENT_NODE: - continue - - if g.tagName != "g": - continue - - p1 = None - p2 = None - c1 = None - for c in g.childNodes: - if c.nodeType != c.ELEMENT_NODE: - continue - - if c.tagName == "circle": - c1 = c - elif c.tagName == "path": - if not p1: - p1 = c - else: - p2 = c - - if not c1: - continue - - if not p1: - q = g.nextSibling - while q: - if q.nodeType == c.ELEMENT_NODE: - if q.tagName == "path": - if not p1: - p1 = q - else: - p2 = q - break - elif q.tagName == "g": - break - q = q.nextSibling - - if not p1: - continue - if not p2: - continue - - id = g.getAttribute("id") - if id: - if id.find("xpin") >= 0: - g.setAttribute("id", id.replace("xpin", "pin")) - elif id.find("pinx") >= 0: - g.setAttribute("id", id.replace("pinx", "pin")) - - print g.getAttribute("id") - - p1.parentNode.removeChild(p1) - p2.parentNode.removeChild(p2) - c1.parentNode.removeChild(c1) - - np1 = dom.createElement("path") - g.appendChild(np1) - np1.setAttribute("fill", p1.getAttribute("fill")) - - r = float(c1.getAttribute("r")) - cx = float(c1.getAttribute("cx")) - cy = float(c1.getAttribute("cy")) - - np1.setAttribute("d", ''.join(["M", `cx - r - r`, ",", `cy`, " a",`r * 2`, ",", `r * 2`, " ", `0`, " ", `0`, " ", `1`, " ", `r * 4`, ",", `0`])) - - np2 = dom.createElement("path") - g.appendChild(np2) - np2.setAttribute("fill", p2.getAttribute("fill")) - - np2.setAttribute("d", ''.join(["M", `cx + r + r`, ",", `cy`, " a",`r * 2`, ",", `r * 2`, " ", `0`, " ", `1`, " ", `1`, " ", `-r * 4`, ",", `0`])) - - g.appendChild(c1) - p1.unlink() - p2.unlink() - - outfile = open(output, 'wb') - s = dom.toxml("UTF-8") - s = re.sub('\s*\n\s*\n', '', s) # ghosts of removed (and unlinked) nodes seem to generate newlines, so tighten up the xml - outfile.write(s) - outfile.flush() - outfile.close() - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/checkascii.py b/tools/part-gen-scripts/misc_scripts/checkascii.py deleted file mode 100644 index 3b5139de1..000000000 --- a/tools/part-gen-scripts/misc_scripts/checkascii.py +++ /dev/null @@ -1,33 +0,0 @@ - -import sys, os, os.path, re, optparse - -def usage(): - print """ -usage: - checkascii.py -f [folder] - recursively checks that all filenames in folder are ascii -""" - -def main(): - parser = optparse.OptionParser() - parser.add_option('-f', '--folder', dest="folder" ) - (options, args) = parser.parse_args() - - if not options.folder: - usage() - parser.error("folder argument not given") - return - - for root, dirs, files in os.walk(options.folder, topdown=False): - for filename in files: - remainder = re.sub('[ -~]', '', filename) - if len(remainder) > 0: - print "not ascii", os.path.join(root, filename) - - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/checkcase.py b/tools/part-gen-scripts/misc_scripts/checkcase.py deleted file mode 100644 index b284067e4..000000000 --- a/tools/part-gen-scripts/misc_scripts/checkcase.py +++ /dev/null @@ -1,109 +0,0 @@ - -import sys, os, os.path, re, xml.dom.minidom, xml.dom, optparse - -def usage(): - print """ -usage: - checkcase.py -f [fzp folder] -s [svg folder] - ensure all fzp files case-sensitively match svg file names -""" - - - -def main(): - parser = optparse.OptionParser() - parser.add_option('-f', '--fzp', dest="fzpdir" ) - parser.add_option('-s', '--svg', dest="svgdir" ) - (options, args) = parser.parse_args() - - if not options.fzpdir: - usage() - parser.error("fzp dir argument not given") - return - - if not options.svgdir: - usage() - parser.error("svg dir argument not given") - return - - allsvgs = [] - lowersvgs = {} - for root, dirs, files in os.walk(options.svgdir, topdown=False): - for filename in files: - if not filename.endswith(".svg"): - continue - path = os.path.join(root, filename) - allsvgs.append(path) - lowersvgs[path.lower()] = filename - - for root, dirs, files in os.walk(options.fzpdir, topdown=False): - for filename in files: - if not filename.endswith(".fzp"): - continue - - fzpFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(fzpFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), fzpFilename - continue - - doUpdate = False - fzp = dom.documentElement - layerss = fzp.getElementsByTagName("layers") - for layers in layerss: - image = layers.getAttribute("image").replace("/", "\\") - if ("dip_" in image) and ("mil_" in image): - continue - if ("sip_" in image) and ("mil_" in image): - continue - if ("jumper_" in image) and ("mil_" in image): - continue - if ("screw_terminal_" in image): - continue - if ("jumper" in image): - continue - if ("mystery_" in image): - continue - if ("LED-" in image): - continue - if ("axial_lay" in image): - continue - if ("resistor_" in image): - continue - if ("generic" in image) and ("header" in image): - continue - path1 = os.path.join(options.svgdir, "core", image) - path2 = os.path.join(options.svgdir, "contrib", image) - path3 = os.path.join(options.svgdir, "obsolete", image) - if os.path.isfile(path1) or os.path.isfile(path2) or os.path.isfile(path3): - for path in [path1, path2, path3]: - try: - handle = open(path) - if not path in allsvgs: - print "mismatch", fzpFilename - print "\t", path - print - thing = layers.getAttribute("image").split("/") - thing[1] = lowersvgs[path.lower()] - layers.setAttribute("image", "/".join(thing)) - doUpdate = True - - except: - pass - else: - print "missing", fzpFilename, image - - - if doUpdate: - outfile = open(fzpFilename, 'wb') - s = dom.toxml("UTF-8") - outfile.write(s) - outfile.close() - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/checkcopies.py b/tools/part-gen-scripts/misc_scripts/checkcopies.py deleted file mode 100644 index c86ad090b..000000000 --- a/tools/part-gen-scripts/misc_scripts/checkcopies.py +++ /dev/null @@ -1,112 +0,0 @@ - - -import getopt, sys, os, re, time - -def usage(): - print """ -usage: - checkcopies.py -d - - is a folder containing svg files. - looks for files that have the same content but different names - - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - return - - outputDir = None - gotnot = 0 - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - return - else: - assert False, "unhandled option" - - if(not(outputDir)): - print "missing -d {directory} parameter" - usage() - return - - fs = [] - for f in os.listdir(outputDir): - if f.endswith(".svg"): - fs.append(os.path.splitext(f)[0]) - #print "appending", f, os.path.splitext(f)[0] - fs.sort(key=str.lower) # remove the .svg so the sort works better - dirs = [] - for f in fs: - dirs.append(f + ".svg") - - dirlen = len(dirs) - matches = [] - for i in range(dirlen): - if i in matches: - continue - - f1 = dirs[i] - path = os.path.join(outputDir, f1) - if not os.path.isfile(path): - continue - - if not f1.endswith(".svg"): - continue - - # print "testing", f1 - - txt1 = None - try: - infile = open(path, "r") - txt1 = infile.read() - infile.close() - except: - print "failure", f1 - - if txt1 == None: - continue - - for j in range(i + 1, dirlen): - f2 = dirs[j] - path = os.path.join(outputDir,f2) - if not os.path.isfile(path): - continue - - if not f2.endswith(".svg"): - continue - - if f1 == f2: - continue - - txt2 = None - try: - infile = open(path, "r") - txt2 = infile.read() - infile.close() - except: - print "failure", f2 - continue - - if txt2 == None: - continue - - if txt1 == txt2: - matches.append(j) - print "".format(f1, f2) - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/cleanschem.py b/tools/part-gen-scripts/misc_scripts/cleanschem.py deleted file mode 100644 index 54acf615a..000000000 --- a/tools/part-gen-scripts/misc_scripts/cleanschem.py +++ /dev/null @@ -1,112 +0,0 @@ - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - cleanschem.py -d [svg folder] - cleans files with multiple copies of internal rects and labels -""" - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - return - - dir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - return - else: - print "unhandled option", o - usage() - return - - - if dir == None: - print "missing directory argument" - usage() - return - - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".svg"): - continue - - svgFilename = os.path.join(root, filename) - handlesvg(svgFilename) - - -def handlesvg(svgFilename): - try: - dom = xml.dom.minidom.parse(svgFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), svgFilename - return - - #print svgFilename - rcount = 0 - toDelete = [] - svg = dom.documentElement - rectNodes = svg.getElementsByTagName("rect") - for rect in rectNodes: - if rect.getAttribute("class") == "interior rect": - rcount += 1 - if rcount > 1: - toDelete.append(rect) - print "\t", rect.toxml("UTF-8") - - #print rcount, toDelete - - textNodes = svg.getElementsByTagName("text") - labels = [] - fix = False - for text in textNodes: - id = text.getAttribute("id") - if id.startswith("label"): - labels.append(text) - if "_" in id: - #fix = True - #text.setAttribute("id", id.replace("_", "")) - #print "id", id - pass - - if len(labels) > 0: - for ix in range(len(labels)): - labeli = labels[ix] - for jx in range(ix + 1, len(labels)): - labelj = labels[jx] - if labeli.toxml("UTF-8") == labelj.toxml("UTF-8"): - toDelete.append(labeli) - print "\t", labeli.toxml("UTF-8") - break - - for node in toDelete: - node.parentNode.removeChild(node) - - if len(toDelete) > 0 or fix: - print "fixing", svgFilename - outfile = open(svgFilename, 'wb') - s = dom.toxml("UTF-8") - outfile.write(s) - outfile.close() - - - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/connectors_misnumbered.py b/tools/part-gen-scripts/misc_scripts/connectors_misnumbered.py deleted file mode 100644 index 65b928fff..000000000 --- a/tools/part-gen-scripts/misc_scripts/connectors_misnumbered.py +++ /dev/null @@ -1,131 +0,0 @@ -# usage: -# copper1fzp.py -d [fzp folder] -# adds a copper1 layer if there isn't one found already. - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - connectors_misnumbered.py -d [fzp folder] - checks that connectors with integer names are correctly mapped to connector numbers -""" - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - return - - dir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - return - else: - assert False, "unhandled option" - - if(not(dir)): - usage() - return - - pattern = r'(\d+)' - numberFinder = re.compile(pattern, re.IGNORECASE) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".fzp"): - continue - - fzpFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(fzpFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), fzpFilename - continue - - fzp = dom.documentElement - connectors = fzp.getElementsByTagName("connector") - gotInt = False - for connector in connectors: - try: - intname = int(connector.getAttribute("name")) - gotInt = True - except: - continue - - if not gotInt: - continue - - idZero = False - for connector in connectors: - try: - id = connector.getAttribute("id") - match = numberFinder.search(id) - if match == None: - continue - - if match.group(1) == '0': - idZero = True - break - except: - continue - - nameZero = False - for connector in connectors: - if connector.getAttribute("name") == "0": - nameZero = True - break - - - mismatches = [] - for connector in connectors: - idInt = 0 - nameInt = 0 - try: - id = connector.getAttribute("id") - match = numberFinder.search(id) - if match == None: - continue - - idInt = int(match.group(1)) - nameInt = int(connector.getAttribute("name")) - - except: - continue - - mismatch = False - if nameZero and idZero: - mismatch = (idInt != nameInt) - elif nameZero: - mismatch = (idInt != nameInt + 1) - elif idZero: - mismatch = (idInt + 1 != nameInt) - else: - mismatch = (idInt != nameInt) - if mismatch: - mismatches.append(connector) - - if len(mismatches) > 0: - print fzpFilename, nameZero, idZero - for connector in mismatches: - strings = connector.toxml().split("\n") - print strings[0] - print - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/copper1fzp.py b/tools/part-gen-scripts/misc_scripts/copper1fzp.py deleted file mode 100644 index f27b95fe5..000000000 --- a/tools/part-gen-scripts/misc_scripts/copper1fzp.py +++ /dev/null @@ -1,108 +0,0 @@ -# usage: -# copper1fzp.py -d [fzp folder] -# adds a copper1 layer if there isn't one found already. - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - copper1fzp.py -d [fzp folder] - adds a copper1 layer if there isn't one found already. -""" - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - dir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(dir)): - usage() - sys.exit(2) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".fzp"): - continue - - fzpFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(fzpFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), fzpFilename - continue - - fzp = dom.documentElement - pcbViewNodes = fzp.getElementsByTagName("pcbView") - needsCopper1 = 0 - for pcbView in pcbViewNodes: - layersNodes = pcbView.getElementsByTagName("layers") - if layersNodes.length == 1: - viewsLayers = layersNodes.item(0) - copper0 = None - copper1 = None - for layer in viewsLayers.getElementsByTagName("layer"): - if layer.getAttribute("layerId") == "copper1": - copper1 = layer - elif layer.getAttribute("layerId") == "copper0": - copper0 = layer - - if not copper1 and copper0: - needsCopper1 = 1 - copper1 = dom.createElement("layer") - copper1.setAttribute("layerId", "copper1") - viewsLayers.appendChild(copper1) - else: - break - - else: - connectorsView = pcbView - copper1 = None - copper0 = None - for p in connectorsView.getElementsByTagName("p"): - if p.getAttribute("layer") == "copper1": - copper1 = p - elif p.getAttribute("layer") == "copper0": - copper0 = p - - if copper0 and not copper1: - copper1 = dom.createElement("p") - copper1.setAttribute("layer", "copper1") - copper1.setAttribute("svgId", copper0.getAttribute("svgId")) - connectorsView.appendChild(copper1) - - if not needsCopper1: - print "no copper1 needed for", fzpFilename - continue - - print "adding copper1 to", fzpFilename - outfile = open(fzpFilename, 'wb') - s = dom.toxml("UTF-8") - outfile.write(s) - outfile.flush() - outfile.close() - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/copper1svg.py b/tools/part-gen-scripts/misc_scripts/copper1svg.py deleted file mode 100644 index 19e00a5a8..000000000 --- a/tools/part-gen-scripts/misc_scripts/copper1svg.py +++ /dev/null @@ -1,86 +0,0 @@ -# usage: -# copper1svg.py -d [svg folder] -# adds a if there isn't one found already. - - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - copper1svg.py -d [svg folder] - adds a if there isn't one found already. -""" - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - dir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(dir)): - usage() - sys.exit(2) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".svg"): - continue - - svgFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(svgFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), svgFilename - continue - - svg = dom.documentElement - gNodes = svg.getElementsByTagName("g") - copper1 = None - copper0 = None - for g in gNodes: - if g.getAttribute("id") == "copper1": - copper1 = g - if g.getAttribute("id") == "copper0": - copper0 = g - - if copper1: - continue - - if not copper0: - print "copper0 not found in", svgFilename - continue - - print "adding copper1 to", svgFilename - copper1 = dom.createElement("g") - copper1.setAttribute("id", "copper1") - copper0.parentNode.insertBefore(copper1, copper0) - copper1.appendChild(copper0) - outfile = open(svgFilename, 'wb') - s = dom.toxml("UTF-8") - # s = re.sub('\s*\n\s*\n', '', s) # ghosts of removed (and unlinked) nodes seem to generate newlines, so tighten up the xml - outfile.write(s) - outfile.flush() - outfile.close() - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/copperNoSilkscreen.py b/tools/part-gen-scripts/misc_scripts/copperNoSilkscreen.py deleted file mode 100644 index 20ebc1d95..000000000 --- a/tools/part-gen-scripts/misc_scripts/copperNoSilkscreen.py +++ /dev/null @@ -1,66 +0,0 @@ -# usage: -# copperNoSilkscreen.py -d -# -# is a folder, with subfolders, containing .fzp files. In each fzp file in the directory or its children -# look for "copper" and "silkscreen" - -import getopt, sys, os, re - -def usage(): - print """ -usage: - copperNoSilkscreen.py -d [directory] - - directory is a folder containing .fzp files. - In each fzp file in the directory or its subfolders, - look for "copper" and "silkscreen". - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(outputDir)): - usage() - sys.exit(2) - - - for root, dirs, files in os.walk(outputDir, topdown=False): - for filename in files: - if (filename.endswith(".fzp")): - infile = open(os.path.join(root, filename), "r") - fzp = infile.read(); - infile.close(); - copperMatch = re.search('copper', fzp) - silkscreenMatch = re.search('silkscreen', fzp) - - if (copperMatch == None): - print "{0} {1}".format(os.path.join(root, filename), "no copper") - elif (silkscreenMatch == None): - print "{0} {1}".format(os.path.join(root, filename), "no silkscreen") - - - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/coppersvgparent.py b/tools/part-gen-scripts/misc_scripts/coppersvgparent.py deleted file mode 100644 index bdace38b5..000000000 --- a/tools/part-gen-scripts/misc_scripts/coppersvgparent.py +++ /dev/null @@ -1,81 +0,0 @@ -# usage: -# coppersvgparent.py -d [svg folder] -# looks for files where copper0/copper1 are not parent/child or child/parent - - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - coppersvgparent.py -d [svg folder] - looks for files where copper0/copper1 are not parent/child or child/parent -""" - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - dir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(dir)): - usage() - sys.exit(2) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".svg"): - continue - - svgFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(svgFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), svgFilename - continue - - svg = dom.documentElement - gNodes = svg.getElementsByTagName("g") - copper1 = None - copper0 = None - for g in gNodes: - if g.getAttribute("id") == "copper1": - copper1 = g - if g.getAttribute("id") == "copper0": - copper0 = g - - if not copper1: - continue - - if not copper0: - continue - - if copper1.parentNode == copper0: - continue - - if copper0.parentNode == copper1: - continue - - print "not parents", svgFilename - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/droid.py b/tools/part-gen-scripts/misc_scripts/droid.py deleted file mode 100644 index 0bcb50f1a..000000000 --- a/tools/part-gen-scripts/misc_scripts/droid.py +++ /dev/null @@ -1,68 +0,0 @@ -# usage: -# droid.py -d -# -# is a folder, with subfolders, containing .svg files. In each svg file in the directory or its children -# replace 'Droid Sans' with DroidSans - -import getopt, sys, os, re - -def usage(): - print """ -usage: - droid.py -d [directory] - - directory is a folder containing .svg files. - In each svg file in the directory or its subfolders, - replace 'Droid Sans' with DroidSans. - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(outputDir)): - usage() - sys.exit(2) - - - for root, dirs, files in os.walk(outputDir, topdown=False): - for filename in files: - if (filename.endswith(".svg")): - infile = open(os.path.join(root, filename), "r") - svg = infile.read(); - infile.close(); - svg1 = svg.replace("'Droid Sans'", "DroidSans"); - svg2 = svg1.replace("Droid Sans", "DroidSans"); - svg3 = svg2.replace("'DroidSans'", "DroidSans"); - - if (len(svg3) != len(svg)): - outfile = open(os.path.join(root, filename), "w") - outfile.write(svg3); - outfile.close() - print "{0}".format(os.path.join(root, filename)) - - - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/fa_clearemptypathsfromcopper.py b/tools/part-gen-scripts/misc_scripts/fa_clearemptypathsfromcopper.py deleted file mode 100644 index 9b02fdc60..000000000 --- a/tools/part-gen-scripts/misc_scripts/fa_clearemptypathsfromcopper.py +++ /dev/null @@ -1,93 +0,0 @@ -import os, os.path - -inputDir = "C:\\Users\\joev\\Documents\\AAA\\Fritzing\\scripting begin\\input" -outputDir = "C:\\Users\\joev\\Documents\\AAA\\Fritzing\\scripting begin\\output\\" - -def remove_namespace(doc, namespace): - - - ns = u'{%s}' % namespace - nsl = len(ns) - for tree in doc.getiterator(): - if tree.tag.startswith(ns): - tree.tag = tree.tag[nsl:] - - -def myFilter(svgFilename, filename): - - #print "im myfilter",svgFilename - import xml.etree.ElementTree as ET #import ElementTree - parser = ET.XMLParser(encoding="utf-8") - tree = ET.parse(svgFilename, parser) - remove_namespace(tree, u'http://www.w3.org/2000/svg') #call remove_namespace for cleaning the element-tags - svgRoot = tree.getroot() - # print "tree", tree - - parent_map = dict((c, p) for p in tree.getiterator() for c in p) #make a dictonary with a map of the hole file - #it has the childs and the its parents stored - - coppers = set() #make a set (set is like a list but without doubled same entries) - for child in parent_map.values(): - removed = False - # print "child", child - id = child.attrib.get("id") - if id and id.startswith('copper'): #get the child ids to decide if we need to clean or not - coppers.add(child) - - - paths = list() - - for copper in coppers: - paths.extend(copper.findall("path")) #writes the list where are path-elemnts are in that are in a parent called "copper" - - #print "paths", paths - for path in paths: - #print "path", path - #print "parent_map", parent_map - id = path.attrib.get("id") - - if id is None: - try: - #print "id", id - parent_map[path].remove(path) #remove the child from his parent - removed = True - - except: - continue#print "fuck", path, path.tag, parent_map.get(path) - - else: - #print "id", id - removed = False - - if removed: #write the new file in a new output directory - svgRoot.set("xmlns:svg", "http://www.w3.org/2000/svg") - svgRoot.set("xmlns", "http://www.w3.org/2000/svg") - #print "root", root, "tree",tree, "filename", svgFilename - outFilename = outputDir + filename - #print "outputdir", outputDir, "outFilename", outFilename - - tree.write(outFilename) - with open (outFilename, "r+") as f: - old = f.read() - f.seek(0) - f.write('\n' + '' + '\n' + old) - f.close() - print "finised:", filename - - -def main(): - for root, dirs, files in os.walk(inputDir, topdown=True): #go to the dicrectory and get all files in a list called "files" - for filename in files: - if filename.endswith(".svg"): #if it is an svg -> go on - #print "im main" - svgFilename = os.path.join(root, filename) - #print root, filename - myFilter(svgFilename, filename) #go to function myFilter - continue - - - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/findfonts.py b/tools/part-gen-scripts/misc_scripts/findfonts.py deleted file mode 100644 index 927e593e4..000000000 --- a/tools/part-gen-scripts/misc_scripts/findfonts.py +++ /dev/null @@ -1,78 +0,0 @@ -# usage: -# findfonts.py -d -f [font1] -f [font2] .... -# -# is a folder, with subfolders, containing .svg files. In each svg file in the directory or its children -# look for fonts that aren't in the list - -import getopt, sys, os, re - -def usage(): - print """ -usage: - droid.py -d [directory] -f [font1] -f [font2] ... - - directory is a folder containing .svg files. - In each svg file in the directory or its subfolders, - look for fonts that aren't in the list - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:f:", ["help", "directory", "font"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - fonts = [] - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - elif o in ("-f", "--font"): - fonts.append(a); - else: - assert False, "unhandled option" - - if(not(outputDir)): - usage() - sys.exit(2) - - - for root, dirs, files in os.walk(outputDir, topdown=False): - for filename in files: - if (filename.endswith(".svg")): - infile = open(os.path.join(root, filename), "r") - svg = infile.read(); - infile.close(); - - matches = re.findall('font-family\\s*=\\s*\"(.+)\"', svg) - listMatches(matches, fonts, root, filename); - - matches = re.findall('font-family\\s*:\\s*(.+)[\\";]', svg) - listMatches(matches, fonts, root, filename); - - -def listMatches(matches, fonts, root, filename): - for m in matches: - gotone = 0 - for fontname in fonts: - if (m.find(fontname) >= 0): - gotone = 1; - break; - if not gotone: - print "{0}::{1}".format(os.path.join(root, filename), m) - - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/findsvgunits.py b/tools/part-gen-scripts/misc_scripts/findsvgunits.py deleted file mode 100644 index 05ee6c55c..000000000 --- a/tools/part-gen-scripts/misc_scripts/findsvgunits.py +++ /dev/null @@ -1,87 +0,0 @@ -# usage: -# copper1svg.py -d [svg folder] -# adds a if there isn't one found already. - - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - findsvgunits.py -d [svg folder] - looks for width and height attributes with no units or px units -""" - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - dir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(dir)): - usage() - sys.exit(2) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".svg"): - continue - - svgFilename = os.path.join(root, filename) - printFilename = svgFilename[len(dir):] - illustratorString = "illustrator" - noIllustratorString = " " - - try: - dom = xml.dom.minidom.parse(svgFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), svgFilename - continue - - svg = dom.documentElement - w = svg.getAttribute("width") - h = svg.getAttribute("height") - hok = None - wok = None - for unit in ["in", "cm", "mm"]: - if w.endswith(unit): - wok = 1 - if h.endswith(unit): - hok = 1 - - if (hok and wok): - continue - - descr = noIllustratorString - s = dom.toxml("UTF-8") - if "Generator: Adobe Illustrator" in s: - descr = illustratorString - - if not (w.endswith("px") or h.endswith("px")): - print "no units {0} {1}".format(descr, printFilename) - continue - - print "px units {0} {1}".format(descr, printFilename) - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/footprintgrid.py b/tools/part-gen-scripts/misc_scripts/footprintgrid.py deleted file mode 100644 index 5a609b129..000000000 --- a/tools/part-gen-scripts/misc_scripts/footprintgrid.py +++ /dev/null @@ -1,145 +0,0 @@ -# usage: -# footprintgrid.py -o [outputfile] -u ['in' or 'mm' units] -l [left padding (units)] -t [top padding (units)] -r [right padding (units)] -b [bottom padding (units)] -x [horizontal pin count] -y [vertical pin count] -g [grid size (units)] -h [hole diameter (units)] -r [ring thickness (units)] -# -# writes an svg footprint file to [outputfile] -# units are either all in inches or millimeters -# padding left and top is the distance from the edge of the part to the center of the top left pin -# padding right and bottom is the distance from the edge of the part to the center of the bottom right pin -# x and y define the number of pins -# gridsize is the distance from the center of one pin to the center of another pin -# drillhole is the diameter of the pin's drillhole -# ring thickness is the width of the ring (not including the drillhole) -# -# example: footprintgrid.py -o arduino_mini.svg -u in -l 0.1 -t 0.1 -r0.1 -b 0.1 -x 12 -y 7 -g 0.1 -c 0.02 -d 0.035 - - - - -import getopt, sys, os, re - -def usage(): - print """ -usage: - footprintgrid.py -o [outputfile] -u ['in' or 'mm' units] -l [left padding (units)] -t [top padding (units)] -r [right padding (units)] -b [bottom padding (units)] -x [horizontal pin count] -y [vertical pin count] -g [grid size (units)] -d [drillhole diameter (units)] -c [copper thickness (units)] - - writes an svg footprint file to [outputfile] - units are either all in inches or millimeters - padding left and top is the distance from the edge of the part to the center of the top left pin - padding right and bottom is the distance from the edge of the part to the center of the bottom right pin - x and y define the number of pins - g is the distance from the center of one pin to the center of another pin - drillhole is the diameter of the pin's drillhole - copper thickness is the width of the copper ring (not including the drillhole) - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "ho:u:l:t:r:b:x:y:g:d:c:", ["help", "output", "units", "left", "top", "right", "bottom", "x", "y", "grid", "drillhole", "copper"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputFile = None - units = None - left = None - right = None - top = None - bottom = None - x = None - y = None - gridSize = None - drillHole = None - ringThickness = None - - for o, a in opts: - if o in ("-o", "--output", "--outputfile"): - outputFile = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - elif o in ("-u", "--units"): - units = a - elif o in ("-l", "--left"): - left = float(a) - elif o in ("-r", "--right"): - right = float(a) - elif o in ("-t", "--top"): - top = float(a) - elif o in ("-b", "--bottom"): - bottom = float(a) - elif o in ("-x"): - x = int(a) - elif o in ("-y"): - y = int(a) - elif o in ("-g", "--grid", "--gridsize"): - gridSize = float(a) - elif o in ("-d", "--drill", "--drillhole"): - drillHole = float(a) - elif o in ("-c", "--ring", "--ringthickness", "--thickness", "--copper", "--copperthickness"): - ringThickness = float(a) - else: - print ("params %s %s" % (o, a)) - assert False, "unhandled option " - - for thing in (outputFile, units, left, right, top, bottom, x, y, gridSize, drillHole, ringThickness): - if(not(thing)): - usage() - sys.exit(2) - - if units == 'mm': - left /= 25.4 - right /= 25.4 - top /= 25.4 - bottom /= 25.4 - gridSize /= 25.4 - drillHole /= 25.4 - ringThickness /= 25.4 - - width = left + right + ((x - 1) * gridSize) - width000 = width * 1000 - height = top + bottom + ((y - 1) * gridSize) - height000 = height * 1000 - - radius = (drillHole + ringThickness) / 2.0 - - svg = "\n" - svg += "\n" % (width, height, width000, height000) - svg += "\n" - #across the top: - svg += "\n" % (width000 - 8) - #across the bottom: - svg += "\n" % (height000 - 8, width000 - 8, height000 - 8) - #down left with a break in the middle - svg += "\n" % ((height000 / 2.0) - (1000 * gridSize / 2.0)) - svg += "\n" % ((height000 / 2.0) + (1000 * gridSize / 2.0), height000 - 8) - #down right - svg += "\n" % (width000 - 8, width000 - 8, height000 - 8) - svg += "\n" - svg += "\n" - cy = top - for iy in range(y): - cx = left - for ix in range(x): - svg += "\n" % (ix + ((y - iy -1) * x), cx * 1000, cy * 1000, radius * 1000, ringThickness * 1000) - if (ix == 0 and iy == y - 1): - svg += "\n" % ((cx - radius) * 1000, (cy - radius) * 1000, radius * 1000 * 2, radius * 1000 * 2, ringThickness * 1000) - cx += gridSize - - cy += gridSize - - svg += "\n" - svg += "" - infile = open(outputFile, "w") - infile.write(svg); - infile.close(); - - - - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/fpgrabber.bat b/tools/part-gen-scripts/misc_scripts/fpgrabber.bat deleted file mode 100644 index ac4a5616d..000000000 --- a/tools/part-gen-scripts/misc_scripts/fpgrabber.bat +++ /dev/null @@ -1 +0,0 @@ -c:\Python26\python.exe C:\Users\jonathan\fritzing2\part-gen-scripts\misc_scripts\fpgrabber.py -u http://www.gedasymbols.org/footprints/ -d C:\Users\jonathan\fritzing2\fz\fp2 > C:\Users\jonathan\fritzing2\part-gen-scripts\misc_scripts\fpgrabber.txt \ No newline at end of file diff --git a/tools/part-gen-scripts/misc_scripts/fpgrabber.py b/tools/part-gen-scripts/misc_scripts/fpgrabber.py deleted file mode 100644 index d6974133f..000000000 --- a/tools/part-gen-scripts/misc_scripts/fpgrabber.py +++ /dev/null @@ -1,139 +0,0 @@ -# usage: -# fpgrabber.py -u [url to crawl] -d [output directory] -# recursively crawl the url and download fp files into the output directory. - -# code borrowed from http://theanti9.wordpress.com/2009/02/14/python-web-crawler-in-less-than-50-lines/ - -import getopt, sys, os, os.path, re, urllib2, urlparse - -def usage(): - print """ -usage: - fpgrabber.py -u [url to crawl] -d [output directory] - recursively crawl the url and download fp files into the output directory. - """ - -linkregex = re.compile(' 0: - crawling = tocrawl.pop() - print "crawling " + crawling - - try: - response = urllib2.urlopen(crawling) - except: - print "failed to open " + crawling - return - - #print "code " + str(response.getcode()) - #url = urlparse.urlparse(response.geturl()) - if crawling != response.geturl(): - #this never gets triggered by the footprint site, geturl doesn't seem to return redirects - print "changed " + crawling + " " + response.geturl() - - #info = response.info() - #print info - - msg = response.read() - response.close() - links = linkregex.findall(msg) - if (len(links) == 0): - if (msg.find("= 0): - links = redirectex.findall(msg) - #print " redirect " + msg + " " + str(len(links)) - - crawled.add(crawling) - for link in (links.pop(0) for _ in xrange(len(links))): - newlink = urlparse.urljoin(crawling, urllib2.quote(link, ":/?%+")) - #print " link " + newlink + " " + link - if (newlink.endswith("fp?dl")): - savefp(newlink) - continue - - if (newlink.find(inputurl) >= 0) and (newlink not in crawled): - tocrawl.append(newlink) - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/fzpzclean.py b/tools/part-gen-scripts/misc_scripts/fzpzclean.py deleted file mode 100644 index 6e99523f8..000000000 --- a/tools/part-gen-scripts/misc_scripts/fzpzclean.py +++ /dev/null @@ -1,190 +0,0 @@ -# TODO: -# check for incomplete parts (missing views) -# check if svgs are plain copies of already existing ones and link them instead? -# check for conflicting names - -# lots of borrowing from http://code.activestate.com/recipes/252508-file-unzip/ - -import getopt, sys, os, os.path, re, zipfile - -def usage(): - print """ -usage: - fzpzclean.py -f [fzpz directory] -d [output directory] -o [core | contrib | user] (-r) - - -f directory of input fzpzs - -d directory for output of the cleanup process - -o parent folder name, depending on fzp category - -r optional: take the fzpz filename to rename the fzp filename - -Unzips fzpz files into the output directory and cleans up file names and references. -""" - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hf:d:o:r", ["help", "fzpzs", "directory", "output", "rename"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - inputdir = None - outputdir = None - outputPrefix = None - rename = False - - for o, a in opts: - #print o - #print a - if o in ("-f", "--fzpzs"): - inputdir = a - elif o in ("-d", "--directory"): - outputdir = a - elif o in ("-o", "--output"): - outputPrefix = a - elif o in ("-r", "--rename"): - rename = True - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(inputdir)): - usage() - sys.exit(2) - - if(not(outputPrefix)): - usage() - sys.exit(2) - - if(not(outputdir)): - usage() - sys.exit(2) - - if not outputdir.endswith(':') and not os.path.exists(outputdir): - os.mkdir(outputdir) - - for fn in os.listdir(inputdir): - if fn.endswith('.fzpz'): - print fn - file = os.path.join(inputdir, fn) - zf = zipfile.ZipFile(file) - - # create directory structure to house files - createstructure(file, outputdir, outputPrefix) - - # record svg renamings and fzp location for fixing paths later - svgrenames = [] - fzplocation = None - - # extract files to directory structure - for i, name in enumerate(zf.namelist()): - if not name.endswith('/'): - - # identify file type - ending = name.split('.')[-1] - if ending == 'svg': - pass - elif ending == 'fzp': - pass - else: - print "WARNING wrong file type:", name - return - - # sort files into subdirectories - subdir = None - if ending == 'fzp': - subdir = outputPrefix - elif name.find('icon') >= 0: - subdir = 'svg/' + outputPrefix + '/icon' - elif name.find('pcb') >= 0: - subdir = 'svg/' + outputPrefix + '/pcb' - elif name.find('schem') >= 0: - subdir = 'svg/' + outputPrefix + '/schematic' - elif name.find('bread') >= 0: - subdir = 'svg/' + outputPrefix + '/breadboard' - - # remove junk from filenames - outname = name - outname = re.sub('^svg\.((icon)|(breadboard)|(schematic)|(pcb))\.', '', outname, 1) - refname = outname # this is how the svgs are referenced in the fzp - outname = re.sub('^part\.', '', outname, 1) - outname = re.sub('((__)|(_))[0-9a-fA-F]{32}', '', outname) - outname = re.sub('((__)|(_))[0-9a-fA-F]{27}', '', outname) - outname = re.sub('((__)|(_))[0-9a-fA-F]{20}', '', outname) - outname = re.sub('((__)|(_))((icon)|(breadboard)|(schematic)|(pcb))', '', outname) - # remove duplicate file endings - outname = re.sub('.' + ending, '', outname) - outname += '.' + ending - - # optionally rename the fzp to that of the fzpz - if ending == 'fzp' and rename: - base = os.path.basename(zf.filename) - outname = os.path.splitext(base)[0] - outname += '.fzp' - - # write new files - filelocation = os.path.join(outputdir, subdir, outname) - outfile = open(filelocation, 'wb') - outfile.write(zf.read(name)) - outfile.flush() - outfile.close() - - # store paths for reference update - if ending == 'svg': - svgrenames.append((refname, outname)) - elif ending == 'fzp': - fzplocation = filelocation - - # update svg references in fzp - fzpfile = open(fzplocation, 'r+') - s = fzpfile.read() - for svgre in svgrenames: - if s.find(svgre[0]) == -1: - print "WARNING reference could not be found:", svgre[0] - s = s.replace(svgre[0], svgre[1]) - fzpfile.seek(0) - fzpfile.truncate() - fzpfile.write(s) - fzpfile.flush() - fzpfile.close() - - - -def createstructure(file, dir, outputPrefix): - # makedirs(listdirs(file), dir) - dirs = [outputPrefix, 'svg/' + outputPrefix + '/icon', 'svg/' + outputPrefix + '/breadboard', 'svg/' + outputPrefix + '/schematic', 'svg/' + outputPrefix + '/pcb'] - makedirs(dirs, dir) - - -def makedirs(directories, basedir): - """ Create any directories that don't currently exist """ - for dir in directories: - curdir = os.path.join(basedir, dir) - if not os.path.exists(curdir): - os.makedirs(curdir) - -def listdirs(file): - """ Grabs all the directories in the zip structure - This is necessary to create the structure before trying - to extract the file to it. """ - zf = zipfile.ZipFile(file) - - dirs = [] - - for name in zf.namelist(): - if name.endswith('/'): - dirs.append(name) - - dirs.sort() - return dirs - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/genmoduleidfzphash.py b/tools/part-gen-scripts/misc_scripts/genmoduleidfzphash.py deleted file mode 100644 index 952a44807..000000000 --- a/tools/part-gen-scripts/misc_scripts/genmoduleidfzphash.py +++ /dev/null @@ -1,70 +0,0 @@ -# usage: -# genmoduleidfzphash.py -d [directory of fzp files] -o [output file name] -# loads the each fzp file, extracts the moduleID, and saves the id-filename pair to the output file - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - genmoduleidfzphash.py -d [directory of fzp files] -o [output file name] - loads the each fzp file, extracts the moduleID, and saves the id-filename pair to the output file -""" - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:o:", ["help", "directory", "output"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - inputDir = None - output = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - inputDir = a - elif o in ("-o", "--output"): - output = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(inputDir)): - usage() - sys.exit(2) - - if(not(output)): - usage() - sys.exit(2) - - outfile = open(output, 'wb') - for fname in os.listdir(inputDir): - if not fname.endswith(".fzp"): - continue - - dom = xml.dom.minidom.parse(os.path.join(inputDir, fname)) - root = dom.documentElement - id = root.getAttribute("moduleId") - if (id): - outfile.write(id) - outfile.write(",") - outfile.write(fname.replace(".fzp", "")) - outfile.write("\n") - - outfile.flush() - outfile.close() - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/grep.py b/tools/part-gen-scripts/misc_scripts/grep.py deleted file mode 100644 index cdc905eb0..000000000 --- a/tools/part-gen-scripts/misc_scripts/grep.py +++ /dev/null @@ -1,75 +0,0 @@ -# usage: -# grep.py -d -f -# -# is a folder, with subfolders, containing .svg files. In each svg file in the directory or its children -# look for - -import getopt, sys, os, re - -def usage(): - print """ -usage: - grep.py -d [directory] -f [text] -n - - directory is a folder containing .svg files. - In each svg file in the directory or its subfolders, - look for [text] - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hnd:f:", ["help", "not", "directory", "find"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - findtext = "" - gotnot = 0 - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - elif o in ("-f", "--find"): - findtext = a; - elif o in ("-n", "--not"): - gotnot = 1; - - else: - assert False, "unhandled option" - - if(not(outputDir)): - usage() - sys.exit(2) - - - print "finding text " + findtext - - for root, dirs, files in os.walk(outputDir, topdown=False): - for filename in files: - if (filename.endswith(".svg")): - infile = open(os.path.join(root, filename), "r") - svg = infile.read(); - infile.close(); - - rslt = svg.find(findtext) - - if gotnot and (rslt < 0): - print "{0}:{1}".format(os.path.join(root, filename), rslt) - if (not gotnot) and (rslt > -1): - print "{0}:{1}".format(os.path.join(root, filename), rslt) - - - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/invisibleconnectors.py b/tools/part-gen-scripts/misc_scripts/invisibleconnectors.py deleted file mode 100644 index a1b5d9acd..000000000 --- a/tools/part-gen-scripts/misc_scripts/invisibleconnectors.py +++ /dev/null @@ -1,96 +0,0 @@ -# usage: -# invisibleconnectors.py -d [svg folder] -# looks for connector-like svg elements with no fill or stroke - - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - invisibleconnectors.py -d [svg folder] - looks for connector-like svg elements with no fill or stroke -""" - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - dir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(dir)): - usage() - sys.exit(2) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".svg"): - continue - - svgFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(svgFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), svgFilename - continue - - changed = 0 - todo = [dom.documentElement] - while len(todo) > 0: - element = todo.pop(0) - for node in element.childNodes: - if node.nodeType == node.ELEMENT_NODE: - todo.append(node) - stroke = element.getAttribute("stroke") - fill = element.getAttribute("fill") - strokewidth = element.getAttribute("stroke-width") - id = element.getAttribute("id") - if not "connector" in id: - continue - - if len(stroke) == 0: - style = element.getAttribute("style") - if len(style) != 0: - style = style.replace(";", ":") - styles = style.split(":") - for index, name in enumerate(styles): - if name == "stroke": - stroke = styles[index + 1] - elif name == "stroke-width": - strokewidth = styles[index + 1] - elif name == "fill": - fill = styles[index + 1] - - if len(fill) > 0 and fill != "none": - continue - - if len(strokewidth) > 0 and strokewidth != "0": - continue - - - print "invisible connector", svgFilename - - - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/listModuleIDs.py b/tools/part-gen-scripts/misc_scripts/listModuleIDs.py deleted file mode 100644 index 914a30dcd..000000000 --- a/tools/part-gen-scripts/misc_scripts/listModuleIDs.py +++ /dev/null @@ -1,62 +0,0 @@ - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - listModuleIDs.py -f { fz file } - looks for files where copper0/copper1 are not parent/child or child/parent -""" - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hf:", ["help", "file"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - return - - filename = None - - for o, a in opts: - #print o - #print a - if o in ("-f", "--file"): - filename = a - elif o in ("-h", "--help"): - usage() - return - else: - assert False, "unhandled option" - - if filename == None: - usage() - return - - try: - dom = xml.dom.minidom.parse(filename) - except xml.parsers.expat.ExpatError, err: - print str(err), filename - return - - moduleIDs = {} - - root = dom.documentElement - instances = root.getElementsByTagName("instance") - for instance in instances: - moduleID = instance.getAttribute("moduleIdRef") - path = instance.getAttribute("path") - if moduleIDs.get(moduleID) == None: - moduleIDs[moduleID] = path - - for moduleID in moduleIDs.keys(): - print moduleID - print " ",moduleIDs[moduleID] - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/listfamilies.py b/tools/part-gen-scripts/misc_scripts/listfamilies.py deleted file mode 100644 index 31ec672ad..000000000 --- a/tools/part-gen-scripts/misc_scripts/listfamilies.py +++ /dev/null @@ -1,76 +0,0 @@ - -import sys, os, os.path, re, xml.dom.minidom, xml.dom, optparse - -def usage(): - print """ -usage: - listfamilies.py -d [fzp folder] {-p [prefix] } - lists families and optionally provides a prefix -""" - - - -def main(): - parser = optparse.OptionParser() - parser.add_option('-d', '--directory', dest="dir" ) - parser.add_option('-p', '--prefix', dest="prefix" ) - (options, args) = parser.parse_args() - - if not options.dir: - usage() - parser.error("dir argument not given") - return - - names = [] - for root, dirs, files in os.walk(options.dir, topdown=False): - for filename in files: - if not filename.endswith(".fzp"): - continue - - fzpFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(fzpFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), fzpFilename - continue - - fzp = dom.documentElement - properties = fzp.getElementsByTagName("property") - for property in properties: - if property.getAttribute("name") == 'family': - value = getText(property.childNodes) - if not value in names: - names.append(value) - - if options.prefix != None: - for node in property.childNodes: - if node.nodeType == node.TEXT_NODE: - if not (options.prefix.lower() in node.data.lower()): - node.data = options.prefix + " " + node.data - outfile = open(fzpFilename, 'wb') - s = dom.toxml("UTF-8") - outfile.write(s) - outfile.close() - - break - break - - names.sort() - for name in names: - print name - - -def getText(nodelist): - rc = [] - for node in nodelist: - if node.nodeType == node.TEXT_NODE: - rc.append(node.data) - return ''.join(rc) - - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/listpropnames.py b/tools/part-gen-scripts/misc_scripts/listpropnames.py deleted file mode 100644 index bb9264705..000000000 --- a/tools/part-gen-scripts/misc_scripts/listpropnames.py +++ /dev/null @@ -1,62 +0,0 @@ -# usage: -# listpropnames.py -d -# -# is a folder containing .fzp files. In each fzp file in the directory containing a element: -# like -# list the name, if it's not already listed - -import getopt, sys, os, re - -def usage(): - print """ -usage: - listpropnames.py -d [directory] - - directory is a folder containing .fzp files. - In each fzp file in the directory containing a element: - list each different name attribute. - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(outputDir)): - usage() - sys.exit(2) - - - names = [] - for filename in os.listdir(outputDir): - if (filename.endswith(".fzp")): - infile = open(os.path.join(outputDir, filename), "r") - fzp = infile.read(); - infile.close(); - match = re.search('.+', fzp) - if (match != None): - if not (match.group(1) in names): - names.append(match.group(1)); - print "{0}".format(match.group(1)) - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/oldfamily.py b/tools/part-gen-scripts/misc_scripts/oldfamily.py deleted file mode 100644 index 094778367..000000000 --- a/tools/part-gen-scripts/misc_scripts/oldfamily.py +++ /dev/null @@ -1,70 +0,0 @@ -# usage: -# oldfamily.py -d -# -# is a folder containing .fzp files. In each fzp file in the directory containing a text element: -# like x -# the text is renamed to "obsolete x" and saved back to the file - -import getopt, sys, os, re - -def usage(): - print """ -usage: - oldfamily.py -d [directory] - - directory is a folder containing .fzp files. - In each fzp file in the directory containing a text element: - like x - the text is renamed to "obsolete x" and saved back to the file. - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(outputDir)): - usage() - sys.exit(2) - - - for filename in os.listdir(outputDir): - if (filename.endswith(".fzp")): - infile = open(os.path.join(outputDir, filename), "r") - fzp = infile.read(); - infile.close(); - match = re.search('()(.+)()', fzp) - if (match != None): - if (not match.group(2).startswith("obsolete")): - oldfzp = "" - if match.group(2).startswith("old "): - oldfzp = re.sub(r'()old (.+)()', r'\1obsolete \2\3', fzp); - else: - oldfzp = re.sub(r'()(.+)()', r'\1obsolete \2\3', fzp); - print "{0}:{1}".format(filename, match.group(2)) - outfile = open(os.path.join(outputDir, filename), "w") - outfile.write(oldfzp); - outfile.close() - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/pathNoText.py b/tools/part-gen-scripts/misc_scripts/pathNoText.py deleted file mode 100644 index 99e9fcde3..000000000 --- a/tools/part-gen-scripts/misc_scripts/pathNoText.py +++ /dev/null @@ -1,61 +0,0 @@ -# usage: -# copperNoSilkscreen.py -d -# -# is a folder, with subfolders, containing .fzp files. In each fzp file in the directory or its children -# look for "copper" and "silkscreen" - -import getopt, sys, os, re - -def usage(): - print """ -usage: - pathNoText.py -d [directory] - - directory is a folder containing .svg files. - In each fzp file in the directory or its subfolders, - look for "" and no "". - """ - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - return - outputDir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - return - else: - assert False, "unhandled option" - - if not(outputDir) : - usage() - return - - - for root, dirs, files in os.walk(outputDir, topdown=False): - for filename in files: - if filename.endswith(".svg"): - infile = open(os.path.join(root, filename), "r") - svg = infile.read() - infile.close() - textMatch = ' -# -# is a folder containing .fzp files. -# save a csv file of props, tags, etc. to - -import getopt, sys, os, re, csv, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - props2csv.py -d -c - - is a folder containing .fzp files. - save a csv file of props, tags, etc. to - """ - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:c:", ["help", "directory", "csv"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - csvPath = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-c", "--csv"): - csvPath = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if not outputDir: - usage() - sys.exit(2) - - if not csvPath: - usage() - sys.exit(2) - - writer = None - file = None - try: - file = open(csvPath, 'wb') - writer = csv.writer(file, delimiter=',') - writer.writerow(["fzp","location","title","description","family","props","tags","taxonomy"] ) - except: - print "unable to save to", csvPath - sys.exit(2) - - names = [] - for filename in os.listdir(outputDir): - if (filename.endswith(".fzp")): - fzpFilename = os.path.join(outputDir, filename) - try: - dom = xml.dom.minidom.parse(fzpFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), fzpFilename - continue - - theLine = filename + "," - - fzp = dom.documentElement - - titleText = "" - titles = fzp.getElementsByTagName("title") - for title in titles: - titleText = getText(title.childNodes) - break # assume only one title - - taxonomyText = "" - taxonomies = fzp.getElementsByTagName("taxonomy") - for taxonomy in taxonomies: - taxonomyText = getText(taxonomy.childNodes) - break # assume only one title - - location = "core" - if "contrib" in fzpFilename: - location = "contrib" - elif "resource" in fzpFilename: - location = "resources" - - descriptionText = "" - descriptions = fzp.getElementsByTagName("description") - for description in descriptions: - descriptionText = getText(description.childNodes) - break # assume only one description - - tagsText = "" - tags = fzp.getElementsByTagName("tag") - for tag in tags: - tagsText += getText(tag.childNodes) + "\n" - - familyText = "" - propertiesText = "" - properties = fzp.getElementsByTagName("property") - for property in properties: - name = property.getAttribute('name') - value = getText(property.childNodes) - propertiesText += name + ":" + value + "\n" - if name == "family": - familyText = value - - writer.writerow([filename, location, titleText.encode("utf-8"), descriptionText.encode("utf-8"), familyText.encode("utf-8"), propertiesText.encode("utf-8"), tagsText.encode("utf-8"), taxonomyText.encode("utf-8")]) - - if file: - file.close() - - -def getText(nodelist): - rc = [] - for node in nodelist: - if node.nodeType == node.TEXT_NODE: - rc.append(node.data) - return ''.join(rc) - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/replacedby.py b/tools/part-gen-scripts/misc_scripts/replacedby.py deleted file mode 100644 index d19eb5e1a..000000000 --- a/tools/part-gen-scripts/misc_scripts/replacedby.py +++ /dev/null @@ -1,80 +0,0 @@ -# usage: -# replacedby.py -d -# -# is a folder containing .fzp files. add a some name - -import getopt, sys, os, re - -def usage(): - print """ -usage: - replacedby.py -d [directory] - - directory is a folder containing .fzp files. - add a some name - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(outputDir)): - usage() - sys.exit(2) - - - for filename in os.listdir(outputDir): - if (filename.endswith(".fzp")): - infile = open(os.path.join(outputDir, filename), "r") - fzp = infile.read(); - infile.close(); - match = re.search('(.+)', fzp) - if (match == None): - newprop = "" - if filename.startswith("resistor"): - newprop = 'ResistorModuleID' - elif filename.startswith("generic-female-header_"): - fmatch = re.search('generic-female-header_(\d+)\.', filename) - newprop = 'generic_female_pin_header_' + fmatch.group(1) + '_100mil' - elif filename.startswith("generic-female-header-rounded_"): - fmatch = re.search('generic-female-header-rounded_(\d+)\.', filename) - newprop = 'generic_rounded_female_pin_header_' + fmatch.group(1) + '_100mil' - elif filename.startswith("generic-male-header_"): - fmatch = re.search('generic-male-header_(\d+)\.', filename) - newprop = 'generic_male_pin_header_' + fmatch.group(1) + '_100mil' - elif filename.startswith("mystery_part"): - fmatch = re.search('mystery_part(\d+)\.', filename) - newprop = 'mystery_part_' + fmatch.group(1) - elif filename.startswith("pcb-plain"): - newprop = 'RectanglePCBModuleID' - - if (newprop): - newfzp = fzp.replace(" -# -# is a folder containing schematic .svg files. -# save a csv file to - -import getopt, sys, os, re, csv, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - schem2csv.py -d -c - - is a folder containing .svg files. - save a csv file to - """ - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:c:", ["help", "directory", "csv"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - csvPath = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-c", "--csv"): - csvPath = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if not outputDir: - usage() - sys.exit(2) - - if not csvPath: - usage() - sys.exit(2) - - writer = None - file = None - try: - file = open(csvPath, 'wb') - writer = csv.writer(file, delimiter=',') - writer.writerow(["current svg","location","disp","use svg"] ) - writer.writerow(["","","rectangular\nillustrated\nsparkfun","path of sparkfun svg to use"] ) - writer.writerow(["","","",""] ) - except: - print "unable to save to", csvPath - sys.exit(2) - - names = [] - for filename in os.listdir(outputDir): - if (filename.endswith(".svg")): - svgFilename = os.path.join(outputDir, filename) - try: - dom = xml.dom.minidom.parse(svgFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), svgFilename - continue - - svg = dom.documentElement - viewBox = svg.getAttribute("viewBox").split(" ") - area = sys.float_info.max - if len(viewBox) != 4: - print "no viewBox in", svgFilename - else: - try: - viewBoxWidth = float(viewBox[2]) - float(viewBox[0]) - viewBoxHeight = float(viewBox[3]) - float(viewBox[1]) - area = viewBoxWidth * viewBoxHeight * 0.75 - if (area <= 0): - print "bad viewBox (1) in", svgFilename - except: - print "bad viewBox (2) in", svgFilename - - disp = "illustrated" - rects = svg.getElementsByTagName("rect") - for rect in rects: - try: - width = float(rect.getAttribute("width")) - height = float(rect.getAttribute("height")) - if width * height > area: - disp = "rectangular" - break - except: - print "bad rect in", svgFilename - - location = "core" - if "contrib" in svgFilename: - location = "contrib" - - writer.writerow([filename, location, disp, ""]) - - if file: - file.close() - - -def getText(nodelist): - rc = [] - for node in nodelist: - if node.nodeType == node.TEXT_NODE: - rc.append(node.data) - return ''.join(rc) - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/schemmatch.py b/tools/part-gen-scripts/misc_scripts/schemmatch.py deleted file mode 100644 index 35a5acdaf..000000000 --- a/tools/part-gen-scripts/misc_scripts/schemmatch.py +++ /dev/null @@ -1,69 +0,0 @@ - -import getopt, sys, os, re - -def usage(): - print """ -usage: - schemmatch.py -f - - looks for all svgs in fritzing parts/whatever and tries to find a matching obsolete/0.3.schem. file - ignore the ones that start with sparkfun- - """ - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "f:", ["fritzing"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - return - - fritzingDir = None - - for o, a in opts: - #print o - #print a - if o in ("-f", "--fritzing"): - fritzingDir = a - else: - print "unhandled option", o - usage() - return - - if not fritzingDir: - usage() - return - - for root, dirs, files in os.walk(fritzingDir, topdown=False): - for name in files: - if not name.endswith("svg"): - continue - if name.startswith("sparkfun-"): - continue - - fullname = os.path.join(root, name) - pathlist = fullname.split(os.sep) - if pathlist[-4] != "svg": - continue - - if pathlist[-3] == "obsolete": - continue - - if pathlist[-2] != "schematic": - continue - - pathlist[-3] = "obsolete" - pathlist[-1] = "0.3.schem." + pathlist[-1] - - try: - with open(os.sep.join(pathlist)): - pass - except IOError: - print "no 0.3.schem for", fullname - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/schemobs.py b/tools/part-gen-scripts/misc_scripts/schemobs.py deleted file mode 100644 index acbfe54a2..000000000 --- a/tools/part-gen-scripts/misc_scripts/schemobs.py +++ /dev/null @@ -1,95 +0,0 @@ - -import getopt, sys, os, re - -def usage(): - print """ -usage: - schemobs.py -f -h -g - - in the /svg/core/schematic folder match files from the -h and -g folders - print the list of files unaccounted for in -f and -g - ignore the ones that start with sparkfun- - """ - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "h:g:f:", ["hand", "generated", "fritzing"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - fritzingDir = None - handDir = None - generatedDir = None - - for o, a in opts: - #print o - #print a - if o in ("-h", "--hand"): - handDir = a - elif o in ("-g", "--generated"): - generatedDir = a - elif o in ("-f", "--fritzing"): - fritzingDir = a - else: - print "unhandled option", o - usage() - return - - - if not fritzingDir: - usage() - return - - if not generatedDir: - usage() - return - - if not handDir: - usage() - return - - toMatch = [] - schemDir = os.path.join(fritzingDir, "parts", "svg", "core", "schematic") - for filename in os.listdir(schemDir): - if filename.startswith("sparkfun-"): - continue - - toMatch.append(filename) - - - for filename in os.listdir(handDir): - if not filename in toMatch: - print "unable to find {0} from hand".format(filename) - else: - toMatch.remove(filename) - - for filename in os.listdir(generatedDir): - if not filename in toMatch: - print "unable to find {0} from generated".format(filename) - else: - toMatch.remove(filename) - - print "" - pdbDir = os.path.join(fritzingDir, "pdb", "core") - fzps = [] - for filename in os.listdir(pdbDir): - infile = open(os.path.join(pdbDir, filename), "r") - txt = infile.read() - infile.close() - for matchName in toMatch: - if matchName in txt: - print "no match for {0} in {1}".format(matchName, filename) - fzps.append(filename) - toMatch.remove(matchName) - break - - print "" - for filename in fzps: - print filename - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/schemobscopy.py b/tools/part-gen-scripts/misc_scripts/schemobscopy.py deleted file mode 100644 index 0ad1f6d2b..000000000 --- a/tools/part-gen-scripts/misc_scripts/schemobscopy.py +++ /dev/null @@ -1,70 +0,0 @@ - -import getopt, sys, os, re, shutil - -def usage(): - print """ -usage: - schemobscopy.py -f -h -g - - in the /svg/core/schematic folder match files from the -h and -g folders - copy the old files into obsolete with a prefix of "0.3.schem" and copy the new files into place - """ - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "h:g:f:", ["hand", "generated", "fritzing"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - fritzingDir = None - handDir = None - generatedDir = None - - for o, a in opts: - #print o - #print a - if o in ("-h", "--hand"): - handDir = a - elif o in ("-g", "--generated"): - generatedDir = a - elif o in ("-f", "--fritzing"): - fritzingDir = a - else: - print "unhandled option", o - usage() - return - - - if not fritzingDir: - usage() - return - - if not generatedDir: - usage() - return - - if not handDir: - usage() - return - - for filename in os.listdir(handDir): - copyOne(filename, handDir, fritzingDir) - - for filename in os.listdir(generatedDir): - copyOne(filename, generatedDir, fritzingDir) - -def copyOne(filename, fromDir, fritzingDir): - schDir = os.path.join(fritzingDir, "parts", "svg", "core", "schematic") - obsDir = os.path.join(fritzingDir, "parts", "svg", "obsolete", "schematic") - try: - shutil.copy(os.path.join(schDir, filename), os.path.join(obsDir, "0.3.schem." + filename)) - shutil.copy(os.path.join(fromDir, filename), os.path.join(schDir, filename)) - except: - print "unable to copy", filename - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/strokenostrokewidth.py b/tools/part-gen-scripts/misc_scripts/strokenostrokewidth.py deleted file mode 100644 index c932abfba..000000000 --- a/tools/part-gen-scripts/misc_scripts/strokenostrokewidth.py +++ /dev/null @@ -1,98 +0,0 @@ -# usage: -# strokenostrokewidth.py -d [svg folder] -f yes/no -# looks for stroke attribute with no stroke-width attribute; if -f is "yes" then set stroke-width to 1 - - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - strokenostrokewidth.py -d [svg folder] -f yes - looks for stroke attribute with no stroke-width attribute; if -f is "yes" then set stroke-width to 1 -""" - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hf:d:", ["help", "fix", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - dir = None - fix = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - elif o in ("-f", "--fix"): - fix = a - else: - assert False, "unhandled option" - - if(not(dir)): - usage() - sys.exit(2) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".svg"): - continue - - svgFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(svgFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), svgFilename - continue - - changed = 0 - todo = [dom.documentElement] - while len(todo) > 0: - element = todo.pop(0) - for node in element.childNodes: - if node.nodeType == node.ELEMENT_NODE: - todo.append(node) - stroke = element.getAttribute("stroke") - strokewidth = element.getAttribute("stroke-width") - if len(stroke) == 0: - style = element.getAttribute("style") - if len(style) != 0: - style = style.replace(";", ":") - styles = style.split(":") - for index, name in enumerate(styles): - if name == "stroke": - stroke = styles[index + 1] - elif name == "stroke-width": - strokewidth = styles[index + 1] - - if len(stroke) > 0 and stroke != "none": - if len(strokewidth) == 0: - print "no stroke width", svgFilename # , - if fix != "yes": - break - - # print "fixing", element.toxml("UTF-8") - element.setAttribute("stroke-width", "1") - changed = 1 - - if changed: - outfile = open(svgFilename, 'wb') - s = dom.toxml("UTF-8") - outfile.write(s) - outfile.flush() - outfile.close() - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/svgNoLayer.py b/tools/part-gen-scripts/misc_scripts/svgNoLayer.py deleted file mode 100644 index b4ecf78a0..000000000 --- a/tools/part-gen-scripts/misc_scripts/svgNoLayer.py +++ /dev/null @@ -1,111 +0,0 @@ -# usage: -# svgNoLayer.py -d -# -# is a folder, with subfolders, containing .svg files. In each svg file in the directory or its children -# look for id='[layer]' where layer is the set of all layers in fritzing - -import getopt, sys, os, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - svgNoLayer.py -d [directory] - - is a folder, with subfolders, containing .svg files. In each svg file in the directory or its children - look for id='[layer]' where layer is the set of all layers in fritzing - """ -layers = ["icon","breadboardbreadboard", "breadboard", "breadboardWire", "breadboardLabel", "breadboardNote", "breadboardRuler", "schematic", "schematicWire","schematicTrace","schematicLabel", "schematicRuler", "board", "ratsnest", "silkscreen", "silkscreenLabel", "groundplane", "copper0", "copper0trace", "groundplane1", "copper1", "copper1trace", "silkscreen0", "silkscreen0Label", "soldermask", "outline", "keepout", "partimage", "pcbNote", "pcbRuler"] - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(outputDir)): - usage() - sys.exit(2) - - - for root, dirs, files in os.walk(outputDir, topdown=False): - for filename in files: - if (filename.endswith(".svg")): - infile = open(os.path.join(root, filename), "r") - svg = infile.read() - infile.close() - match = None - for layer in layers: - match = re.search('id=[\'\"]' + layer, svg) - if (match != None): - break - - if match == None: - print "{0} {1}".format(os.path.join(root, filename), "has no layer ids") - else: - - msg = parseIDs(svg) - if (msg != None): - print "{0} {1}".format(os.path.join(root, filename), msg) - - -def parseIDs(svg): - try: - dom = xml.dom.minidom.parseString(svg) - except xml.parsers.expat.ExpatError, err: - return "xml error " + str(err) - - root = dom.documentElement - id = root.getAttribute("id") - if id != None: - for layer in layers: - if (layer == id): - return "svg contains layer id " + id - - for c in root.childNodes: - if c.nodeType != c.ELEMENT_NODE: - continue - - tag = c.tagName - if tag == "metadata": - continue - if tag == "title": - continue - if tag == "desc": - continue - if tag == "defs": - continue - if tag == "sodipodi:namedview": - continue - - gotOne = 0 - id = c.getAttribute("id") - if (id != None): - for layer in layers: - if (layer == id): - gotOne = 1 - break - - if gotOne == 0: - return "child element '" + tag + "' with no layer id" - - return None - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/syncconnectors.py b/tools/part-gen-scripts/misc_scripts/syncconnectors.py deleted file mode 100644 index 58fab907e..000000000 --- a/tools/part-gen-scripts/misc_scripts/syncconnectors.py +++ /dev/null @@ -1,209 +0,0 @@ - -import getopt, sys, os, os.path, re -import xml.etree.ElementTree as ETree -import traceback - -def usage(): - print """ -usage: - syncconnectors.py -o { old fzp file } -n { new fzp file } -c { output csv file } -a - adds 'replacedby' attribute to old connectors to point to new ones, when a partial name match is found - overwrites the old fzp file, and saves record of changes to the csv file. - to append to the csv file rather than overwrite it, use the -a option -""" - -IndexFinder = None - -def getIndex(element): - global IndexFinder - - id = element.attrib.get("id") - if id == None: - return -1 - - match = IndexFinder.search(id) - if match == None: - return -1 - - return int(match.group(1)) - - - -def main(): - global IndexFinder - - try: - opts, args = getopt.getopt(sys.argv[1:], "ho:n:c:a", ["help", "old", "new","csv","append"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - return - - oldfn = None - newfn = None - csvfn = None - append = False - - for o, a in opts: - #print o - #print a - if o in ("-o", "--old"): - oldfn = a - elif o in ("-n", "--new"): - newfn = a - elif o in ("-c", "--csv"): - csvfn = a - elif o in ("-a", "--append"): - append = True - elif o in ("-h", "--help"): - usage() - return - else: - assert False, "unhandled option" - - if oldfn == None: - print "'old' argument missing" - usage() - return - - if newfn == None: - print "'new' argument missing" - usage() - return - - if csvfn == None: - print "'csv' argument missing" - usage() - return - - if not append: - try: - os.remove(csvfn) - except: - pass - - csvfile = None - try: - flags = "w" - if append: - flags = "a" - csvfile = open(csvfn, flags) - except: - pass - - if csvfile == None: - print "unable to open", csvfn - usage() - return - - oldroot = None - newroot = None - try: - oldroot = ETree.parse(oldfn) - newroot = ETree.parse(newfn) - except : - info = sys.exc_info() - traceback.print_exception(info[0], info[1], info[2]) - return - - pattern = r'(\d+)' - IndexFinder = re.compile(pattern, re.IGNORECASE) - - newelements = newroot.findall(".//connector") - newelements.sort(key=getIndex) - newelementmarkers = [None] * len(newelements) - - oldelements = oldroot.findall(".//connector") - oldelements.sort(key=getIndex) - oldelementmarkers = [None] * len(oldelements) - - for oldix in range(0, len(oldelements)): - oldelement = oldelements[oldix] - oldname = oldelement.attrib.get("name") - for newix in range(0, len(newelements)): - if newelementmarkers[newix] != None: - continue - - newelement = newelements[newix] - if newelement.attrib.get("name") == oldname: - oldelementmarkers[oldix] = newelements[newix] - newelementmarkers[newix] = oldelements[oldix] - break - - for oldix in range(0, len(oldelements)): - if oldelementmarkers[oldix] != None: - continue - - oldelement = oldelements[oldix] - oldname = oldelement.attrib.get("name").lower() - for newix in range(0, len(newelements)): - if newelementmarkers[newix] != None: - continue - - newelement = newelements[newix] - newname = newelement.attrib.get("name").lower() - if (newname in oldname) or (oldname in newname): - oldelementmarkers[oldix] = newelements[newix] - newelementmarkers[newix] = oldelements[oldix] - oldelement.attrib['replacedby'] = newelements[newix].attrib["name"] - break - - for oldix in range(0, len(oldelements)): - if oldelementmarkers[oldix] != None: - continue - - oldelement = oldelements[oldix] - oldname = oldelement.attrib.get("name").lower() - for newix in range(0, len(newelements)): - if newelementmarkers[newix] != None: - continue - - newelement = newelements[newix] - newname = newelement.attrib.get("name").lower() - if (oldname == "rst" and newname == "reset") or ("d0" in oldname and "d0" in newname) or ("d1" in oldname and "d1" in newname): - oldelementmarkers[oldix] = newelements[newix] - newelementmarkers[newix] = oldelements[oldix] - oldelement.attrib['replacedby'] = newelements[newix].attrib["name"] - break - - formatstring = ",{oldid},{oldname},{action},{newid},{newname}\n" - - if append: - csvfile.write("\n") - - csvfile.write("{0} => {1},,,,,\n".format(os.path.basename(oldfn), os.path.basename(newfn))) - - for oldix in range(0, len(oldelements)): - oldelement = oldelements[oldix] - oldmarker = oldelementmarkers[oldix] - oldid = oldelement.attrib.get("id") - oldname = oldelement.attrib.get("name") - if oldmarker == None: - csvfile.write(formatstring.format(oldid=oldid, oldname=oldname, action="not found", newid="", newname="")) - continue - - newid = oldmarker.attrib.get("id") - newname = oldmarker.attrib.get("name") - if oldname.lower() == newname.lower(): - csvfile.write(formatstring.format(oldid=oldid, oldname=oldname, action="same", newid=newid, newname=newname)) - continue - - csvfile.write(formatstring.format(oldid=oldid, oldname=oldname, action="replacedby", newid=newid, newname=newname)) - - for newix in range(0, len(newelements)): - newelement = newelements[newix] - newmarker = newelementmarkers[newix] - newid = newelement.attrib.get("id") - newname = newelement.attrib.get("name") - if newmarker == None: - csvfile.write(formatstring.format(oldid="", oldname="", action="not found", newid=newid, newname=newname)) - - csvfile.close() - oldroot.write(oldfn) - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/tagsmd.py b/tools/part-gen-scripts/misc_scripts/tagsmd.py deleted file mode 100644 index 831bc6ecc..000000000 --- a/tools/part-gen-scripts/misc_scripts/tagsmd.py +++ /dev/null @@ -1,105 +0,0 @@ -# usage: -# tagsmd.py -d [fzp folder] -# make sure each fzp has a smd -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - tagsmd.py -d [fzp folder] - add or update a package element. -""" - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - dir = None - typ = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if not(dir): - usage() - sys.exit(2) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".fzp"): - continue - if not filename.startswith("SMD"): - continue - - fzpFilename = os.path.join(root, filename) - infile = open(os.path.join(root, filename), "r") - content = infile.read() - infile.close() - try: - dom = xml.dom.minidom.parseString(content) - except xml.parsers.expat.ExpatError, err: - print str(err), fzpFilename - continue - - #print "testing", fzpFilename - - fzp = dom.documentElement - tags = None - tagsNodes = fzp.getElementsByTagName("tags") - if (tagsNodes.length == 0): - tags = dom.createElement("tags") - fzp.insertBefore(tags, fzp.firstChild) - elif (tagsNodes.length == 1): - tags = tagsNodes.item(0) - else: - print "multiple tags elements in", fzpFilename - continue - - - #print "got properties", properties - - tagNodes = tags.getElementsByTagName("tag") - smd = None - for tag in tagNodes: - tag.normalize() #make sure all the text is in one node - t = None - for child in tag.childNodes: - if child.nodeType == child.TEXT_NODE: - t = child - break - if t: - if t.nodeValue.lower() == "smd": - smd = t - break - - if smd == None: - smd = dom.createElement("tag") - tags.appendChild(smd) - t = dom.createTextNode("SMD") - smd.appendChild(t) - - print "adding smd tag to", fzpFilename - outfile = open(fzpFilename, 'wb') - s = dom.toxml("UTF-8") - outfile.write(s) - outfile.flush() - outfile.close() - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/thtsmd.py b/tools/part-gen-scripts/misc_scripts/thtsmd.py deleted file mode 100644 index 141bb48e6..000000000 --- a/tools/part-gen-scripts/misc_scripts/thtsmd.py +++ /dev/null @@ -1,128 +0,0 @@ -# usage: -# thtsms.py -d [fzp folder] -t [tht | smd] -# add or update a package element. - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - thtsmd.py -d [fzp folder] -t [tht | smd] - add or update a package element. -""" - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:t:", ["help", "directory", "type"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - dir = None - typ = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-t", "--type"): - typ = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if not(dir): - usage() - sys.exit(2) - - if not(typ): - usage() - sys.exit(2) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".fzp"): - continue - - fzpFilename = os.path.join(root, filename) - infile = open(os.path.join(root, filename), "r") - content = infile.read() - infile.close() - try: - dom = xml.dom.minidom.parseString(content) - except xml.parsers.expat.ExpatError, err: - print str(err), fzpFilename - continue - - #print "testing", fzpFilename - - fzp = dom.documentElement - properties = None - propertiesNodes = fzp.getElementsByTagName("properties") - if (propertiesNodes.length == 0): - properties = dom.createElement("properties") - fzp.insertBefore(properties, fzp.firstChild) - elif (propertiesNodes.length == 1): - properties = propertiesNodes.item(0) - else: - print "multiple properties elements in", fzpFilename - continue - - - #print "got properties", properties - - propertyNodes = properties.getElementsByTagName("property") - package = None - for property in propertyNodes: - name = property.getAttribute("name") - #print "got name", name - if name == "package": - package = property - break - - #print "got package", package - - if package == None: - package = dom.createElement("property") - properties.appendChild(package) - package.setAttribute("name", "package") - t = dom.createTextNode(typ) - package.appendChild(t) - else: - package.normalize() #make sure all the text is in one node - t = None - for child in package.childNodes: - if child.nodeType == child.TEXT_NODE: - t = child - break - - if t == None: - t = dom.createTextNode(typ) - package.appendChild(t) - else: - if ("SMD" in t.nodeValue): - continue - if ("THT" in t.nodeValue): - continue - - t1 = dom.createTextNode(" [" + typ + "]") - package.appendChild(t1) - package.normalize() - - print "adding package property " + typ + " to", fzpFilename - outfile = open(fzpFilename, 'wb') - s = dom.toxml("UTF-8") - outfile.write(s) - outfile.flush() - outfile.close() - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/unusedsvgs.py b/tools/part-gen-scripts/misc_scripts/unusedsvgs.py deleted file mode 100644 index 8ed450050..000000000 --- a/tools/part-gen-scripts/misc_scripts/unusedsvgs.py +++ /dev/null @@ -1,103 +0,0 @@ - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - unusedsvgs.py -f [fzp folder] -s [svg folder] - lists orphan svgs -""" - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hf:s:", ["help", "fzp", "svg"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - return - - fzpdir = None - svgdir = None - - for o, a in opts: - #print o - #print a - if o in ("-f", "--fzp"): - fzpdir = a - elif o in ("-s", "--svg"): - svgdir = a - elif o in ("-h", "--help"): - usage() - return - else: - print "unhandled option", o - return - - if not fzpdir: - print "missing fzp folder argument" - usage() - return - - if not svgdir: - print "missing svg folder argument" - usage() - return - - svgfiles = {} - for root, dirs, files in os.walk(svgdir, topdown=False): - for filename in files: - if not filename.endswith(".svg"): - continue - - basename = os.path.basename(root) - if svgfiles.get(basename) == None: - svgfiles[basename] = [] - - svgfiles[basename].append(filename) - - viewnames = ["iconView", "breadboardView", "schematicView", "pcbView"] - - for root, dirs, files in os.walk(fzpdir, topdown=False): - for filename in files: - if not filename.endswith(".fzp"): - continue - - fzpFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(fzpFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), fzpFilename - continue - - fzp = dom.documentElement - for viewname in viewnames: - viewNodes = fzp.getElementsByTagName(viewname) - for viewNode in viewNodes: - layersNodes = viewNode.getElementsByTagName("layers") - for layersNode in layersNodes: - image = layersNode.getAttribute("image") - dn = os.path.dirname(image) - viewFiles = svgfiles.get(dn) - if viewFiles: - fn = os.path.basename(image) - try: - if fn in viewFiles: - print "{0} uses {1}/{2}".format(os.path.basename(root), dn, fn) - viewFiles.remove(fn) - except: - pass - - - for key in svgfiles.keys(): - for name in svgfiles.get(key): - print "unused {0}/{1}".format(key, name) - - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/unzeroradius.py b/tools/part-gen-scripts/misc_scripts/unzeroradius.py deleted file mode 100644 index 7f16df6b3..000000000 --- a/tools/part-gen-scripts/misc_scripts/unzeroradius.py +++ /dev/null @@ -1,76 +0,0 @@ - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - unzeroradius.py -d [svg folder] - if a file has -# -# is a folder, with subfolders, containing .fzp files. In each fzp file in the directory or its children -# look for a element - -import getopt, sys, os, re - -def usage(): - print """ -usage: - version.py -d [directory] - - directory is a folder containing .fzp files. - In each fzp file in the directory or its subfolders, - look for a element. - """ - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - outputDir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - outputDir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(outputDir)): - usage() - sys.exit(2) - - - for root, dirs, files in os.walk(outputDir, topdown=False): - for filename in files: - if (filename.endswith(".fzp")): - infile = open(os.path.join(root, filename), "r") - fzp = infile.read(); - infile.close(); - match = re.search('()(.+)()', fzp) - oldfzp = None; - - if (match != None): - print "{0} {1}".format(os.path.join(root, filename), match.group(2)) - else: - print "{0} {1}".format(os.path.join(root, filename), "None") - - expr = r'(?P)(?P.+)(?P)' - if (match == None): - oldfzp = re.sub(r'()', r'\1\n1', fzp); - elif match.group(2) == "1.0": - oldfzp = re.sub(expr, r'\g1\g', fzp); - elif match.group(2) == "1.1": - oldfzp = re.sub(expr, r'\g2\g', fzp); - elif match.group(2) == "2.0": - oldfzp = re.sub(expr, r'\g3\g', fzp); - - if (oldfzp != None): - outfile = open(os.path.join(root, filename), "w") - outfile.write(oldfzp); - outfile.close() - - - -if __name__ == "__main__": - main() - diff --git a/tools/part-gen-scripts/misc_scripts/version4.py b/tools/part-gen-scripts/misc_scripts/version4.py deleted file mode 100644 index 0c2e6abb5..000000000 --- a/tools/part-gen-scripts/misc_scripts/version4.py +++ /dev/null @@ -1,86 +0,0 @@ -# usage: -# copper1fzp.py -d [fzp folder] -# add or update a element. - -import getopt, sys, os, os.path, re, xml.dom.minidom, xml.dom - -def usage(): - print """ -usage: - version.py -d [fzp folder] - add or update a element. -""" - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory"]) - except getopt.GetoptError, err: - # print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - dir = None - - for o, a in opts: - #print o - #print a - if o in ("-d", "--directory"): - dir = a - elif o in ("-h", "--help"): - usage() - sys.exit(2) - else: - assert False, "unhandled option" - - if(not(dir)): - usage() - sys.exit(2) - - for root, dirs, files in os.walk(dir, topdown=False): - for filename in files: - if not filename.endswith(".fzp"): - continue - - fzpFilename = os.path.join(root, filename) - try: - dom = xml.dom.minidom.parse(fzpFilename) - except xml.parsers.expat.ExpatError, err: - print str(err), fzpFilename - continue - - fzp = dom.documentElement - versionNodes = fzp.getElementsByTagName("version") - version = None - if (versionNodes.length == 0): - version = dom.createElement("version") - fzp.insertBefore(version, fzp.firstChild) - elif (versionNodes.length == 1): - txt = "" - version = versionNodes.item(0) - else: - print "multiple version elements in", fzpFilename - continue - - while version.hasChildNodes(): - oldChild = version.firstChild - version.removeChild(oldChild) - oldChild.unlink() - - vtext = dom.createTextNode("4") - version.appendChild(vtext) - - print "adding version 4 to", fzpFilename - outfile = open(fzpFilename, 'wb') - s = dom.toxml("UTF-8") - outfile.write(s) - outfile.flush() - outfile.close() - -if __name__ == "__main__": - main() - - - diff --git a/tools/part-gen-scripts/misc_scripts/checkResources.py b/tools/scripts/checkResources.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/checkResources.py rename to tools/scripts/checkResources.py diff --git a/tools/part-gen-scripts/misc_scripts/checkcopyright.py b/tools/scripts/checkcopyright.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/checkcopyright.py rename to tools/scripts/checkcopyright.py diff --git a/tools/part-gen-scripts/misc_scripts/checkino.py b/tools/scripts/checkino.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/checkino.py rename to tools/scripts/checkino.py diff --git a/tools/part-gen-scripts/misc_scripts/copyif.py b/tools/scripts/copyif.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/copyif.py rename to tools/scripts/copyif.py diff --git a/tools/part-gen-scripts/misc_scripts/fixino.py b/tools/scripts/fixino.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/fixino.py rename to tools/scripts/fixino.py diff --git a/tools/part-gen-scripts/misc_scripts/fzzrename.py b/tools/scripts/fzzrename.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/fzzrename.py rename to tools/scripts/fzzrename.py diff --git a/tools/part-gen-scripts/misc_scripts/getboardsize.py b/tools/scripts/getboardsize.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/getboardsize.py rename to tools/scripts/getboardsize.py diff --git a/tools/part-gen-scripts/misc_scripts/multifind.py b/tools/scripts/multifind.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/multifind.py rename to tools/scripts/multifind.py diff --git a/tools/part-gen-scripts/misc_scripts/875fzpzs.py b/tools/scripts/obsolete/875fzpzs.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/875fzpzs.py rename to tools/scripts/obsolete/875fzpzs.py diff --git a/tools/part-gen-scripts/misc_scripts/checksvnkywds.py b/tools/scripts/obsolete/checksvnkywds.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/checksvnkywds.py rename to tools/scripts/obsolete/checksvnkywds.py diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/README b/tools/scripts/obsolete/cheetah scripts/README similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/README rename to tools/scripts/obsolete/cheetah scripts/README diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/configs/arduino-pcb.cfg b/tools/scripts/obsolete/cheetah scripts/configs/arduino-pcb.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/configs/arduino-pcb.cfg rename to tools/scripts/obsolete/cheetah scripts/configs/arduino-pcb.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/configs/basic-resistor-025-svg.cfg b/tools/scripts/obsolete/cheetah scripts/configs/basic-resistor-025-svg.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/configs/basic-resistor-025-svg.cfg rename to tools/scripts/obsolete/cheetah scripts/configs/basic-resistor-025-svg.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/configs/basic-resistor-025.cfg b/tools/scripts/obsolete/cheetah scripts/configs/basic-resistor-025.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/configs/basic-resistor-025.cfg rename to tools/scripts/obsolete/cheetah scripts/configs/basic-resistor-025.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/configs/dip_cfg.cfg b/tools/scripts/obsolete/cheetah scripts/configs/dip_cfg.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/configs/dip_cfg.cfg rename to tools/scripts/obsolete/cheetah scripts/configs/dip_cfg.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/configs/mystery_part_cfg.cfg b/tools/scripts/obsolete/cheetah scripts/configs/mystery_part_cfg.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/configs/mystery_part_cfg.cfg rename to tools/scripts/obsolete/cheetah scripts/configs/mystery_part_cfg.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/configs/pin_header_cfg.cfg b/tools/scripts/obsolete/cheetah scripts/configs/pin_header_cfg.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/configs/pin_header_cfg.cfg rename to tools/scripts/obsolete/cheetah scripts/configs/pin_header_cfg.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/configs/screw_terminal_cfg.cfg b/tools/scripts/obsolete/cheetah scripts/configs/screw_terminal_cfg.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/configs/screw_terminal_cfg.cfg rename to tools/scripts/obsolete/cheetah scripts/configs/screw_terminal_cfg.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/configs/sip_cfg.cfg b/tools/scripts/obsolete/cheetah scripts/configs/sip_cfg.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/configs/sip_cfg.cfg rename to tools/scripts/obsolete/cheetah scripts/configs/sip_cfg.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/bread/placeholder.txt b/tools/scripts/obsolete/cheetah scripts/deleteme/bread/placeholder.txt similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/bread/placeholder.txt rename to tools/scripts/obsolete/cheetah scripts/deleteme/bread/placeholder.txt diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/config/placeholder.txt b/tools/scripts/obsolete/cheetah scripts/deleteme/config/placeholder.txt similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/config/placeholder.txt rename to tools/scripts/obsolete/cheetah scripts/deleteme/config/placeholder.txt diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/fzp/placeholder.txt b/tools/scripts/obsolete/cheetah scripts/deleteme/fzp/placeholder.txt similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/fzp/placeholder.txt rename to tools/scripts/obsolete/cheetah scripts/deleteme/fzp/placeholder.txt diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/pcb/placeholder.txt b/tools/scripts/obsolete/cheetah scripts/deleteme/pcb/placeholder.txt similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/pcb/placeholder.txt rename to tools/scripts/obsolete/cheetah scripts/deleteme/pcb/placeholder.txt diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/schem/placeholder.txt b/tools/scripts/obsolete/cheetah scripts/deleteme/schem/placeholder.txt similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/deleteme/schem/placeholder.txt rename to tools/scripts/obsolete/cheetah scripts/deleteme/schem/placeholder.txt diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/dip.bat b/tools/scripts/obsolete/cheetah scripts/dip.bat similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/dip.bat rename to tools/scripts/obsolete/cheetah scripts/dip.bat diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/mystery_part.bat b/tools/scripts/obsolete/cheetah scripts/mystery_part.bat similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/mystery_part.bat rename to tools/scripts/obsolete/cheetah scripts/mystery_part.bat diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/output/breadboard/placeholder.txt b/tools/scripts/obsolete/cheetah scripts/output/breadboard/placeholder.txt similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/output/breadboard/placeholder.txt rename to tools/scripts/obsolete/cheetah scripts/output/breadboard/placeholder.txt diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/output/icon/placeholder.txt b/tools/scripts/obsolete/cheetah scripts/output/icon/placeholder.txt similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/output/icon/placeholder.txt rename to tools/scripts/obsolete/cheetah scripts/output/icon/placeholder.txt diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/partomatic.py b/tools/scripts/obsolete/cheetah scripts/partomatic.py similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/partomatic.py rename to tools/scripts/obsolete/cheetah scripts/partomatic.py diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/pin_header.bat b/tools/scripts/obsolete/cheetah scripts/pin_header.bat similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/pin_header.bat rename to tools/scripts/obsolete/cheetah scripts/pin_header.bat diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/screw_terminal.bat b/tools/scripts/obsolete/cheetah scripts/screw_terminal.bat similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/screw_terminal.bat rename to tools/scripts/obsolete/cheetah scripts/screw_terminal.bat diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/sip.bat b/tools/scripts/obsolete/cheetah scripts/sip.bat similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/sip.bat rename to tools/scripts/obsolete/cheetah scripts/sip.bat diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/arduino-pcb.svg b/tools/scripts/obsolete/cheetah scripts/templates/arduino-pcb.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/arduino-pcb.svg rename to tools/scripts/obsolete/cheetah scripts/templates/arduino-pcb.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/basic-resistor.fzp-save b/tools/scripts/obsolete/cheetah scripts/templates/basic-resistor.fzp-save similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/basic-resistor.fzp-save rename to tools/scripts/obsolete/cheetah scripts/templates/basic-resistor.fzp-save diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/basic-resistor.svg b/tools/scripts/obsolete/cheetah scripts/templates/basic-resistor.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/basic-resistor.svg rename to tools/scripts/obsolete/cheetah scripts/templates/basic-resistor.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip.cfg b/tools/scripts/obsolete/cheetah scripts/templates/dip.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip.cfg rename to tools/scripts/obsolete/cheetah scripts/templates/dip.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip.fzp-save b/tools/scripts/obsolete/cheetah scripts/templates/dip.fzp-save similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip.fzp-save rename to tools/scripts/obsolete/cheetah scripts/templates/dip.fzp-save diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip_bread.svg b/tools/scripts/obsolete/cheetah scripts/templates/dip_bread.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip_bread.svg rename to tools/scripts/obsolete/cheetah scripts/templates/dip_bread.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip_pcb.svg b/tools/scripts/obsolete/cheetah scripts/templates/dip_pcb.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip_pcb.svg rename to tools/scripts/obsolete/cheetah scripts/templates/dip_pcb.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip_schem.svg b/tools/scripts/obsolete/cheetah scripts/templates/dip_schem.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/dip_schem.svg rename to tools/scripts/obsolete/cheetah scripts/templates/dip_schem.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header-rounded.fzp-save b/tools/scripts/obsolete/cheetah scripts/templates/generic-female-header-rounded.fzp-save similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header-rounded.fzp-save rename to tools/scripts/obsolete/cheetah scripts/templates/generic-female-header-rounded.fzp-save diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header-rounded_bread.svg b/tools/scripts/obsolete/cheetah scripts/templates/generic-female-header-rounded_bread.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header-rounded_bread.svg rename to tools/scripts/obsolete/cheetah scripts/templates/generic-female-header-rounded_bread.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header.fzp-save b/tools/scripts/obsolete/cheetah scripts/templates/generic-female-header.fzp-save similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header.fzp-save rename to tools/scripts/obsolete/cheetah scripts/templates/generic-female-header.fzp-save diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header_bread.svg b/tools/scripts/obsolete/cheetah scripts/templates/generic-female-header_bread.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header_bread.svg rename to tools/scripts/obsolete/cheetah scripts/templates/generic-female-header_bread.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header_schem.svg b/tools/scripts/obsolete/cheetah scripts/templates/generic-female-header_schem.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-female-header_schem.svg rename to tools/scripts/obsolete/cheetah scripts/templates/generic-female-header_schem.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-male-header.fzp-save b/tools/scripts/obsolete/cheetah scripts/templates/generic-male-header.fzp-save similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-male-header.fzp-save rename to tools/scripts/obsolete/cheetah scripts/templates/generic-male-header.fzp-save diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-male-header_bread.svg b/tools/scripts/obsolete/cheetah scripts/templates/generic-male-header_bread.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-male-header_bread.svg rename to tools/scripts/obsolete/cheetah scripts/templates/generic-male-header_bread.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-male-header_schem.svg b/tools/scripts/obsolete/cheetah scripts/templates/generic-male-header_schem.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/generic-male-header_schem.svg rename to tools/scripts/obsolete/cheetah scripts/templates/generic-male-header_schem.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/jumper_3.5mm_pcb.svg b/tools/scripts/obsolete/cheetah scripts/templates/jumper_3.5mm_pcb.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/jumper_3.5mm_pcb.svg rename to tools/scripts/obsolete/cheetah scripts/templates/jumper_3.5mm_pcb.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/jumper_pcb.svg b/tools/scripts/obsolete/cheetah scripts/templates/jumper_pcb.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/jumper_pcb.svg rename to tools/scripts/obsolete/cheetah scripts/templates/jumper_pcb.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part.cfg b/tools/scripts/obsolete/cheetah scripts/templates/mystery_part.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part.cfg rename to tools/scripts/obsolete/cheetah scripts/templates/mystery_part.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part.fzp-save b/tools/scripts/obsolete/cheetah scripts/templates/mystery_part.fzp-save similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part.fzp-save rename to tools/scripts/obsolete/cheetah scripts/templates/mystery_part.fzp-save diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part_bread.svg b/tools/scripts/obsolete/cheetah scripts/templates/mystery_part_bread.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part_bread.svg rename to tools/scripts/obsolete/cheetah scripts/templates/mystery_part_bread.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part_dual_bread.svg b/tools/scripts/obsolete/cheetah scripts/templates/mystery_part_dual_bread.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part_dual_bread.svg rename to tools/scripts/obsolete/cheetah scripts/templates/mystery_part_dual_bread.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part_schem.svg b/tools/scripts/obsolete/cheetah scripts/templates/mystery_part_schem.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/mystery_part_schem.svg rename to tools/scripts/obsolete/cheetah scripts/templates/mystery_part_schem.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/pin_header.cfg b/tools/scripts/obsolete/cheetah scripts/templates/pin_header.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/pin_header.cfg rename to tools/scripts/obsolete/cheetah scripts/templates/pin_header.cfg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/screw_terminal.fzp-save b/tools/scripts/obsolete/cheetah scripts/templates/screw_terminal.fzp-save similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/screw_terminal.fzp-save rename to tools/scripts/obsolete/cheetah scripts/templates/screw_terminal.fzp-save diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/screw_terminal_bread.svg b/tools/scripts/obsolete/cheetah scripts/templates/screw_terminal_bread.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/screw_terminal_bread.svg rename to tools/scripts/obsolete/cheetah scripts/templates/screw_terminal_bread.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/screw_terminal_pcb.svg b/tools/scripts/obsolete/cheetah scripts/templates/screw_terminal_pcb.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/screw_terminal_pcb.svg rename to tools/scripts/obsolete/cheetah scripts/templates/screw_terminal_pcb.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/screw_terminal_schem.svg b/tools/scripts/obsolete/cheetah scripts/templates/screw_terminal_schem.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/screw_terminal_schem.svg rename to tools/scripts/obsolete/cheetah scripts/templates/screw_terminal_schem.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/sip.fzp-save b/tools/scripts/obsolete/cheetah scripts/templates/sip.fzp-save similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/sip.fzp-save rename to tools/scripts/obsolete/cheetah scripts/templates/sip.fzp-save diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/sip_bread.svg b/tools/scripts/obsolete/cheetah scripts/templates/sip_bread.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/sip_bread.svg rename to tools/scripts/obsolete/cheetah scripts/templates/sip_bread.svg diff --git a/tools/part-gen-scripts/obsolete/cheetah scripts/templates/sip_schem.svg b/tools/scripts/obsolete/cheetah scripts/templates/sip_schem.svg similarity index 100% rename from tools/part-gen-scripts/obsolete/cheetah scripts/templates/sip_schem.svg rename to tools/scripts/obsolete/cheetah scripts/templates/sip_schem.svg diff --git a/tools/part-gen-scripts/obsolete/dilPackageGenerator/DilPackageGenerator.tmproj b/tools/scripts/obsolete/dilPackageGenerator/DilPackageGenerator.tmproj similarity index 100% rename from tools/part-gen-scripts/obsolete/dilPackageGenerator/DilPackageGenerator.tmproj rename to tools/scripts/obsolete/dilPackageGenerator/DilPackageGenerator.tmproj diff --git a/tools/part-gen-scripts/obsolete/dilPackageGenerator/defaults.cfg b/tools/scripts/obsolete/dilPackageGenerator/defaults.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/dilPackageGenerator/defaults.cfg rename to tools/scripts/obsolete/dilPackageGenerator/defaults.cfg diff --git a/tools/part-gen-scripts/obsolete/dilPackageGenerator/dilpackage_fzp.tmpl b/tools/scripts/obsolete/dilPackageGenerator/dilpackage_fzp.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/dilPackageGenerator/dilpackage_fzp.tmpl rename to tools/scripts/obsolete/dilPackageGenerator/dilpackage_fzp.tmpl diff --git a/tools/part-gen-scripts/obsolete/dilPackageGenerator/dilpackage_icon_svg.tmpl b/tools/scripts/obsolete/dilPackageGenerator/dilpackage_icon_svg.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/dilPackageGenerator/dilpackage_icon_svg.tmpl rename to tools/scripts/obsolete/dilPackageGenerator/dilpackage_icon_svg.tmpl diff --git a/tools/part-gen-scripts/obsolete/dilPackageGenerator/dilpackage_schematic_svg.tmpl b/tools/scripts/obsolete/dilPackageGenerator/dilpackage_schematic_svg.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/dilPackageGenerator/dilpackage_schematic_svg.tmpl rename to tools/scripts/obsolete/dilPackageGenerator/dilpackage_schematic_svg.tmpl diff --git a/tools/part-gen-scripts/obsolete/dilPackageGenerator/dilpackage_svg.tmpl b/tools/scripts/obsolete/dilPackageGenerator/dilpackage_svg.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/dilPackageGenerator/dilpackage_svg.tmpl rename to tools/scripts/obsolete/dilPackageGenerator/dilpackage_svg.tmpl diff --git a/tools/part-gen-scripts/obsolete/dilPackageGenerator/generator.py b/tools/scripts/obsolete/dilPackageGenerator/generator.py similarity index 100% rename from tools/part-gen-scripts/obsolete/dilPackageGenerator/generator.py rename to tools/scripts/obsolete/dilPackageGenerator/generator.py diff --git a/tools/part-gen-scripts/obsolete/footgen/footgen.py b/tools/scripts/obsolete/footgen/footgen.py similarity index 100% rename from tools/part-gen-scripts/obsolete/footgen/footgen.py rename to tools/scripts/obsolete/footgen/footgen.py diff --git a/tools/part-gen-scripts/obsolete/footgen/footprint.pdf b/tools/scripts/obsolete/footgen/footprint.pdf similarity index 100% rename from tools/part-gen-scripts/obsolete/footgen/footprint.pdf rename to tools/scripts/obsolete/footgen/footprint.pdf diff --git a/tools/part-gen-scripts/obsolete/footgen/footprint.sch b/tools/scripts/obsolete/footgen/footprint.sch similarity index 100% rename from tools/part-gen-scripts/obsolete/footgen/footprint.sch rename to tools/scripts/obsolete/footgen/footprint.sch diff --git a/tools/part-gen-scripts/obsolete/footgen/footprintdata b/tools/scripts/obsolete/footgen/footprintdata similarity index 100% rename from tools/part-gen-scripts/obsolete/footgen/footprintdata rename to tools/scripts/obsolete/footgen/footprintdata diff --git a/tools/part-gen-scripts/obsolete/footgen/params.pdf b/tools/scripts/obsolete/footgen/params.pdf similarity index 100% rename from tools/part-gen-scripts/obsolete/footgen/params.pdf rename to tools/scripts/obsolete/footgen/params.pdf diff --git a/tools/part-gen-scripts/obsolete/footgen/params.sxw b/tools/scripts/obsolete/footgen/params.sxw similarity index 100% rename from tools/part-gen-scripts/obsolete/footgen/params.sxw rename to tools/scripts/obsolete/footgen/params.sxw diff --git a/tools/part-gen-scripts/obsolete/fp2fzfp/README b/tools/scripts/obsolete/fp2fzfp/README similarity index 100% rename from tools/part-gen-scripts/obsolete/fp2fzfp/README rename to tools/scripts/obsolete/fp2fzfp/README diff --git a/tools/part-gen-scripts/obsolete/fp2fzfp/fp2fzfp.py b/tools/scripts/obsolete/fp2fzfp/fp2fzfp.py similarity index 100% rename from tools/part-gen-scripts/obsolete/fp2fzfp/fp2fzfp.py rename to tools/scripts/obsolete/fp2fzfp/fp2fzfp.py diff --git a/tools/part-gen-scripts/obsolete/fp2fzfp/pcbkeys.py b/tools/scripts/obsolete/fp2fzfp/pcbkeys.py similarity index 100% rename from tools/part-gen-scripts/obsolete/fp2fzfp/pcbkeys.py rename to tools/scripts/obsolete/fp2fzfp/pcbkeys.py diff --git a/tools/part-gen-scripts/obsolete/fp2fzfp/svggen.py b/tools/scripts/obsolete/fp2fzfp/svggen.py similarity index 100% rename from tools/part-gen-scripts/obsolete/fp2fzfp/svggen.py rename to tools/scripts/obsolete/fp2fzfp/svggen.py diff --git a/tools/part-gen-scripts/obsolete/fullbreadboardgenerator/breadboardGenerator.tmproj b/tools/scripts/obsolete/fullbreadboardgenerator/breadboardGenerator.tmproj similarity index 100% rename from tools/part-gen-scripts/obsolete/fullbreadboardgenerator/breadboardGenerator.tmproj rename to tools/scripts/obsolete/fullbreadboardgenerator/breadboardGenerator.tmproj diff --git a/tools/part-gen-scripts/obsolete/fullbreadboardgenerator/breadboard_fzp.tmpl b/tools/scripts/obsolete/fullbreadboardgenerator/breadboard_fzp.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/fullbreadboardgenerator/breadboard_fzp.tmpl rename to tools/scripts/obsolete/fullbreadboardgenerator/breadboard_fzp.tmpl diff --git a/tools/part-gen-scripts/obsolete/fullbreadboardgenerator/breadboard_svg.tmpl b/tools/scripts/obsolete/fullbreadboardgenerator/breadboard_svg.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/fullbreadboardgenerator/breadboard_svg.tmpl rename to tools/scripts/obsolete/fullbreadboardgenerator/breadboard_svg.tmpl diff --git a/tools/part-gen-scripts/obsolete/fullbreadboardgenerator/documentation/breadboard_generator.html b/tools/scripts/obsolete/fullbreadboardgenerator/documentation/breadboard_generator.html similarity index 100% rename from tools/part-gen-scripts/obsolete/fullbreadboardgenerator/documentation/breadboard_generator.html rename to tools/scripts/obsolete/fullbreadboardgenerator/documentation/breadboard_generator.html diff --git a/tools/part-gen-scripts/obsolete/fullbreadboardgenerator/documentation/resources/breadboard_diagram.png b/tools/scripts/obsolete/fullbreadboardgenerator/documentation/resources/breadboard_diagram.png similarity index 100% rename from tools/part-gen-scripts/obsolete/fullbreadboardgenerator/documentation/resources/breadboard_diagram.png rename to tools/scripts/obsolete/fullbreadboardgenerator/documentation/resources/breadboard_diagram.png diff --git a/tools/part-gen-scripts/obsolete/fullbreadboardgenerator/documentation/resources/breadboard_photo.jpg b/tools/scripts/obsolete/fullbreadboardgenerator/documentation/resources/breadboard_photo.jpg similarity index 100% rename from tools/part-gen-scripts/obsolete/fullbreadboardgenerator/documentation/resources/breadboard_photo.jpg rename to tools/scripts/obsolete/fullbreadboardgenerator/documentation/resources/breadboard_photo.jpg diff --git a/tools/part-gen-scripts/obsolete/fullbreadboardgenerator/documentation/resources/guide_style.css b/tools/scripts/obsolete/fullbreadboardgenerator/documentation/resources/guide_style.css similarity index 100% rename from tools/part-gen-scripts/obsolete/fullbreadboardgenerator/documentation/resources/guide_style.css rename to tools/scripts/obsolete/fullbreadboardgenerator/documentation/resources/guide_style.css diff --git a/tools/part-gen-scripts/obsolete/fullbreadboardgenerator/generator.py b/tools/scripts/obsolete/fullbreadboardgenerator/generator.py similarity index 100% rename from tools/part-gen-scripts/obsolete/fullbreadboardgenerator/generator.py rename to tools/scripts/obsolete/fullbreadboardgenerator/generator.py diff --git a/tools/part-gen-scripts/obsolete/genAllParts.bat b/tools/scripts/obsolete/genAllParts.bat similarity index 100% rename from tools/part-gen-scripts/obsolete/genAllParts.bat rename to tools/scripts/obsolete/genAllParts.bat diff --git a/tools/part-gen-scripts/obsolete/genAllParts.py b/tools/scripts/obsolete/genAllParts.py similarity index 100% rename from tools/part-gen-scripts/obsolete/genAllParts.py rename to tools/scripts/obsolete/genAllParts.py diff --git a/tools/part-gen-scripts/obsolete/resistorSetGenerator/ResistorSetGeneratorProject.tmproj b/tools/scripts/obsolete/resistorSetGenerator/ResistorSetGeneratorProject.tmproj similarity index 100% rename from tools/part-gen-scripts/obsolete/resistorSetGenerator/ResistorSetGeneratorProject.tmproj rename to tools/scripts/obsolete/resistorSetGenerator/ResistorSetGeneratorProject.tmproj diff --git a/tools/part-gen-scripts/obsolete/resistorSetGenerator/bin_fzb.tmpl b/tools/scripts/obsolete/resistorSetGenerator/bin_fzb.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/resistorSetGenerator/bin_fzb.tmpl rename to tools/scripts/obsolete/resistorSetGenerator/bin_fzb.tmpl diff --git a/tools/part-gen-scripts/obsolete/resistorSetGenerator/defaults.cfg b/tools/scripts/obsolete/resistorSetGenerator/defaults.cfg similarity index 100% rename from tools/part-gen-scripts/obsolete/resistorSetGenerator/defaults.cfg rename to tools/scripts/obsolete/resistorSetGenerator/defaults.cfg diff --git a/tools/part-gen-scripts/obsolete/resistorSetGenerator/resistorSetGenerator.py b/tools/scripts/obsolete/resistorSetGenerator/resistorSetGenerator.py similarity index 100% rename from tools/part-gen-scripts/obsolete/resistorSetGenerator/resistorSetGenerator.py rename to tools/scripts/obsolete/resistorSetGenerator/resistorSetGenerator.py diff --git a/tools/part-gen-scripts/obsolete/resistorSetGenerator/resistor_breadboard_svg.tmpl b/tools/scripts/obsolete/resistorSetGenerator/resistor_breadboard_svg.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/resistorSetGenerator/resistor_breadboard_svg.tmpl rename to tools/scripts/obsolete/resistorSetGenerator/resistor_breadboard_svg.tmpl diff --git a/tools/part-gen-scripts/obsolete/resistorSetGenerator/resistor_fzp.tmpl b/tools/scripts/obsolete/resistorSetGenerator/resistor_fzp.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/resistorSetGenerator/resistor_fzp.tmpl rename to tools/scripts/obsolete/resistorSetGenerator/resistor_fzp.tmpl diff --git a/tools/part-gen-scripts/obsolete/resistorSetGenerator/resistor_icon_svg.tmpl b/tools/scripts/obsolete/resistorSetGenerator/resistor_icon_svg.tmpl similarity index 100% rename from tools/part-gen-scripts/obsolete/resistorSetGenerator/resistor_icon_svg.tmpl rename to tools/scripts/obsolete/resistorSetGenerator/resistor_icon_svg.tmpl diff --git a/tools/part-gen-scripts/obsolete/resistorSetGenerator/valuesAndColors_forResistors.py b/tools/scripts/obsolete/resistorSetGenerator/valuesAndColors_forResistors.py similarity index 100% rename from tools/part-gen-scripts/obsolete/resistorSetGenerator/valuesAndColors_forResistors.py rename to tools/scripts/obsolete/resistorSetGenerator/valuesAndColors_forResistors.py diff --git a/tools/part-gen-scripts/misc_scripts/svnremove.py b/tools/scripts/obsolete/svnremove.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/svnremove.py rename to tools/scripts/obsolete/svnremove.py diff --git a/tools/part-gen-scripts/misc_scripts/renamefz.py b/tools/scripts/renamefz.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/renamefz.py rename to tools/scripts/renamefz.py diff --git a/tools/part-gen-scripts/misc_scripts/replace.py b/tools/scripts/replace.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/replace.py rename to tools/scripts/replace.py diff --git a/tools/part-gen-scripts/misc_scripts/resetversion.py b/tools/scripts/resetversion.py similarity index 100% rename from tools/part-gen-scripts/misc_scripts/resetversion.py rename to tools/scripts/resetversion.py