# Path: pybombs/install_manager.py
# class InstallManager(object):
#     def __init__(self):
#     def install(
#             self,
#             packages,
#             mode, # install / update
#             fail_if_not_exists=False, # Fail if any package in `packages' is not already installed
#             update_if_exists=False,
#             quiet=False,
#             print_tree=False,
#             deps_only=False,
#             no_deps=False,
#             verify=False,
#             static=False,
#             install_type=None
#         ):
#         def _check_if_pkg_goes_into_tree(pkg):
#         def _cached_check_if_pkg_goes_into_tree(pkg, check_callback):


from pybombs.commands import CommandBase
from pybombs import install_manager
from pybombs.pb_exception import PBException
                    '-a', '--all',
                    help="Update all packages installed to current prefix, including dependencies.",
                    action='store_true',
            )

    def __init__(self, cmd, args):
        CommandBase.__init__(self,
                cmd, args,
                load_recipes=True,
                require_prefix=False, # Not required for non-source builds
        )
        self.args.packages = args.packages[0]
        get_all_pkgs = False
        if len(self.args.packages) == 0:
            if cmd == 'update':
                get_all_pkgs = True
                if not self.args.all:
                    self.args.no_deps = True
            else:
                self.log.error("No packages specified.")
                raise PBException("No packages specified.")
        self.update_if_exists = (cmd == 'update' or self.args.update)
        self.fail_if_not_exists = (cmd == 'update')
        if get_all_pkgs:
            self.args.packages = self.inventory.get_packages()
        self.install_manager = install_manager.InstallManager()

    def run(self):
        """ Go, go, go! """
        # Return False (0) on success, as it gets sent to exit()

# Path: pybombs/install_manager.py
# class InstallManager(object):
#     def __init__(self):
#     def install(
#             self,
#             packages,
#             mode, # install / update
#             fail_if_not_exists=False, # Fail if any package in `packages' is not already installed
#             update_if_exists=False,
#             quiet=False,
#             print_tree=False,
#             deps_only=False,
#             no_deps=False,
#             verify=False,
#             static=False,
#             install_type=None
#         ):
#         def _check_if_pkg_goes_into_tree(pkg):
#         def _cached_check_if_pkg_goes_into_tree(pkg, check_callback):


# Path: pybombs/commands/install.py
from pybombs.commands import CommandBase
from pybombs import install_manager
from pybombs.pb_exception import PBException

                    '-a', '--all',
                    help="Update all packages installed to current prefix, including dependencies.",
                    action='store_true',
            )

    def __init__(self, cmd, args):
        CommandBase.__init__(self,
                cmd, args,
                load_recipes=True,
                require_prefix=False, # Not required for non-source builds
        )
        self.args.packages = args.packages[0]
        get_all_pkgs = False
        if len(self.args.packages) == 0:
            if cmd == 'update':
                get_all_pkgs = True
                if not self.args.all:
                    self.args.no_deps = True
            else:
                self.log.error("No packages specified.")
                raise PBException("No packages specified.")
        self.update_if_exists = (cmd == 'update' or self.args.update)
        self.fail_if_not_exists = (cmd == 'update')
        if get_all_pkgs:
            self.args.packages = self.inventory.get_packages()
        self.install_manager = install_manager.InstallManager()

    def run(self):
        """ Go, go, go! """
        # Return False (0) on success, as it gets sent to exit()

        return not self.install_manager.install(