Code

Ticket #1182: make-messages-exclude-existing.diff

File make-messages-exclude-existing.diff, 820 bytes (added by akaihola, 8 years ago)

re-thought implementation looks for .po files and excludes directories based on that

Line 
1Index: django/bin/make-messages.py
2===================================================================
3--- django/bin/make-messages.py (revision 2488)
4+++ django/bin/make-messages.py (working copy)
5@@ -117,6 +117,11 @@
6                     if thefile != file:
7                         os.unlink(os.path.join(dirpath, thefile))
8 
9+            for dirname in dirnames:
10+                if os.path.isfile(os.path.join(dirpath, dirname, 'locale', lang, 'LC_MESSAGES', domain+'.po')):
11+                    dirnames.remove(dirname)
12+                    print "Excluded directory %s: %s.po for %s exists" % (os.path.join(dirpath, dirname), domain, lang)
13+                   
14         if os.path.exists(potfile):
15             (stdin, stdout, stderr) = os.popen3('msguniq "%s"' % potfile, 'b')
16             msgs = stdout.read()