summaryrefslogtreecommitdiffstats
path: root/create_potfiles_in.py
blob: 586192c5ff96124e74e2c9243197eeab0884ac6e (plain)
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
#!/usr/bin/env python
import os
import re
import sys
# Paths to exclude
EXCLUSIONS = [
    "deluge/scripts",
    "deluge/i18n",
]

POTFILE_IN = "deluge/i18n/POTFILES.in"

pattern = "deluge\/plugins\/.*\/build"
compiled = re.compile(pattern)

sys.stdout.write("Creating " + POTFILE_IN + " ... ")
sys.stdout.flush()
to_translate = []
for (dirpath, dirnames, filenames) in os.walk("deluge"):
    for filename in filenames:
        if os.path.splitext(filename)[1] in (".py", ".glade", ".in") \
                                            and dirpath not in EXCLUSIONS \
                                            and not compiled.match(dirpath):
            to_translate.append(os.path.join(dirpath, filename))

f = open(POTFILE_IN, "wb")
for line in to_translate:
    f.write(line + "\n")

f.close()

print "Done"