MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / ProcessFile

Function ProcessFile

tests/external/gmock-1.7.0/scripts/fuse_gmock_files.py:125–153  ·  view source on GitHub ↗

Processes the given gmock header file.

(gmock_header_path)

Source from the content-addressed store, hash-verified

123 processed_files = sets.Set() # Holds all gmock headers we've processed.
124
125 def ProcessFile(gmock_header_path):
126 """Processes the given gmock header file."""
127
128 # We don't process the same header twice.
129 if gmock_header_path in processed_files:
130 return
131
132 processed_files.add(gmock_header_path)
133
134 # Reads each line in the given gmock header.
135 for line in file(os.path.join(gmock_root, gmock_header_path), 'r'):
136 m = INCLUDE_GMOCK_FILE_REGEX.match(line)
137 if m:
138 # It's '#include "gmock/..."' - let's process it recursively.
139 ProcessFile('include/' + m.group(1))
140 else:
141 m = gtest.INCLUDE_GTEST_FILE_REGEX.match(line)
142 if m:
143 # It's '#include "gtest/foo.h"'. We translate it to
144 # "gtest/gtest.h", regardless of what foo is, since all
145 # gtest headers are fused into gtest/gtest.h.
146
147 # There is no need to #include gtest.h twice.
148 if not gtest.GTEST_H_SEED in processed_files:
149 processed_files.add(gtest.GTEST_H_SEED)
150 output_file.write('#include "%s"\n' % (gtest.GTEST_H_OUTPUT,))
151 else:
152 # Otherwise we copy the line unchanged to the output file.
153 output_file.write(line)
154
155 ProcessFile(GMOCK_H_SEED)
156 output_file.close()

Callers 2

FuseGMockHFunction · 0.70
FuseGMockAllCcToFileFunction · 0.70

Calls 3

fileFunction · 0.50
addMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected