From f7a8f791ac9a85b3a64fe009dc1ddaef77e94bf2 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Mon, 14 Oct 2013 23:17:13 +0200 Subject: makeSip6.py: Do not write init file. Do this manually when adding a new type Signed-off-by: Michael Buesch --- libtoprammer/chips/microchip8/makeSip6.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libtoprammer/chips/microchip8/makeSip6.py b/libtoprammer/chips/microchip8/makeSip6.py index 838be90..2f024fa 100755 --- a/libtoprammer/chips/microchip8/makeSip6.py +++ b/libtoprammer/chips/microchip8/makeSip6.py @@ -42,20 +42,18 @@ def substitute(input, oldSocket, newSocket): def makeSip(): inputFileName = '__init__.py' fin = open(inputFileName) - # from pic16f1824dip14 import * dMCU = {} for line in fin: - matchObj = re.match('#do not edit the text below this line.*', line) + matchObj = re.match('.*(pic[0-9]+l?f\w+)(sip[0-9a]+).*', line) if matchObj: - break + continue matchObj = re.match('.*(pic[0-9]+l?f\w+)(dip[0-9a]+).*', line) if not matchObj: print("{} did not match".format(line)) continue - print('matched {} - {}'.format(matchObj.group(1), matchObj.group(2))) +# print('matched {} - {}'.format(matchObj.group(1), matchObj.group(2))) dMCU.setdefault(matchObj.group(1), matchObj.group(2)) fin.close() - finit = open("init", "a") for item in dMCU.items(): fin = open("{}{}.py".format(item[0], item[1])) fout = open("{}sip6.py".format(item[0]), 'w') @@ -67,10 +65,7 @@ def makeSip(): fout.write(substitute(line, "{}".format(item[1]), "sip6")) fout.close() fin.close() - finit.write("from {}sip6 import *\n".format(item[0])) - finit.close() - print ('{} - {}'.format(item[0], item[1])) - + def main(argv): makeSip() -- cgit v1.2.3