File: confapis.py

package info (click to toggle)
libtemplates-parser 25.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,404 kB
  • sloc: ada: 12,020; python: 658; makefile: 351; sh: 37
file content (30 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (5)
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()