- Timestamp:
- 06/17/07 17:18:54 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/per-object-permissions/django/bin/compile-messages.py
- Property svn:eol-style set to native
r3732 r5488 1 1 #!/usr/bin/env python 2 2 3 import optparse 3 4 import os 4 5 import sys 5 6 6 def compile_messages( ):7 def compile_messages(locale=None): 7 8 basedir = None 8 9 … … 14 15 print "This script should be run from the Django SVN tree or your project or app tree." 15 16 sys.exit(1) 17 18 if locale is not None: 19 basedir = os.path.join(basedir, locale, 'LC_MESSAGES') 16 20 17 21 for dirpath, dirnames, filenames in os.walk(basedir): … … 28 32 os.environ['djangocompilepo'] = pf + '.po' 29 33 if sys.platform == 'win32': # Different shell-variable syntax 30 cmd = 'msgfmt - o "%djangocompilemo%" "%djangocompilepo%"'34 cmd = 'msgfmt --check-format -o "%djangocompilemo%" "%djangocompilepo%"' 31 35 else: 32 cmd = 'msgfmt - o "$djangocompilemo" "$djangocompilepo"'36 cmd = 'msgfmt --check-format -o "$djangocompilemo" "$djangocompilepo"' 33 37 os.system(cmd) 34 38 39 def main(): 40 parser = optparse.OptionParser() 41 parser.add_option('-l', '--locale', dest='locale', 42 help="The locale to process. Default is to process all.") 43 options, args = parser.parse_args() 44 if len(args): 45 parser.error("This program takes no arguments") 46 compile_messages(options.locale) 47 35 48 if __name__ == "__main__": 36 compile_messages()49 main()
