# Path: src/rosrepo/ui.py
# def pick_dependency_resolution(package_name, pkg_list):
#     if not isatty(sys.stdin):
#         return None
#     if isatty(sys.stderr):
#         fd = sys.stderr
#     elif isatty(sys.stdout):
#         fd = sys.stdout
#     else:
#         return None
#     result = None
#     while result is None:
#         msg("\n@!Dependency resolution for @{cf}%s@|\n" % package_name, fd=fd)
#         msg(
#             "The package is not in your workspace and can be cloned from "
#             "multiple Git repositories. Please pick the one you want:\n\n", fd=fd
#         )
#         for i in range(len(pkg_list)):
#             msg("%3d. %s\n" % (i + 1, pkg_list[i].project.website), fd=fd)
#         msg("%3d. %s\n\n" % (0, "Choose automatically"), fd=fd)
#         try:
#             s = int(readline("--> ", fd=fd))
#             if s == 0:
#                 return None
#             result = pkg_list[s - 1]
#         except (ValueError, IndexError):
#             msg("@!@{rf}Invalid choice@|\n\n", fd=fd)
#     return result
# 
# def warning(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{yf}%s: warning: %s" % (prog, text), use_color=use_color, indent_next=len(prog) + 11)
# 
# def error(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{rf}%s: error: %s" % (prog, text), indent_next=len(prog) + 9)
# 
# def escape(msg):
#     return msg.replace("@", "@@")
# 
# Path: src/rosrepo/util.py
# def yaml_load(stream, Loader=SafeLoader):
# def yaml_dump(data, stream=None, Dumper=SafeDumper, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __str__(self):
#     def __getitem__(self, item):
#     def __setitem__(self, item, value):
#     def __len__(self):
# def is_deprecated_package(manifest):
# def deprecated_package_info(manifest):
# def path_has_prefix(path, prefix):
# def has_package_path(obj, paths):
# def env_path_list_contains(path_list, path):
# def makedirs(path):
# def write_atomic(filepath, data, mode=0o644, ignore_fail=False):
# def isatty(fd):
# def get_terminal_size():
# def find_program(program):
#     def is_exe(fpath):
# def getmtime(path):
# def call_process(args, bufsize=0, stdin=None, stdout=None, stderr=None, cwd=None, env=None, input_data=None):
# def create_multiprocess_manager():
# def _worker_init(worker_init, worker_init_args):
# def run_multiprocess_workers(worker, workload, worker_init=None, worker_init_args=(), jobs=None, timeout=None):
# class NamedTuple(object):
# class UserError(RuntimeError):


from .ui import pick_dependency_resolution, warning, error, escape
from .util import is_deprecated_package, call_process, PIPE, iteritems
from distutils.version import LooseVersion as ManifestVersion
            from . import dummy_pkg_resources
            from rosdep2.lookup import RosdepLookup
            from rosdep2.rospkg_loader import DEFAULT_VIEW_KEY
            from rosdep2 import get_default_installer, create_default_installer_context
                from rosdep2.lookup import ResolutionError
import platform
import gc
            import sys
        self._system = platform.system()
        self._installed_packages = None
        if self._system == "Linux":
            self._installer = "apt"
            self._installer_cmd = "sudo apt install"
        elif self._system == "Darwin":
            self._installer = "homebrew"
            self._installer_cmd = "brew install"
        else:
            self._installer = None
            self._installer_cmd = None

    @property
    def installer(self):
        return self._installer

    @property
    def installer_cmd(self):
        return self._installer_cmd

    @property
    def installed_packages(self):
        if self._installed_packages is None:
            self._populate_installed_packages()
        return self._installed_packages

    def _populate_installed_packages(self):
        self._installed_packages = set()
        if self._system == "Linux":
            try:

# Path: src/rosrepo/ui.py
# def pick_dependency_resolution(package_name, pkg_list):
#     if not isatty(sys.stdin):
#         return None
#     if isatty(sys.stderr):
#         fd = sys.stderr
#     elif isatty(sys.stdout):
#         fd = sys.stdout
#     else:
#         return None
#     result = None
#     while result is None:
#         msg("\n@!Dependency resolution for @{cf}%s@|\n" % package_name, fd=fd)
#         msg(
#             "The package is not in your workspace and can be cloned from "
#             "multiple Git repositories. Please pick the one you want:\n\n", fd=fd
#         )
#         for i in range(len(pkg_list)):
#             msg("%3d. %s\n" % (i + 1, pkg_list[i].project.website), fd=fd)
#         msg("%3d. %s\n\n" % (0, "Choose automatically"), fd=fd)
#         try:
#             s = int(readline("--> ", fd=fd))
#             if s == 0:
#                 return None
#             result = pkg_list[s - 1]
#         except (ValueError, IndexError):
#             msg("@!@{rf}Invalid choice@|\n\n", fd=fd)
#     return result
# 
# def warning(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{yf}%s: warning: %s" % (prog, text), use_color=use_color, indent_next=len(prog) + 11)
# 
# def error(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{rf}%s: error: %s" % (prog, text), indent_next=len(prog) + 9)
# 
# def escape(msg):
#     return msg.replace("@", "@@")
# 
# Path: src/rosrepo/util.py
# def yaml_load(stream, Loader=SafeLoader):
# def yaml_dump(data, stream=None, Dumper=SafeDumper, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __str__(self):
#     def __getitem__(self, item):
#     def __setitem__(self, item, value):
#     def __len__(self):
# def is_deprecated_package(manifest):
# def deprecated_package_info(manifest):
# def path_has_prefix(path, prefix):
# def has_package_path(obj, paths):
# def env_path_list_contains(path_list, path):
# def makedirs(path):
# def write_atomic(filepath, data, mode=0o644, ignore_fail=False):
# def isatty(fd):
# def get_terminal_size():
# def find_program(program):
#     def is_exe(fpath):
# def getmtime(path):
# def call_process(args, bufsize=0, stdin=None, stdout=None, stderr=None, cwd=None, env=None, input_data=None):
# def create_multiprocess_manager():
# def _worker_init(worker_init, worker_init_args):
# def run_multiprocess_workers(worker, workload, worker_init=None, worker_init_args=(), jobs=None, timeout=None):
# class NamedTuple(object):
# class UserError(RuntimeError):


# Path: src/rosrepo/resolver.py
from .ui import pick_dependency_resolution, warning, error, escape
from .util import is_deprecated_package, call_process, PIPE, iteritems
from distutils.version import LooseVersion as ManifestVersion
            from . import dummy_pkg_resources
            from rosdep2.lookup import RosdepLookup
            from rosdep2.rospkg_loader import DEFAULT_VIEW_KEY
            from rosdep2 import get_default_installer, create_default_installer_context
                from rosdep2.lookup import ResolutionError
import platform
import gc
            import sys

        self._system = platform.system()
        self._installed_packages = None
        if self._system == "Linux":
            self._installer = "apt"
            self._installer_cmd = "sudo apt install"
        elif self._system == "Darwin":
            self._installer = "homebrew"
            self._installer_cmd = "brew install"
        else:
            self._installer = None
            self._installer_cmd = None

    @property
    def installer(self):
        return self._installer

    @property
    def installer_cmd(self):
        return self._installer_cmd

    @property
    def installed_packages(self):
        if self._installed_packages is None:
            self._populate_installed_packages()
        return self._installed_packages

    def _populate_installed_packages(self):
        self._installed_packages = set()
        if self._system == "Linux":
            try:

                _, stdout, _ = call_process(["dpkg-query", "-f", "${Package}|${Status}\\n", "-W"], stdout=PIPE, stderr=PIPE)