3 from .source_code_file
import SourceCodeFile
10 for rel_fn, file_path
in filenames.items():
14 goal_folder = os.path.join(
'include', self.
pkg_name)
16 if goal_folder
in source_fn:
21 return [source
for source
in self.
sources.values()
if source.language == language]
24 for tag, files
in [(
'library', cmake.get_library_source()),
25 (
'executable', cmake.get_executable_source()),
26 (
'test', cmake.get_test_source())]:
28 if fn
and fn[0] ==
'$':
33 print(
' File %s found in CMake not found in folder!' % fn)
37 for source
in self.
sources.values():
38 if 'test' in source.tags:
40 packages.update(source.get_dependencies())
47 for source
in self.
sources.values():
48 if 'test' in source.tags:
50 packages.update(source.get_external_python_dependencies())
55 for source
in self.
sources.values():
56 if 'test' not in source.tags:
58 packages.update(source.get_dependencies())
65 for source
in self.
sources.values():
67 matches = source.search_lines_for_patterns(patterns)
69 matches = source.search_for_patterns(patterns)
71 files[source.rel_fn] = matches
79 Given a map of patterns, replace all instances in the package source code with the given language.
81 The key in the map is a regular expression string literal.
82 If there are no groups, then the matching string is replaced with the map value.
83 If there are groups, then the literals of the form $0, $1, etc in the map value are replaced with the groups
86 source.modify_with_patterns(patterns, verbose)
89 return '\n'.join(map(str, sorted(self.
sources.values())))