__init__.py
Go to the documentation of this file.
00001 
00002 import os
00003 import sys
00004 import shutil
00005 import utils
00006 
00007 def get_templates(package):
00008     template_dir = os.path.join(os.path.dirname(__file__),'templates', 'comms') 
00009     templates = {}
00010     templates['mainpage.dox'] = utils.read_template(os.path.join(template_dir,'mainpage.dox'))
00011     templates['CMakeLists.txt'] = utils.read_template(os.path.join(template_dir,'CMakeLists.txt'))
00012     templates['package.xml'] = utils.read_template(os.path.join(template_dir,'package.xml'))
00013     templates[os.path.join('msg','Dude.msg')] = utils.read_template(os.path.join(template_dir,'msg','Dude.msg'))
00014     templates[os.path.join('srv','HelloDude.srv')] = utils.read_template(os.path.join(template_dir,'srv','HelloDude.srv'))
00015     return templates
00016 
00017 def create_package_directory(package):
00018     p = os.path.abspath(package)
00019     os.makedirs(p) 
00020     print("Created package directory " + p)
00021     os.makedirs(os.path.join(p,"msg"))
00022     print("Created package directory " + os.path.join(p,"msg"))
00023     os.makedirs(os.path.join(p,"srv"))
00024     print("Created package directory " + os.path.join(p,"srv"))
00025 
00026 def create_winros_catkin_package():
00027     (package, depends) = utils.parse_arguments(['std_msgs'])
00028     create_package_directory(package)
00029     templates = get_templates(package)
00030     build_depends = ''.join(['  <build_depend>%s</build_depend>\n'%d for d in depends])
00031     run_depends = ''.join(['  <run_depend>%s</run_depend>\n'%d for d in depends])
00032     cmake_depends = ''.join(['%s '%d for d in depends])
00033     for filename, template in templates.iteritems():
00034         contents = utils.instantiate_template(template, package, package, utils.author_name(), build_depends, run_depends, cmake_depends)
00035         try:
00036             p = os.path.abspath(os.path.join(package, filename))
00037             f = open(p, 'w')
00038             f.write(contents.encode('utf-8'))
00039             print "Created package file", p
00040         finally:
00041             f.close()
00042     print "\nPlease edit package.xml, mainpage.dox, CMakeLists.txt, and add the package subdirectory."


winros_create_msg_pkg
Author(s): Daniel Stonier
autogenerated on Wed Sep 16 2015 07:10:00