def _create_cds_file(contents): """ Create a CDSFile object with 'contents' """ with mock.patch("vunit.cds_file.read_file", autospec=True) as read_file: read_file.return_value = contents return CDSFile.parse("file_name")
def create_library(self, library_name, library_path, mapped_libraries=None): """ Create and map a library_name to library_path """ mapped_libraries = mapped_libraries if mapped_libraries is not None else {} if not file_exists(dirname(abspath(library_path))): os.makedirs(dirname(abspath(library_path))) if library_name in mapped_libraries and mapped_libraries[library_name] == library_path: return cds = CDSFile.parse(self._cdslib) cds[library_name] = library_path cds.write(self._cdslib)
def _get_mapped_libraries(self): """ Get mapped libraries from cds.lib file """ cds = CDSFile.parse(self._cdslib) return cds