summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 21:37:18 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 21:37:18 +0000
commit85049e573d680505d982bd9a4b6bd05256da4dac (patch)
treea27edae82b8bf016643e262a759a1a66ac6e93a2 /tools
parentf65f7dadd39f0f06391fd289faccb07b7b4468fd (diff)
downloadchromium_src-85049e573d680505d982bd9a4b6bd05256da4dac.zip
chromium_src-85049e573d680505d982bd9a4b6bd05256da4dac.tar.gz
chromium_src-85049e573d680505d982bd9a4b6bd05256da4dac.tar.bz2
fix python2.6 warnings in grit
remove one assert as it's not correct BUG=8298,8299 Review URL: http://codereview.chromium.org/40073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/grit/grit/extern/FP.py9
-rw-r--r--tools/grit/grit/node/io.py2
-rw-r--r--tools/grit/grit/tclib.py3
-rw-r--r--tools/grit/grit/xtb_reader.py2
4 files changed, 9 insertions, 7 deletions
diff --git a/tools/grit/grit/extern/FP.py b/tools/grit/grit/extern/FP.py
index 782a473..1e0bce8 100644
--- a/tools/grit/grit/extern/FP.py
+++ b/tools/grit/grit/extern/FP.py
@@ -3,7 +3,12 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import md5
+try:
+ import hashlib
+ _new_md5 = hashlib.md5
+except ImportError:
+ import md5
+ _new_md5 = md5.new
"""64-bit fingerprint support for strings.
@@ -16,7 +21,7 @@ Usage:
def UnsignedFingerPrint(str, encoding='utf-8'):
"""Generate a 64-bit fingerprint by taking the first half of the md5
of the string."""
- hex128 = md5.new(str).hexdigest()
+ hex128 = _new_md5(str).hexdigest()
int64 = long(hex128[:16], 16)
return int64
diff --git a/tools/grit/grit/node/io.py b/tools/grit/grit/node/io.py
index befd671..3de4e7f 100644
--- a/tools/grit/grit/node/io.py
+++ b/tools/grit/grit/node/io.py
@@ -48,7 +48,7 @@ class FileNode(base.Node):
except:
print "Exception during parsing of %s" % self.GetFilePath()
raise
- assert (lang == self.attrs['lang'], 'The XTB file you '
+ assert lang == self.attrs['lang'], ('The XTB file you '
'reference must contain messages in the language specified\n'
'by the \'lang\' attribute.')
diff --git a/tools/grit/grit/tclib.py b/tools/grit/grit/tclib.py
index 846ce15..915082c 100644
--- a/tools/grit/grit/tclib.py
+++ b/tools/grit/grit/tclib.py
@@ -76,9 +76,6 @@ class BaseMessage(object):
assert isinstance(placeholder, Placeholder)
dup = False
for other in self.GetPlaceholders():
- if (other.presentation.find(placeholder.presentation) != -1 or
- placeholder.presentation.find(other.presentation) != -1):
- assert(False, "Placeholder names must be unique and must not overlap")
if other.presentation == placeholder.presentation:
assert other.original == placeholder.original
dup = True
diff --git a/tools/grit/grit/xtb_reader.py b/tools/grit/grit/xtb_reader.py
index 83a492a..3d1a42a 100644
--- a/tools/grit/grit/xtb_reader.py
+++ b/tools/grit/grit/xtb_reader.py
@@ -31,7 +31,7 @@ class XtbContentHandler(xml.sax.handler.ContentHandler):
def startElement(self, name, attrs):
if name == 'translation':
- assert (self.current_id == 0 and len(self.current_structure) == 0,
+ assert self.current_id == 0 and len(self.current_structure) == 0, (
"Didn't expect a <translation> element here.")
self.current_id = attrs.getValue('id')
elif name == 'ph':