~ubuntu-manpage-repository-dev/ubuntu-manpage-repository/trunk

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
31
32
33
34
#!/usr/bin/python

import sys
from launchpadlib.launchpad import Launchpad
import launchpadlib

# Config file to mangle
config_fn = sys.argv[1]

# Series names to blacklist
series_blacklist = ['']

# launchpad = Launchpad.login_anonymously('manpages', launchpadlib.uris.STAGING_SERVICE_ROOT)
launchpad = Launchpad.login_anonymously('manpages', launchpadlib.uris.LPNET_SERVICE_ROOT)

active_series = []
for s in launchpad.projects['ubuntu'].series:
    if not s.active:
        continue
    if s.name in series_blacklist:
        continue
    active_series.append(s.name)

out_str = ''
with open(config_fn) as f:
    for l in f:
        if l.startswith('DISTROS='):
            out_str += 'DISTROS="%s" # Automatically modified by manpages-modify-config\n' % ' '.join(
                sorted(active_series))
            continue
        out_str += l

with open(config_fn, 'w') as f:
    f.write(out_str)