mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 02:33:15 +02:00
File "rules" has instructional text as comments near top. 2) Convert all text files in repo to LF line ending form. Any checkout done with "rules" in play will convert the working tree to native line ending, while keeping repo as LF line ending.
24 lines
617 B
Python
24 lines
617 B
Python
#
|
|
# Example python script to generate an equivalent XML document from XML input
|
|
#
|
|
# Example: Round robin, XML to XML conversion
|
|
#
|
|
|
|
# Import the KiCad python helper module and the csv formatter
|
|
import ky
|
|
import sys
|
|
|
|
# Generate an instance of a generic netlist, and load the netlist tree from
|
|
# the command line option. If the file doesn't exist, execution will stop
|
|
net = ky.netlist(sys.argv[1])
|
|
|
|
# Open a file to write to, if the file cannot be opened output to stdout
|
|
# instead
|
|
try:
|
|
f = open(sys.argv[2], 'w')
|
|
except IOError:
|
|
print >> sys.stderr, __file__, ":", e
|
|
f = stdout
|
|
|
|
print >> f, net.formatXML()
|