def get_package_dependencies(package_listing, package_name, shell, work_dir=None, envs=None): '''The package listing is the result of looking up the command name in the command library. Given this listing, the package name and the shell return a list of package dependency names''' deps_listing, deps_msg = command_lib.check_library_key( package_listing, 'deps') if deps_listing: deps_list, invoke_msg = command_lib.get_pkg_attr_list( shell, deps_listing, work_dir, envs, package_name=package_name) if deps_list: return list(set(deps_list)), '' return [], invoke_msg return [], deps_msg
def fill_package_metadata(pkg_obj, pkg_listing, shell, work_dir, envs): '''Given a Package object and the Package listing from the command library, fill in the attribute value returned from looking up the data and methods of the package listing.If there are errors, fill out notices''' # create a NoticeOrigin for the package origin_str = 'command_lib/snippets.yml' pkg_dict = {} for key in command_lib.package_keys: key_listing, listing_msg = command_lib.check_library_key( pkg_listing, key) if key_listing: key_list, invoke_msg = command_lib.get_pkg_attr_list( shell, key_listing, work_dir, envs, package_name=pkg_obj.name) if key_list: pkg_dict.update({key: key_list}) else: pkg_obj.origins.add_notice_to_origins( origin_str, Notice(invoke_msg, 'error')) else: pkg_obj.origins.add_notice_to_origins( origin_str, Notice(listing_msg, 'warning')) pkg_obj.fill(pkg_dict)