def get_templates(): templates = {} templates['CMakeLists.txt'] = read_template('CMakeLists.tmpl') templates['manifest.xml'] = read_template('manifest.tmpl') templates['mainpage.dox'] = read_template('mainpage.tmpl') templates['Makefile'] = read_template('Makefile.tmpl') return templates
def get_templates(): """ @return: mapping of file names to templates to instantiate @rtype: {str: str} """ templates = {} templates['stack.xml'] = read_template('stack.tmpl') templates['CMakeLists.txt'] = read_template('CMakeLists.stack.tmpl') templates['Makefile'] = read_template('Makefile.stack.tmpl') return templates
def test_read_template(): from roscreate.core import read_template s = set() # this unit test will break if any of the templates get removed/renamed tests = ['Makefile.tmpl', 'stack.tmpl', 'mainpage.tmpl', 'CMakeLists.stack.tmpl'] for f in tests: text = read_template(f) s.add(text) # simple assert to make sure we didn't read the same thing from each template assert len(s) == len(tests) # hardcode test against a known template text = read_template('Makefile.tmpl') assert text == 'include $(shell rospack find mk)/cmake.mk'