2011-05-21 12:00:59 +00:00
|
|
|
#!/usr/bin/env python
|
2009-10-04 23:48:18 +00:00
|
|
|
import os
|
2011-06-02 23:14:59 +00:00
|
|
|
import re
|
2011-07-13 20:22:18 +00:00
|
|
|
import sys
|
2009-10-04 23:48:18 +00:00
|
|
|
# Paths to exclude
|
|
|
|
EXCLUSIONS = [
|
2011-06-02 23:14:59 +00:00
|
|
|
"deluge/scripts",
|
|
|
|
"deluge/i18n",
|
2009-10-04 23:48:18 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
POTFILE_IN = "deluge/i18n/POTFILES.in"
|
|
|
|
|
2011-06-02 23:14:59 +00:00
|
|
|
pattern = "deluge\/plugins\/.*\/build"
|
|
|
|
compiled = re.compile(pattern)
|
|
|
|
|
2011-07-13 20:22:18 +00:00
|
|
|
sys.stdout.write("Creating " + POTFILE_IN + " ... ")
|
|
|
|
sys.stdout.flush()
|
2009-10-04 23:48:18 +00:00
|
|
|
to_translate = []
|
|
|
|
for (dirpath, dirnames, filenames) in os.walk("deluge"):
|
|
|
|
for filename in filenames:
|
2011-07-13 20:22:18 +00:00
|
|
|
if os.path.splitext(filename)[1] in (".py", ".glade", ".in") \
|
2011-06-02 23:14:59 +00:00
|
|
|
and dirpath not in EXCLUSIONS \
|
|
|
|
and not compiled.match(dirpath):
|
2009-10-04 23:48:18 +00:00
|
|
|
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"
|