roscreate-pkg: #2108 fix to roscpp/rospy depend case now that py_path no longer specifies package name
This commit is contained in:
parent
247ffcdfb6
commit
fb323466b3
|
@ -59,31 +59,40 @@ def create_package(package, author, depends, uses_roscpp=False, uses_rospy=False
|
||||||
if os.path.exists(p):
|
if os.path.exists(p):
|
||||||
print >> sys.stderr, "%s already exists, aborting"%p
|
print >> sys.stderr, "%s already exists, aborting"%p
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
print "Creating package directory", p
|
|
||||||
os.makedirs(p)
|
|
||||||
|
|
||||||
|
os.makedirs(p)
|
||||||
|
print "Created package directory", p
|
||||||
|
|
||||||
if uses_roscpp:
|
if uses_roscpp:
|
||||||
# create package/include/package and package/src for roscpp code
|
# create package/include/package and package/src for roscpp code
|
||||||
cpp_path = os.path.join(p, 'include', package)
|
cpp_path = os.path.join(p, 'include', package)
|
||||||
print "Creating include directory", cpp_path
|
try:
|
||||||
os.makedirs(cpp_path)
|
os.makedirs(cpp_path)
|
||||||
cpp_path = os.path.join(p, 'src')
|
print "Created include directory", cpp_path
|
||||||
print "Creating cpp source directory", cpp_path
|
cpp_path = os.path.join(p, 'src')
|
||||||
os.makedirs(cpp_path)
|
os.makedirs(cpp_path)
|
||||||
|
print "Created cpp source directory", cpp_path
|
||||||
|
except:
|
||||||
|
# file exists
|
||||||
|
pass
|
||||||
if uses_rospy:
|
if uses_rospy:
|
||||||
# create package/src/ for python files
|
# create package/src/ for python files
|
||||||
py_path = os.path.join(p, 'src')
|
py_path = os.path.join(p, 'src')
|
||||||
print "Creating python source directory", py_path
|
try:
|
||||||
os.makedirs(py_path)
|
os.makedirs(py_path)
|
||||||
|
print "Created python source directory", py_path
|
||||||
|
except:
|
||||||
|
# file exists
|
||||||
|
pass
|
||||||
|
|
||||||
templates = get_templates()
|
templates = get_templates()
|
||||||
for filename, template in templates.iteritems():
|
for filename, template in templates.iteritems():
|
||||||
contents = instantiate_template(template, package, package, package, author, depends)
|
contents = instantiate_template(template, package, package, package, author, depends)
|
||||||
try:
|
try:
|
||||||
p = os.path.abspath(os.path.join(package, filename))
|
p = os.path.abspath(os.path.join(package, filename))
|
||||||
print "Creating package file", p
|
|
||||||
f = open(p, 'w')
|
f = open(p, 'w')
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
|
print "Created package file", p
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
print "\nPlease edit %s/manifest.xml and mainpage.dox to finish creating your package"%package
|
print "\nPlease edit %s/manifest.xml and mainpage.dox to finish creating your package"%package
|
||||||
|
|
Loading…
Reference in New Issue