diff options
author | jstebbins <[email protected]> | 2012-12-27 23:27:10 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2012-12-27 23:27:10 +0000 |
commit | f89475c8a426907cc85a335460cc1d6e7750614b (patch) | |
tree | 704c7f708f4b7d76edaf0ad477b9c7a712db480b /gtk/src/quotestring.py | |
parent | 0dea09fd27e10f362a94897d993fd540eea5c79f (diff) |
lingui: convert tabs to spaces
Makes lingui source conform to hb standard for indentation.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5112 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/quotestring.py')
-rw-r--r-- | gtk/src/quotestring.py | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/gtk/src/quotestring.py b/gtk/src/quotestring.py index ee6acb36c..1c0c5b2d1 100644 --- a/gtk/src/quotestring.py +++ b/gtk/src/quotestring.py @@ -5,59 +5,59 @@ import getopt import sys def usage(): - print >> sys.stderr, ( - "Usage: %s <input> [output]\n" - "Summary:\n" - " Creates a quoted string suitable for inclusion in a C char*\n\n" - "Options:\n" - " <input> Input file to quote\n" - " <output> Output quoted string [stdout]\n" - % sys.argv[0] - ) + print >> sys.stderr, ( + "Usage: %s <input> [output]\n" + "Summary:\n" + " Creates a quoted string suitable for inclusion in a C char*\n\n" + "Options:\n" + " <input> Input file to quote\n" + " <output> Output quoted string [stdout]\n" + % sys.argv[0] + ) def main(): - global inc_list - - OPTS = "" - try: - opts, args = getopt.gnu_getopt(sys.argv[1:], OPTS) - except getopt.GetoptError, err: - print >> sys.stderr, str(err) - usage() - sys.exit(2) - - for o, a in opts: - usage() - assert False, "unhandled option" - - if len(args) > 2 or len(args) < 1: - usage() - sys.exit(2) - - try: - infile = open(args[0]) - except Exception, err: - print >> sys.stderr, ( "Error: %s" % str(err) ) - sys.exit(1) - - if len(args) > 1: - try: - outfile = open(args[1], "w") - except Exception, err: - print >> sys.stderr, ( "Error: %s" % str(err)) - sys.exit(1) - else: - outfile = sys.stdout - - ss = infile.read() - ss = re.sub("\"", "\\\"", ss) - pattern = re.compile("$", re.M) - # the replacement string below seems a bit strange, but it seems to be - # the only way to get the litteral chars '\' 'n' inserted into the string - ss = re.sub(pattern, "\\\\n\"", ss) - pattern = re.compile("^", re.M) - ss = re.sub(pattern, "\"", ss) - outfile.write(ss) + global inc_list + + OPTS = "" + try: + opts, args = getopt.gnu_getopt(sys.argv[1:], OPTS) + except getopt.GetoptError, err: + print >> sys.stderr, str(err) + usage() + sys.exit(2) + + for o, a in opts: + usage() + assert False, "unhandled option" + + if len(args) > 2 or len(args) < 1: + usage() + sys.exit(2) + + try: + infile = open(args[0]) + except Exception, err: + print >> sys.stderr, ( "Error: %s" % str(err) ) + sys.exit(1) + + if len(args) > 1: + try: + outfile = open(args[1], "w") + except Exception, err: + print >> sys.stderr, ( "Error: %s" % str(err)) + sys.exit(1) + else: + outfile = sys.stdout + + ss = infile.read() + ss = re.sub("\"", "\\\"", ss) + pattern = re.compile("$", re.M) + # the replacement string below seems a bit strange, but it seems to be + # the only way to get the litteral chars '\' 'n' inserted into the string + ss = re.sub(pattern, "\\\\n\"", ss) + pattern = re.compile("^", re.M) + ss = re.sub(pattern, "\"", ss) + outfile.write(ss) main() |