Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, args, cfg_list, select_prefix=None):
self.log = pb_logging.logger.getChild("ConfigManager.PrefixInfo")
self.prefix_dir = None
self.prefix_cfg_dir = None
self.prefix_src = None
self.alias = None
self.src_dir = None
self.cfg_file = None
self.inv_file = None
self.inventory = None
self.recipe_dir = None
self.target_dir = None
self.env = os.environ.copy()
self.is_virtualenv = False
self._cfg_info = OrderedDict(self.default_config_info)
if select_prefix is not None:
args.prefix = select_prefix
# 1) Load the config info
def get_recipe(pkgname, target='package', fail_easy=False):
"""
Return a recipe object by its package name.
"""
cache_key = pkgname
if cache_key in RECIPE_CACHE:
pb_logging.logger.getChild("get_recipe").trace("Woohoo, this one's already cached ({0})".format(pkgname))
return RECIPE_CACHE[cache_key]
try:
r = Recipe(recipe_manager.recipe_manager.get_recipe_filename(pkgname))
except PBException as ex:
if fail_easy:
return None
else:
pb_logging.logger.getChild("get_recipe").error("Error fetching recipe `{0}':\n{1}".format(
pkgname, str(ex)
))
raise ex
RECIPE_CACHE[cache_key] = r
if target is not None and r.target != target:
if fail_easy:
return None
pb_logging.logger.getChild("get_recipe").error(
"Recipe for `{pkg}' found, but does not match request target type "
"`{req}' (is `{actual}').".format(
pkg=pkgname, req=target, actual=r.target))
raise PBException("Recipe has wrong target type.")
return r