def __onEnvSubstitutionArg(self, env):
'''Handle the ROS launch 'env' or 'optenv' substitution argument which
aims to substitute the value of an environment variable inside of
some text.
* package -- the package to find
'''
# Determine if a default value was supplied
parts = env.split(" ")
if len(parts) == 1:
#### No default value was supplied
if parts[0] not in environ:
raise Exception(
"Could not find environment variable: '%s'" % env)
return environ[env]
else:
#### A default value was supplied
env, default = parts
return environ.get(env, default)
评论列表
文章目录