MCPcopy Create free account
hub / github.com/Kitware/VTK / WalkPaths

Method WalkPaths

Utilities/Maintenance/VTKTestsByLanguage.py:125–180  ·  view source on GitHub ↗

Walk the paths producing a dictionary keyed by the testing subdirectory type e.g Cxx, whose value is dictionary keyed by relative path whose value is a set of all the programs in that particular path. :param: option - This relates to the CMakeLists.txt fi

(self, option=0)

Source from the content-addressed store, hash-verified

123 fn[key] = set([v])
124
125 def WalkPaths(self, option=0):
126 """
127 Walk the paths producing a dictionary keyed by the testing
128 subdirectory type e.g Cxx, whose value is dictionary keyed by
129 relative path
130 whose value is a set of all the programs in that particular path.
131
132 :param: option - This relates to the CMakeLists.txt file.
133 If 1: only enabled programs/scripts are selected,
134 2: only disabled programs/scripts are selected,
135 3: only programs/scripts not in CMakeLists.txt
136 are selected.
137 Any other value - all programs/scripts are selected.
138 """
139 for root, dirs, files in os.walk(self.inputPath, topdown=True):
140 for key in self.patterns:
141 # Need to do this for Windows.
142 r = root.replace('\\', '/')
143 match = re.search(self.patterns[key], r)
144 if match:
145 newKey = match.group(1)
146 if option > 0 and option < 4:
147 nonComments, comments = self.ParseCMakeFile(root)
148 for name in files:
149 fn = os.path.splitext(name)[0]
150 if option == 1:
151 if nonComments:
152 if fn in nonComments:
153 if name.lower().endswith(
154 self.fileExtensions[key]):
155 self.AddValue(
156 self.tests[key], newKey, fn)
157 elif option == 2:
158 if comments:
159 if fn in comments:
160 if name.lower().endswith(
161 self.fileExtensions[key]):
162 self.AddValue(
163 self.tests[key], newKey, fn)
164 elif option == 3:
165 s = None
166 if comments and nonComments:
167 s = comments + nonComments
168 elif comments:
169 s = comments
170 else:
171 s = nonComments
172 if s:
173 if not(fn in s):
174 if name.lower().endswith(
175 self.fileExtensions[key]):
176 self.AddValue(self.tests[key],
177 newKey, fn)
178 else:
179 if name.lower().endswith(self.fileExtensions[key]):
180 self.AddValue(self.tests[key], newKey, fn)
181
182 def Difference(self, a, b):

Callers 1

mainFunction · 0.95

Calls 5

ParseCMakeFileMethod · 0.95
AddValueMethod · 0.95
searchMethod · 0.80
groupMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected