Exemple #1
0
 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")
Exemple #2
0
    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)
Exemple #3
0
    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)
Exemple #4
0
 def _get_mapped_libraries(self):
     """
     Get mapped libraries from cds.lib file
     """
     cds = CDSFile.parse(self._cdslib)
     return cds
Exemple #5
0
 def test_quotes_define(self):
     cds = CDSFile()
     cds["foo"] = 'bar xyz'
     self._check_written_as(cds, 'define foo "bar xyz"\n')
Exemple #6
0
 def _get_mapped_libraries(self):
     """
     Get mapped libraries from cds.lib file
     """
     cds = CDSFile.parse(self._cdslib)
     return cds