1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
import os
import os.path
API = ['src/templates_parser.ads',
'src/templates_parser-debug.ads',
'src/templates_parser-utils.ads',
'xsrc/templates_parser-xml.ads']
if os.path.exists("build/apirefs") is False:
os.makedirs("build/apirefs")
for path in API:
try:
fin = open("../" + path)
fout = open("build/apirefs/" + os.path.basename(path), 'w')
outside_private_part = True
for line in fin:
if line.startswith("end "):
outside_private_part = True
if outside_private_part:
fout.write(line)
if line == "private\n":
outside_private_part = False
fout.write(" -- implementation removed\n")
finally:
if fin:
fin.close()
if fout:
fout.close()
|