File: filter.py

package info (click to toggle)
pgbouncer 1.25.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,884 kB
  • sloc: ansic: 61,425; python: 5,703; sh: 4,527; makefile: 1,361; sed: 22
file content (20 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3

import fileinput
import os
import sys

for line in fileinput.input():
    # substitute package version
    if line.startswith("% "):
        line = line.replace("@PACKAGE_VERSION@", os.environ["PACKAGE_VERSION"])
    # drop level-1 header
    if line.startswith("# "):
        continue
    # decrease level of all headers by 1
    if line.startswith("##"):
        line = line.replace("#", "", 1)
    # convert level-1 headers to uppercase
    if line.startswith("# "):
        line = line.upper()
    sys.stdout.write(line)