Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
d955e83b
Commit
d955e83b
authored
May 07, 2009
by
zhanyong.wan
Browse files
Makes the mock generator work with python2.3.5, which comes with Mac OS X Tiger.
parent
84b8e4c6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
scripts/generator/README
scripts/generator/README
+1
-1
scripts/generator/cpp/gmock_class.py
scripts/generator/cpp/gmock_class.py
+7
-6
scripts/generator/cpp/keywords.py
scripts/generator/cpp/keywords.py
+1
-0
scripts/generator/gmock_gen.py
scripts/generator/gmock_gen.py
+1
-1
No files found.
scripts/generator/README
View file @
d955e83b
...
...
@@ -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/
...
...
scripts/generator/cpp/gmock_class.py
View file @
d955e83b
...
...
@@ -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
=
set
s
.
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_name
s
=
', '
.
join
(
sorted
(
desired_class_names
-
processed_class_names
))
if
missing_class_name
s
:
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_name
s
))
(
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
=
set
s
.
Set
(
argv
[
2
:])
source
=
utils
.
ReadFile
(
filename
)
if
source
is
None
:
return
1
...
...
scripts/generator/cpp/keywords.py
View file @
d955e83b
#!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google Inc.
...
...
scripts/generator/gmock_gen.py
View file @
d955e83b
#!/usr/bin/python
2.4
#!/usr/bin/
env
python
#
# Copyright 2008 Google Inc. All Rights Reserved.
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment