Install operating system packages for the system.

        :param: package_list: ``list``
        :param install_string: ``str``
486641
def _installer(self, package_list, install_string=None):
        
        packages = ' '.join(package_list)

        if install_string is None:
            self.install_string = self.install_process[self.distro] % packages
        else:
            self.install_string = install_string

        output, outcome = self.shell.run_command(command=self.install_string)

        if outcome is False:
            raise IOError(output)
290867
def installed_packages(self):
        
        packages = []
        CMDLINE = [sys.executable, "-mpip", "freeze"]
        try:
            for package in subprocess.check_output(CMDLINE) \
                    .decode('utf-8'). \
                    splitlines():
                for comparator in ["==", ">=", "<=", "<", ">"]:
                    if comparator in package:
                        # installed package names usually look like Pillow==2.8.1
                        # ignore others, like external packages that pip show
                        # won't understand
                        name = package.partition(comparator)[0]
                        packages.append(name)
        except RuntimeError as e:
            if logger.isEnabledFor(logging.DEBUG):
                logger.debug("Exception checking existing packages.")
                logger.debug("cmdline: %s", CMDLINE)
                ex_type, ex, tb = sys.exc_info()
                traceback.print_tb(tb)
                logger.debug()
        return packages
759369
def installed_list(cls):
        
        logger.debug("")

        res = []
        for x in repo_dirlist():
            d = x['path']
            try:
                res.append(Repo(repo_dir=d, name=x['base']))
            except InvalidRepo:
                logger.warning("Invalid repo '%s' in the installation directory.", d)

        return res
443914
def install_catalogs(self):
        
        cmd_obj = self.distribution.get_command_obj('catalogs')
        cmd_obj.force = self.force
        if self.ugali_dir: cmd_obj.ugali_dir = self.ugali_dir
        self.run_command('catalogs')
73619
def list_of_installed(self, repo, name):
        
        all_installed_names = []
        all_installed_packages = find_package("", self.meta.pkg_path)
        for inst in all_installed_packages:
            if repo == "sbo" and inst.endswith("_SBo"):
                name = split_package(inst)[0]
                all_installed_names.append(name)
            else:
                if name:
                    all_installed_names.append(split_package(inst)[0])
                else:
                    all_installed_names.append(inst)
        return all_installed_names
1330710
def apt_install(packages, options=None, fatal=False):
    """"""
    if options is None:
        options = ['--option=Dpkg::Options::=--force-confold']

    cmd = ['apt-get', '--assume-yes']
    cmd.extend(options)
    cmd.append('install')
    if isinstance(packages, six.string_types):
        cmd.append(packages)
    else:
        cmd.extend(packages)
    log("Installing {} with options: {}".format(packages,
                                                options))
    _run_apt_command(cmd, fatal)
586535
def add_packages(self, packages):
        
        # type: (List[str])->TaskNamespace
        assert isinstance(packages, list), "Packages must be list of strings."
        self._task_packages += packages
        return self
663038
def add_repositories():
    
    if not env.overwrite and env.LINUX_PACKAGE_REPOSITORIES == server_state('linux_package_repositories'): return
    if env.verbosity:
        print env.host, "UNCOMMENTING SOURCES in /etc/apt/sources.list and adding PPAs"
    if contains(filename='/etc/apt/sources.list',text='#(.?)deb(.*)http:(.*)universe'):

        _backup_file('/etc/apt/sources.list')
        uncomment('/etc/apt/sources.list','#(.?)deb(.*)http:(.*)universe',use_sudo=True)
    install_package('python-software-properties')
    for p in env.LINUX_PACKAGE_REPOSITORIES:
        sudo('add-apt-repository %s'% p)
        if env.verbosity:
            print 'added source', p
    set_server_state('linux_package_repositories',env.LINUX_PACKAGE_REPOSITORIES)
341990
def needs_packages(*packages):
    '''
    '''
    def real_decorator(func):

        @wraps(func)
        def wrapper(*args, **kwargs):
            non_installed = _non_installed(packages)
            if non_installed:
                what_for = 'in order to run this task'
                install_packages(non_installed, what_for=what_for)
            return func(*args, **kwargs)

        return wrapper

    return real_decorator
59947
def sbo_list():
    
    sbo_packages = []
    for pkg in os.listdir(_meta_.pkg_path):
        if pkg.endswith("_SBo"):
            sbo_packages.append(pkg)
    return sbo_packages
595006
def _build_install_command_list(cmd_prefix, to_install, to_downgrade, to_reinstall):
    '''
    
    '''
    cmds = []
    if to_install:
        cmd = copy.deepcopy(cmd_prefix)
        cmd.extend(to_install)
        cmds.append(cmd)
    if to_downgrade:
        cmd = copy.deepcopy(cmd_prefix)
        cmd.append('--force-downgrade')
        cmd.extend(to_downgrade)
        cmds.append(cmd)
    if to_reinstall:
        cmd = copy.deepcopy(cmd_prefix)
        cmd.append('--force-reinstall')
        cmd.extend(to_reinstall)
        cmds.append(cmd)

    return cmds
41372
def post_install_package():
    

    module_name = '.'.join([env.project_package_name,'deploy'])
    funcs_run = []
    try:
        imported = import_module(module_name)
        funcs = vars(imported)
        for f in env.installed_packages[env.host]:
            func = funcs.get(''.join(['post_install_',f.replace('.','_').replace('-','_')]))
            if func:
                func()
                funcs_run.append(func)
    except ImportError:
        pass
    
    #run per app
    for app in env.INSTALLED_APPS:
        if app == 'woven': continue
        module_name = '.'.join([app,'deploy'])
        try:
            imported = import_module(module_name)
            funcs = vars(imported)
            for f in env.installed_packages[env.host]:
                func = funcs.get(''.join(['post_install_',f.replace('.','_').replace('-','_')]))
                if func and func not in funcs_run:
                    func()
                    funcs_run.append(func)
        except ImportError:
            pass
    #run woven last
    import woven.deploy
    funcs = vars(woven.deploy)
    for f in env.installed_packages[env.host]:
        func = funcs.get(''.join(['post_install_',f.replace('.','_').replace('-','_')]))
        if func and func not in funcs_run: func()
442916
def install_program(self):
        
        text = templ_program.render(**self.options)
        config = Configuration(self.buildout, self.program + '.conf', {
            'deployment': self.deployment_name,
            'directory': os.path.join(self.options['etc-directory'], 'conf.d'),
            'text': text})
        return [config.install()]
523208
def packages(ciprcfg, env, opts, console):
    
    for name, source in ciprcfg.packages.items():
        console.normal('- %s' % name)

        if opts.long_details:
            console.normal('  - directory: %s' % path.join(env.package_dir, name))
            console.normal('  - source: %s' % source)
1359197
def installed_packages(self):
        
        freeze_options = ['-l', '--all'] if self.pip_version >= (8, 1, 0) else ['-l']
        return list(map(split_package_name, filter(None, self._execute_pip(
                ['freeze'] + freeze_options).split(linesep))))
8575
def install():
    
    # check installed package
    print("Compare to '%s' ..." % DST)
    need_install_flag = check_need_install()
    if not need_install_flag:
        print("    package is up-to-date, no need to install.")
        return
    print("Difference been found, start installing ...")

    # remove __pycache__ folder and *.pyc file
    print("Remove *.pyc file ...")
    pyc_folder_list = list()
    for root, _, basename_list in os.walk(SRC):
        if os.path.basename(root) == "__pycache__":
            pyc_folder_list.append(root)

    for folder in pyc_folder_list:
        shutil.rmtree(folder)
    print("    all *.pyc file has been removed.")

    # install this package to all python version
    print("Uninstall %s from %s ..." % (PKG_NAME, DST))
    try:
        shutil.rmtree(DST)
        print("    Successfully uninstall %s" % PKG_NAME)
    except Exception as e:
        print("    %s" % e)

    print("Install %s to %s ..." % (PKG_NAME, DST))
    shutil.copytree(SRC, DST)
    print("    Complete!")
1083452
def install(self):
        
        items = []
        for typeName in self.types:
            it = self.store.findOrCreate(namedAny(typeName))
            installOn(it, self.store)
            items.append(str(it.storeID).decode('ascii'))
        self._items = items