def normalize_requires(filename, **kwargs): """Return the contents of filename, with all [Require]s split out and ordered at the top.""" if filename[-2:] != '.v': filename += '.v' kwargs = fill_kwargs(kwargs) lib = lib_of_filename(filename, libnames=tuple(kwargs['libnames'])) all_imports = run_recursively_get_imports(lib, **kwargs) v_name = filename_of_lib(lib, ext='.v', **kwargs) contents = get_file(v_name, **kwargs) contents = strip_requires(contents) contents = ''.join('Require %s.\n' % i for i in all_imports[:-1]) + '\n' + contents.strip() + '\n' return contents
def normalize_requires(filename, **kwargs): """Return the contents of filename, with all [Require]s split out and ordered at the top. Preserve any leading whitespace/comments. """ if filename[-2:] != '.v': filename += '.v' kwargs = fill_kwargs(kwargs) lib = lib_of_filename(filename, **kwargs) all_imports = run_recursively_get_imports(lib, **kwargs) v_name = filename_of_lib(lib, ext='.v', **kwargs) contents = get_file(v_name, **kwargs) header, contents = split_leading_comments_and_whitespace(contents) contents = strip_requires(contents) contents = ''.join('Require %s.\n' % i for i in all_imports[:-1]) + '\n' + contents.strip() + '\n' return header + contents
def recursively_get_requires_from_file(filename, **kwargs): if filename[-2:] != '.v': filename += '.v' kwargs = fill_kwargs(kwargs) lib = lib_of_filename(filename, libnames=tuple(kwargs['libnames'])) return tuple(run_recursively_get_imports(lib, **kwargs)[:-1])
def recursively_get_requires_from_file(filename, **kwargs): if filename[-2:] != '.v': filename += '.v' kwargs = fill_kwargs(kwargs) lib = lib_of_filename(filename, **kwargs) return tuple(run_recursively_get_imports(lib, **kwargs)[:-1])