'Initializes a new BasePackageManager instance
One of most used interfaces on this class is the _run_command(), which
is controlled by the run_function parameter. It defaults to utils.run()
but a custom method (if provided) should be of the same schema as
utils.run. It should return a CmdResult object and throw a CmdError
exception. The reason for using a separate function to run the commands
is that the same code can be run to fetch a package on the local
machine or on a remote machine (in which case ssh_host\'s run function
is passed in for run_function).
:type pkgmgr_dir: string
:param pkgmgr_dir: A directory that can be used by the package manager
to dump stuff (like checksum files of the repositories etc)
:type hostname: string
:param hostname: hostname from where to fetch a list of package repos
:type repo_urls: list of strings
:param repo_urls: The list of the repository urls which is consulted
whilst fetching the package
:type upload_paths: list of strings
:param upload_paths: The list of the upload of repositories to which
the package is uploaded to
:type do_locking: boolean
:param do_locking: Enable locking when the packages are installed.
:type run_function: function
:param run_function: function used to execute commands.
:type run_function_args: tuple
:param run_function_args: positional (tuple-like) arguments to
run_function
:param run_function_dargs: dictionary
:param run_function_dargs: named (dictionary-like) arguments to
run_function'

def __init__(self, pkgmgr_dir, hostname=None, repo_urls=None, upload_paths=None, do_locking=True, run_function=utils.run, run_function_args=[], run_function_dargs={}):

    self._checksum_dict = {}
    self.pkgmgr_dir = pkgmgr_dir
    self.do_locking = do_locking
    self.hostname = hostname
    self.repositories = []
    def _run_command(command, _run_command_args=run_function_args, _run_command_dargs={}):
        '\n                                                Special    internal    function    that    takes    in    a    command    as\n                                                argument    and    passes    it    on    to    run_function    (if    specified).\n                                                The    _run_command_dargs    are    merged    into    run_function_dargs\n                                                with    the    former    having    more    precedence    than    the    latter.\n                                                '
        new_dargs = dict(run_function_dargs)
        new_dargs.update(_run_command_dargs)
        new_dargs.update({'stdout_tee': None})
        return run_function(command, *_run_command_args, **new_dargs)
    self._run_command = _run_command
    if (not repo_urls):
        repo_urls = []
    elif hostname:
        repo_urls = self.get_mirror_list(repo_urls)
    for url in repo_urls:
        self.add_repository(url)
    if (not upload_paths):
        self.upload_paths = []
    else:
        self.upload_paths = list(upload_paths)
