]> git.donarmstrong.com Git - lilypond.git/blobdiff - buildscripts/check_translation.py
Add buildscripts/ to PYTHONPATH
[lilypond.git] / buildscripts / check_translation.py
old mode 100644 (file)
new mode 100755 (executable)
index 6952b2c..887e7c2
@@ -1,10 +1,13 @@
-#!@PYTHON@
+#!/usr/bin/env python
 
 import __main__
 import optparse
 import os
 import sys
 
+import langdefs
+import buildlib
+
 verbose = 0
 lang = 'C'
 C = lang
@@ -35,7 +38,7 @@ def do_file (file_name, lang_codes, buildlib):
     (diff_string, error) = buildlib.check_translated_doc (original, translated_contents, color=not update_mode)
 
     if error:
-            sys.stderr.write ('warning: %s: %s' % (file_name, error))
+        sys.stderr.write ('warning: %s: %s' % (file_name, error))
 
     if update_mode:
         if error or len (diff_string) >= os.path.getsize (original):
@@ -53,7 +56,7 @@ def do_file (file_name, lang_codes, buildlib):
 def usage ():
     sys.stdout.write (r'''
 Usage:
-check-translation [--language=LANG] [--verbose] [--update] BUILDSCRIPT-DIR FILE...
+check-translation [--language=LANG] [--verbose] [--update] FILE...
 
 This script is licensed under the GNU GPL.
 ''')
@@ -83,24 +86,21 @@ def do_options ():
     lang = options.language
     update_mode = options.update_mode
     
-    return (files[0], files[1:])
+    return files
 
 def main ():
     global update_mode, text_editor
 
-    import_path, files = do_options ()
-    if 'EDITOR' in os.environ.keys ():
+    files = do_options ()
+    if 'EDITOR' in os.environ:
         text_editor = os.environ['EDITOR']
     else:
         update_mode = False
     
-    sys.path.append (import_path)
-    import langdefs
-    import buildlib
     buildlib.verbose = verbose
 
     for i in files:
-        do_file (i, langdefs.LANGDICT.keys(), buildlib)
+        do_file (i, langdefs.LANGDICT.keys (), buildlib)
 
 if __name__ == '__main__':
     main ()