From: yangguo@chromium.org Date: Mon, 21 May 2012 10:19:28 +0000 (+0000) Subject: Fixing python deprecations. X-Git-Tag: upstream/4.7.83~16687 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7813b1dd7024dc1ca2e529adc056f40e90069319;p=platform%2Fupstream%2Fv8.git Fixing python deprecations. Original patch by Alexey Stukalov . BUG=v8:1391 TEST= Review URL: https://chromiumcodereview.appspot.com/10412022 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11604 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/tools/js2c.py b/tools/js2c.py index fa559f3..d06cbe4 100644 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006-2008 the V8 project authors. All rights reserved. +# Copyright 2012 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: @@ -195,14 +195,14 @@ def ReadMacros(lines): macro_match = MACRO_PATTERN.match(line) if macro_match: name = macro_match.group(1) - args = map(string.strip, macro_match.group(2).split(',')) + args = [match.strip() for match in macro_match.group(2).split(',')] body = macro_match.group(3).strip() macros.append((re.compile("\\b%s\\(" % name), TextMacro(args, body))) else: python_match = PYTHON_MACRO_PATTERN.match(line) if python_match: name = python_match.group(1) - args = map(string.strip, python_match.group(2).split(',')) + args = [match.strip() for match in python_match.group(2).split(',')] body = python_match.group(3).strip() fun = eval("lambda " + ",".join(args) + ': ' + body) macros.append((re.compile("\\b%s\\(" % name), PythonMacro(args, fun))) diff --git a/tools/jsmin.py b/tools/jsmin.py index e82f3d0..250dea9 100644 --- a/tools/jsmin.py +++ b/tools/jsmin.py @@ -1,6 +1,6 @@ #!/usr/bin/python2.4 -# Copyright 2009 the V8 project authors. All rights reserved. +# Copyright 2012 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: @@ -154,7 +154,7 @@ class JavaScriptMinifier(object): return var_name while True: identifier_first_char = self.identifier_counter % 52 - identifier_second_char = self.identifier_counter / 52 + identifier_second_char = self.identifier_counter // 52 new_identifier = self.CharFromNumber(identifier_first_char) if identifier_second_char != 0: new_identifier = (