# Path: plumbing/check_cmd_found.py
# def check_cmd(cmd_name, exception=True, extra_msg=None, fancy_box=True):
#     """
#     Checks if the given executable is found in the path.
#     Optionally, raises an exception if the executable `cmd_name` is not found.
#     Optionally, print an extra message as a string alongside the exception.
#     """
#     # Use our own which implementation #
#     from plumbing.common import which
#     # Try to find it in the $PATH #
#     if which(cmd_name, safe=True) is not None: return True
#     # Prepare the message #
#     msg = msg_base % (cmd_name, cmd_name)
#     # Add any hints #
#     if cmd_name in extra_clues: msg += '\n\n' + extra_clues.get(cmd_name)
#     # Add a custom extra message #
#     if extra_msg: msg += '\n\n' + extra_msg
#     # If we want to print it with style in a box #
#     if fancy_box:
#         from plumbing.common import rich_panel_print
#         rich_panel_print(msg, "Command Not Found")
#         msg = "The executable '%s' cannot be found." % cmd_name
#     # Raise an exception #
#     if exception: raise Exception(msg)
#     # Return #
#     return False


import sys, platform
import sh
from plumbing.check_cmd_found import check_cmd
    return False

################################################################################
def install_apt_pkg(pkg_name, verbose=False, redirect=False):
    """
    Install a given apt package.
    Optionally, prints a status message before starting.
    Optionally, prints the output of apt on the current stdout.
    """
    # Optional message #
    if verbose: print("Installing apt package '%s'..." % pkg_name)
    # Check redirection #
    if redirect:
        sh.sudo.apt('install', '--yes', pkg_name, _out=sys.stdout, _err=sys.stderr)
    else:
        sh.sudo.apt('install', '--yes', pkg_name)

################################################################################
def check_apt_exists(exception=True):
    """
    Checks that the aptitude package manager is accessible on the current
    system.
    """
    # The message #
    msg = "You have encountered this error because we have attempted" \
          " the automatic installation of certain packages but are only" \
          " able do this using the `apt` package manager on supported OSes."
    # Check the current operating system #
    if platform.system() != 'Linux': raise Exception(msg)
    # Check the apt command exists #

# Path: plumbing/check_cmd_found.py
# def check_cmd(cmd_name, exception=True, extra_msg=None, fancy_box=True):
#     """
#     Checks if the given executable is found in the path.
#     Optionally, raises an exception if the executable `cmd_name` is not found.
#     Optionally, print an extra message as a string alongside the exception.
#     """
#     # Use our own which implementation #
#     from plumbing.common import which
#     # Try to find it in the $PATH #
#     if which(cmd_name, safe=True) is not None: return True
#     # Prepare the message #
#     msg = msg_base % (cmd_name, cmd_name)
#     # Add any hints #
#     if cmd_name in extra_clues: msg += '\n\n' + extra_clues.get(cmd_name)
#     # Add a custom extra message #
#     if extra_msg: msg += '\n\n' + extra_msg
#     # If we want to print it with style in a box #
#     if fancy_box:
#         from plumbing.common import rich_panel_print
#         rich_panel_print(msg, "Command Not Found")
#         msg = "The executable '%s' cannot be found." % cmd_name
#     # Raise an exception #
#     if exception: raise Exception(msg)
#     # Return #
#     return False


# Path: plumbing/apt_pkg.py
import sys, platform
import sh
from plumbing.check_cmd_found import check_cmd

    return False

################################################################################
def install_apt_pkg(pkg_name, verbose=False, redirect=False):
    """
    Install a given apt package.
    Optionally, prints a status message before starting.
    Optionally, prints the output of apt on the current stdout.
    """
    # Optional message #
    if verbose: print("Installing apt package '%s'..." % pkg_name)
    # Check redirection #
    if redirect:
        sh.sudo.apt('install', '--yes', pkg_name, _out=sys.stdout, _err=sys.stderr)
    else:
        sh.sudo.apt('install', '--yes', pkg_name)

################################################################################
def check_apt_exists(exception=True):
    """
    Checks that the aptitude package manager is accessible on the current
    system.
    """
    # The message #
    msg = "You have encountered this error because we have attempted" \
          " the automatic installation of certain packages but are only" \
          " able do this using the `apt` package manager on supported OSes."
    # Check the current operating system #
    if platform.system() != 'Linux': raise Exception(msg)
    # Check the apt command exists #

    return check_cmd('apt', exception, msg)