1#!/usr/bin/env python3 2 3import os 4import re 5 6root_dir = '..' 7valid_extensions = [ 8 '.c', 9 '.h', 10 '.cpp', 11 '.ui', 12 '.gschema.xml', 13 '.schemas.in', 14 '.xml.in', 15 '.desktop.in.in', 16 '.extension.in.in' 17] 18prefix_for_ext = { 19 '.ui' : '[type: gettext/glade]', 20 '.extension.in.in' : '[type: gettext/ini]', 21 '.gschema.xml' : '[type: gettext/gsettings]' 22} 23 24print("# List of source files which contain translatable strings.") 25print("#") 26print("# DO NOT EDIT. This file is automatically generated, to") 27print("# update the content run the following command:") 28print("# ./make-potfiles-in.py > POTFILES.in") 29#print("[encoding: UTF-8]") 30 31all_files = [] 32for root, dirs, files in os.walk(root_dir): 33 all_files += map(lambda file: os.path.join(root, file), files) 34 35for file in sorted(all_files): 36 # ignore the build directory 37 if 'build' in file: 38 continue 39 40 for ext in valid_extensions: 41 if file.endswith(ext): 42 prefix = ''#prefix_for_ext.get(ext, '') 43 file = os.path.relpath(file, root_dir) 44 print("{0}{1}".format(prefix, file)) 45