def add_source(self, filename, language=None, library=None): if language is None: language = tools.language_by_filename(filename) if library is None: library = "work" self.sources.append((os.path.abspath(filename), language, library))
def add_source(self, filename, language=None, library=None): if language is None: language = tools.language_by_filename(filename) if language is None: language = "verilog" if library is None: library = "work" self.sources.add((os.path.abspath(filename), language, library))
def add_source(self, filename, language=None, library=None): filename = os.path.abspath(filename) if language is None: language = tools.language_by_filename(filename) if library is None: library = "work" for f, _, _ in self.sources: if f == filename: return self.sources.append((filename, language, library))
def add_source(self, filename, language=None, library=None, copy=False): filename = os.path.abspath(filename) if language is None: language = tools.language_by_filename(filename) if library is None: library = "work" for f, *_ in self.sources: if f == filename: return if copy: self.sources.append((filename, language, library, True)) else: self.sources.append((filename, language, library))
def add_source_dir(self, path, recursive=True, library=None): dir_files = [] if recursive: for root, dirs, files in os.walk(path): for filename in files: dir_files.append(os.path.join(root, filename)) else: for item in os.listdir(path): if os.path.isfile(os.path.join(path, item)): dir_files.append(os.path.join(path, item)) for filename in dir_files: language = tools.language_by_filename(filename) if language is not None: self.add_source(filename, language, library)