from kicad_sym import *

def make_lib(lines):
    half_width = 12
    source, sink, other = split_power(lines)
    pins, max_len = list(make_pins(other, half_width))
    all_pins = chain(
        pins,
        make_pin_top(source),
        make_pin_bottom(sink, max_len),
    )
    return lib([
        symbol("AS6C4008", "AS6C4008",
               all_pins,
               u(-half_width), u(2),
               u(half_width),  u(-(max_len * 2)))
    ])

lines = read_txt("as6c4008.txt")
print(make_lib(lines))
