summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-05-07 21:20:57 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-05-07 21:20:57 +0000
commit3bc31af95b50ae63f7a6fbb8e41e330e18e4cd70 (patch)
tree905e8feea6daab678c7172488c69237baeb72357 /scripts
parent3d452c084af7b10a88ebd86f87f721c755f7aca6 (diff)
downloadgooglemock-3bc31af95b50ae63f7a6fbb8e41e330e18e4cd70.tar.gz
Makes the mock generator work with python2.3.5, which comes with Mac OS X Tiger.
git-svn-id: http://googlemock.googlecode.com/svn/trunk@150 8415998a-534a-0410-bf83-d39667b30386
Diffstat (limited to 'scripts')
-rw-r--r--scripts/generator/README2
-rwxr-xr-xscripts/generator/cpp/gmock_class.py13
-rwxr-xr-xscripts/generator/cpp/keywords.py1
-rwxr-xr-xscripts/generator/gmock_gen.py2
4 files changed, 10 insertions, 8 deletions
diff --git a/scripts/generator/README b/scripts/generator/README
index ddaa9d4..071bf0f 100644
--- a/scripts/generator/README
+++ b/scripts/generator/README
@@ -3,7 +3,7 @@ The Google Mock class generator is an application that is part of cppclean.
For more information about cppclean, see the README.cppclean file or
visit http://code.google.com/p/cppclean/
-cppclean requires Python 2.4 or later. If you don't have Python installed
+cppclean requires Python 2.3.5 or later. If you don't have Python installed
on your system, you will also need to install it. You can download Python
from: http://www.python.org/download/releases/
diff --git a/scripts/generator/cpp/gmock_class.py b/scripts/generator/cpp/gmock_class.py
index ba11f9e..2920424 100755
--- a/scripts/generator/cpp/gmock_class.py
+++ b/scripts/generator/cpp/gmock_class.py
@@ -31,6 +31,7 @@ __author__ = 'nnorwitz@google.com (Neal Norwitz)'
import os
import re
+import sets
import sys
from cpp import ast
@@ -82,7 +83,7 @@ def _GenerateMethods(output_lines, source, class_node):
def _GenerateMocks(filename, source, ast_list, desired_class_names):
- processed_class_names = set()
+ processed_class_names = sets.Set()
lines = []
for node in ast_list:
if (isinstance(node, ast.Class) and node.body and
@@ -122,11 +123,11 @@ def _GenerateMocks(filename, source, ast_list, desired_class_names):
sys.stdout.write('\n'.join(lines))
if desired_class_names:
- missing_class_names = ', '.join(
- sorted(desired_class_names - processed_class_names))
- if missing_class_names:
+ missing_class_name_list = list(desired_class_names - processed_class_names)
+ if missing_class_name_list:
+ missing_class_name_list.sort()
sys.stderr.write('Class(es) not found in %s: %s\n' %
- (filename, missing_class_names))
+ (filename, ', '.join(missing_class_name_list)))
elif not processed_class_names:
sys.stderr.write('No class found in %s\n' % filename)
@@ -149,7 +150,7 @@ def main(argv=sys.argv):
filename = argv[1]
desired_class_names = None # None means all classes in the source file.
if len(argv) >= 3:
- desired_class_names = set(argv[2:])
+ desired_class_names = sets.Set(argv[2:])
source = utils.ReadFile(filename)
if source is None:
return 1
diff --git a/scripts/generator/cpp/keywords.py b/scripts/generator/cpp/keywords.py
index 73f0202..f694450 100755
--- a/scripts/generator/cpp/keywords.py
+++ b/scripts/generator/cpp/keywords.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google Inc.
diff --git a/scripts/generator/gmock_gen.py b/scripts/generator/gmock_gen.py
index 5a3f658..8cc0d13 100755
--- a/scripts/generator/gmock_gen.py
+++ b/scripts/generator/gmock_gen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.4
+#!/usr/bin/env python
#
# Copyright 2008 Google Inc. All Rights Reserved.
#