aloof-angle-91616
04/13/2018, 2:57 AMclass CppFiles(datatype('CppFiles', [
'root_dir',
'file_paths',
])):
def __new__(cls, root_dir, file_paths):
if not os.path.isdir(root_dir):
raise CppFilesError("root dir '{}' does not exist!"
.format(root_dir))
for rel_path in file_paths:
abs_path = os.path.join(root_dir, rel_path)
if not os.path.isfile(abs_path):
raise CppFilesError("rel path '{}' is not a file (from cwd '{}')"
.format(root_dir, rel_path))
return super(CppFiles, cls).__new__(cls, root_dir, file_paths)
class CppFileProvider(object):
@abstractmethod
def as_cpp_files(self): pass
def as_path_globs(self):
cpp_files = self.as_cpp_files()
return PathGlobs.create(cpp_files.root_dir, include=cpp_files.file_paths)