Configure a list of product versions from portal.quickinstaller
331124
def set_versions(self):
        
        self.versions = {}
        self.upgrades = {}
        qi = getToolByName(self.context, "portal_quickinstaller")
        for key in qi.keys():
            self.versions[key] = qi.getProductVersion(key)
            info = qi.upgradeInfo(key)
            if info and 'installedVersion' in info:
                self.upgrades[key] = info['installedVersion']
691320
def query_versions(self, version=None):
        """"""
        if version not in RELEASE_AND_CANDIDATE_LATEST_VERSIONS:
            return [version]

        url = urljoin(self.base_url, 'releases/')
        parser = self._create_directory_parser(url)
        if version:
            versions = parser.filter(RELEASE_AND_CANDIDATE_LATEST_VERSIONS[version])
            from distutils.version import LooseVersion
            versions.sort(key=LooseVersion)
            return [versions[-1]]
        else:
            return parser.entries
651986
def activate_version(self, service_id, version_number):
		""""""
		content = self._fetch("/service/%s/version/%d/activate" % (service_id, version_number), method="PUT")
		return FastlyVersion(self, content)
654057
def get_package_versions(self, name):
        
        package_data = self._packages.get(name)
        versions = []

        if package_data:
            versions = sort_versions(list(package_data.get('versions', [])))

        return versions
1213520
def query_versions_pypi(self, package_name):
        """"""
        if not package_name in self.pkg_list:
            self.logger.debug("Package %s not in cache, querying PyPI..." \
                    % package_name)
            self.fetch_pkg_list()
        #I have to set version=[] for edge cases like "Magic file extensions"
        #but I'm not sure why this happens. It's included with Python or
        #because it has a space in it's name?
        versions = []
        for pypi_pkg in self.pkg_list:
            if pypi_pkg.lower() == package_name.lower():
                if self.debug:
                    self.logger.debug("DEBUG: %s" % package_name)
                versions = self.package_releases(pypi_pkg)
                package_name = pypi_pkg
                break
        return (package_name, versions)
105606
def add_product_version_to_build_configuration(id=None, name=None, product_version_id=None):
    
    data = remove_product_version_from_build_configuration_raw(id, name, product_version_id)
    if data:
        return utils.format_json_list(data)
517784
def remove_product_version_from_build_configuration(id=None, name=None, product_version_id=None):
    
    data = remove_product_version_from_build_configuration_raw(id, name, product_version_id)
    if data:
        return utils.format_json_list(data)
1026786
def list_pkgs(versions_as_list=False, **kwargs):
    '''
    
    '''
    versions_as_list = salt.utils.data.is_true(versions_as_list)
    # not yet implemented or not applicable
    if any([salt.utils.data.is_true(kwargs.get(x)) for x in ('removed', 'purge_desired')]):
        return {}

    cmd = 'xbps-query -l'
    ret = {}
    out = __salt__['cmd.run'](cmd, output_loglevel='trace')
    for line in out.splitlines():
        if not line:
            continue
        try:
            # xbps-query -l output sample:
            # ii desktop-file-utils-0.22_4  Utilities to ...
            #
            # XXX handle package status (like 'ii') ?
            pkg, ver = line.split(None)[1].rsplit('-', 1)
        except ValueError:
            log.error(
                'xbps-query: Unexpected formatting in line: "%s"',
                line
            )

        __salt__['pkg_resource.add_pkg'](ret, pkg, ver)

    __salt__['pkg_resource.sort_pkglist'](ret)
    if not versions_as_list:
        __salt__['pkg_resource.stringify'](ret)
    return ret
1200108
def _get_scope_versions(self, pkg_versions):
        '''
        
        '''
        get_in_versions = []
        for p_version in pkg_versions:
            if fnmatch.fnmatch(p_version, self.version):
                get_in_versions.append(p_version)
        return get_in_versions
939606
def version(self):
        """"""

        versions = []
        versions.append("sosreport: %s" % __version__)

        for plugname, plug in self.loaded_plugins:
            versions.append("%s: %s" % (plugname, plug.version))

        self.archive.add_string(content="\n".join(versions),
                                dest='version.txt')
506089
def cli(env, identifier, postinstall, key):
    """"""

    hardware = SoftLayer.HardwareManager(env.client)
    hardware_id = helpers.resolve_id(hardware.resolve_ids,
                                     identifier,
                                     'hardware')
    key_list = []
    if key:
        for single_key in key:
            resolver = SoftLayer.SshKeyManager(env.client).resolve_ids
            key_id = helpers.resolve_id(resolver, single_key, 'SshKey')
            key_list.append(key_id)
    if not (env.skip_confirmations or formatting.no_going_back(hardware_id)):
        raise exceptions.CLIAbort('Aborted')

    hardware.reload(hardware_id, postinstall, key_list)
314910
def list_pkgs(versions_as_list=False, **kwargs):
    '''
    
    '''
    versions_as_list = salt.utils.data.is_true(versions_as_list)
    # not yet implemented or not applicable
    if any([salt.utils.data.is_true(kwargs.get(x))
            for x in ('removed', 'purge_desired')]):
        return {}

    if 'pkg.list_pkgs' in __context__:
        if versions_as_list:
            return __context__['pkg.list_pkgs']
        else:
            ret = copy.deepcopy(__context__['pkg.list_pkgs'])
            __salt__['pkg_resource.stringify'](ret)
            return ret

    ret = {}
    cmd = 'pkg_info -q -a'
    out = __salt__['cmd.run_stdout'](cmd, output_loglevel='trace')
    for line in out.splitlines():
        try:
            pkgname, pkgver, flavor = __PKG_RE.match(line).groups()
        except AttributeError:
            continue
        pkgname += '--{0}'.format(flavor) if flavor else ''
        __salt__['pkg_resource.add_pkg'](ret, pkgname, pkgver)

    __salt__['pkg_resource.sort_pkglist'](ret)
    __context__['pkg.list_pkgs'] = copy.deepcopy(ret)
    if not versions_as_list:
        __salt__['pkg_resource.stringify'](ret)
    return ret
1013062
protected function configure_for_multiple_versions() {
        $this->add_column_header('statusall', get_string('acceptancestatusoverall', 'tool_policy'));
        $filterstatus = $this->acceptancesfilter->get_status_filter();
        $statusall = [];
        foreach ($this->versionids as $v => $versionname) {
            $this->sql->fields .= ", a{$v}.status AS status{$v}, a{$v}.usermodified AS usermodified{$v}";
            $join = "JOIN {tool_policy_acceptances} a{$v} ON a{$v}.userid = u.id AND a{$v}.policyversionid=:versionid{$v}";
            if ($filterstatus == 1) {
                $this->sql->from .= " {$join} AND a{$v}.status=1";
            } else if ($filterstatus == 2) {
                $this->sql->from .= " {$join} AND a{$v}.status=0";
            } else {
                $this->sql->from .= " LEFT {$join}";
            }
            $this->sql->params['versionid' . $v] = $v;
            $this->add_column_header('status' . $v, $versionname);
            $statusall[] = "COALESCE(a{$v}.status, 0)";
        }
        $this->sql->fields .= ",".join('+', $statusall)." AS statusall";

        if ($filterstatus === 0) {
            $statussql = [];
            foreach ($this->versionids as $v => $versionname) {
                $statussql[] = "a{$v}.status IS NULL";
            }
            $this->sql->where .= " AND (u.policyagreed = 0 OR ".join(" OR ", $statussql).")";
        }
    }
257102
def _prepare_version(self):
        """"""
        if config.VERSION not in self._config:
            self._config[config.VERSION] = __version__
219447
def version(*names, **kwargs):
    '''
    
    '''
    ret = {}
    versions_as_list = \
        salt.utils.data.is_true(kwargs.pop('versions_as_list', False))
    pkg_glob = False
    if names:
        pkgs = __salt__['pkg.list_pkgs'](versions_as_list=True, **kwargs)
        for name in names:
            if '*' in name:
                pkg_glob = True
                for match in fnmatch.filter(pkgs, name):
                    ret[match] = pkgs.get(match, [])
            else:
                ret[name] = pkgs.get(name, [])
    if not versions_as_list:
        __salt__['pkg_resource.stringify'](ret)
    # Return a string if no globbing is used, and there is one item in the
    # return dict
    if len(ret) == 1 and not pkg_glob:
        try:
            return next(six.itervalues(ret))
        except StopIteration:
            return ''
    return ret
363217
def list_product_versions_for_build_configuration(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    
    data = list_product_versions_for_build_configuration_raw(id, name, page_size, page_index, sort, q)
    if data:
        return utils.format_json_list(data)
1009371
def get_versions(config) -> dict:
    """"""

    # Collect bel package version
    try:
        import bel.__version__

        config["bel"]["version"] = bel.__version__.__version__
    except KeyError:
        config["bel"] = {"version": bel.__version__.__version__}
    except ModuleNotFoundError:
        pass

    # Collect bel_resources version
    try:
        import tools.__version__

        config["bel_resources"]["version"] = tools.__version__.__version__
    except KeyError:
        config["bel_resources"] = {"version": tools.__version__.__version__}
    except ModuleNotFoundError:
        pass

    # Collect bel_api version
    try:
        import __version__

        if __version__.__name__ == "BELBIO API":
            config["bel_api"]["version"] = __version__.__version__
    except KeyError:
        if __version__.__name__ == "BELBIO API":
            config["bel_api"] = {"version": __version__.__version__}
    except ModuleNotFoundError:
        pass