Report error about missing minimum version constraint and exit.
767425
def minver_error(pkg_name):
    """"""
    print(
        'ERROR: specify minimal version of "{}" using '
        '">=" or "=="'.format(pkg_name),
        file=sys.stderr
    )
    sys.exit(1)
1273050
def error(self, msg, n):
        """"""
        raise SyntaxError(msg, n.lineno, n.col_offset,
                          filename=self.compile_info.filename)
1277727
function reportMissingEmbarkDep(filepath, dirname, loglevel) {
  blankLineMaybe(loglevel);
  embarklog[loglevel]('file', filepath);
  embarklog[loglevel](
    '',
    [
      `Could not find embark specified in "dependencies" or "devDependencies" of local package.json file`,
      `But embark was found in node_modules relative to that file:`,
      `${dirname}/node_modules/embark/`
    ].join('\n')
  );
}
436356
def missing_requirements(self, specifiers):
        
        for specifier in specifiers:
            try:
                pkg_resources.require(specifier)
            except pkg_resources.DistributionNotFound:
                yield specifier
19091
def check_version(component, expected_version):
    """"""

    comp = comp_names[component]

    compath = os.path.realpath(os.path.abspath(comp.path))
    sys.path.insert(0, compath)

    import version

    if version.version != expected_version:
        raise EnvironmentError("Version mismatch during release, expected={}, found={}".format(expected_version, version.version))
1186184
def exit_if_path_not_found(path):
    
    if not os.path.exists(path):
        ui.error(c.MESSAGES["path_missing"], path)
        sys.exit(1)
53093
@Override
  public void exitVersion_set(VersionParser.Version_setContext ctx)
  {
    Object o1 = stack.pop();
    if (strict && (o1 instanceof NamedVersion)) {
      String name = o1.toString();
      // FIXME: There needs to be a better way to identify illegal named versions. Perhaps insist it contains an alphanumeric?
      switch (name.trim()) {
        case "-":
        case "_":
          throw new InvalidRangeRuntimeException("Invalid named version: " + o1);
        default:
          break;
      }
    }
    if (stack.isEmpty()) {
      VersionSet set = new VersionSet((IVersion) o1);
      stack.push(set);
    }
    else {
      VersionSet set = (VersionSet) stack.peek();
      set.add((IVersion) o1);
    }
  }
186720
def validate_version(err, value, source):
    ''


    field_name = '<em:version>' if source == 'install.rdf' else 'version'

    err.metadata['version'] = value

    # May not be longer than 32 characters
    if len(value) > 32:
        err.error(
            ('metadata_helpers', '_test_version', 'too_long'),
            'The value of {name} is too long'.format(name=field_name),
            'Values supplied for {name} in the {source} file must be 32 '
            'characters or less.'.format(name=field_name, source=source),
            source)

    # Must be a valid version number.
    if not VERSION_PATTERN.match(value):
        err.error(
            ('metadata_helpers', '_test_version', 'invalid_format'),
            'The value of {name} is invalid'.format(name=field_name),
            'The values supplied for version in the {source} file is not a '
            'valid version string. It can only contain letters, numbers, and '
            'the symbols +*.-_.'.format(name=field_name, source=source),
            source)
1051805
function isOfMinimumVersion(version, minimumVersion) {
                if (version == null || minimumVersion == null) {
                    return false;
                }
                else if (version == null) {
                    return true;
                }
                var actualVersionPieces = ("" + version).split("."),
                    pieces = minimumVersion.split("."),
                    numberOfPieces = pieces.length;
    
                for (var i = 0; i < numberOfPieces; i++) {
                    var piece = parseInt(pieces[i], 10),
                        actualPiece = parseInt(actualVersionPieces[i], 10);
    
                    if (typeof actualPiece === "undefined") {
                        break;
                    }
                    else if (actualPiece > piece) {
                        break;
                    }
                    else if (actualPiece === piece) {
                        continue;
                    }
                    else {
                        return false;
                    }
                }
    
                return true;
            }
433669
private static boolean ensureVersion(Version existing, Version expected) {
        return existing != Version.UNDEFINED && existing.greaterThanOrEqualTo(expected);
    }
954367
def error(bot, update, error):
    """"""
    logger.error('Update {} caused error {}'.format(update, error), extra={"tag": "err"})
549504
def EnsureSConsVersion(self, major, minor, revision=0):
        """"""
        # split string to avoid replacement during build process
        if SCons.__version__ == '__' + 'VERSION__':
            SCons.Warnings.warn(SCons.Warnings.DevelopmentVersionWarning,
                "EnsureSConsVersion is ignored for development version")
            return
        scons_ver = self._get_major_minor_revision(SCons.__version__)
        if scons_ver < (major, minor, revision):
            if revision:
                scons_ver_string = '%d.%d.%d' % (major, minor, revision)
            else:
                scons_ver_string = '%d.%d' % (major, minor)
            print("SCons %s or greater required, but you have SCons %s" % \
                  (scons_ver_string, SCons.__version__))
            sys.exit(2)
795950
static InstallException create(RepositoryResolutionException e, Collection<String> assetNames, File installDir, boolean installingAsset,
                                   boolean isOpenLiberty) {
        Collection<MissingRequirement> allRequirementsNotFound = e.getAllRequirementsResourcesNotFound();
        Collection<MissingRequirement> dependants = new ArrayList<MissingRequirement>(allRequirementsNotFound.size());
        for (MissingRequirement f : allRequirementsNotFound) {
            /**
             * make sure it's not invalid asset names entered
             */
            if (!assetNames.contains(f.getRequirementName())) {
                dependants.add(f);
            }
        }

        /**
         * not valid for current product case or dependency not applicable
         */

        MissingRequirement missingRequirementWithMaxVersion = null;
        String newestVersion = null;
        for (MissingRequirement mr : allRequirementsNotFound) {
            if (missingRequirementWithMaxVersion == null)
                missingRequirementWithMaxVersion = mr;
            String r = mr.getRequirementName();
            if (r.contains("productInstallType") ||
                r.contains("productEdition") ||
                r.contains("productVersion")) {

                Pattern validNumericVersionOrRange = Pattern.compile("\\d+\\.\\d+\\.\\d+\\.\\d+");
                Matcher matcher = validNumericVersionOrRange.matcher(r);
                String version = null;
                while (matcher.find()) {
                    version = matcher.group();
                    break;
                }
                List productMatchers = SelfExtractor.parseAppliesTo(mr.getRequirementName());
                wlp.lib.extract.ReturnCode validInstallRC = SelfExtractor.validateProductMatches(installDir, productMatchers);
                String currentEdition = "";
                if (validInstallRC.getMessageKey().equals("invalidVersion") || validInstallRC.getMessageKey().equals("invalidEdition")) {
                    int productEdition = 2;
                    if (validInstallRC.getMessageKey().equals("invalidEdition")) {
                        productEdition = 0;
                    }
                    currentEdition = (String) validInstallRC.getParameters()[productEdition];
                }
                if (!!!currentEdition.equals("Liberty Early Access")) {
                    if (isNewerVersion(version, newestVersion, false)) {
                        missingRequirementWithMaxVersion = mr;
                        newestVersion = version;
                    }
                } else {
                    if (isNewerVersion(version, newestVersion, true)) {
                        missingRequirementWithMaxVersion = mr;
                        newestVersion = version;
                    }
                }

            }
        }

        /**
         * missing dependent case, keep the current message
         */
        if (dependants.size() > 0) {
            String missingRequirement = missingRequirementWithMaxVersion.getRequirementName();
            if (!missingRequirement.contains(";")
                && !missingRequirement.contains("productInstallType")
                && !missingRequirement.contains("productEdition")
                && !missingRequirement.contains("productVersion")) {
                String assetsStr = "";
                String feature = missingRequirement;
                InstallException ie = null;
                if (assetNames.size() == 1) {
                    assetsStr = assetNames.iterator().next();
                    ie = create(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage(installingAsset ? "ERROR_ASSET_MISSING_DEPENDENT" : "ERROR_MISSING_DEPENDENT",
                                                                               assetsStr,
                                                                               feature),
                                e);
                } else if (assetNames.size() > 1) {
                    assetsStr = assetNames.toString();
                    ie = create(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage(installingAsset ? "ERROR_ASSET_MISSING_MULTIPLE_DEPENDENT" : "ERROR_MISSING_MULTIPLE_DEPENDENT",
                                                                               assetsStr,
                                                                               feature),
                                e);
                }

                ie.setData(assetsStr, feature);

                return ie;

            }
        }

        if (missingRequirementWithMaxVersion.getRequirementName().contains("productInstallType") ||
            missingRequirementWithMaxVersion.getRequirementName().contains("productEdition") ||
            missingRequirementWithMaxVersion.getRequirementName().contains("productVersion")) {
            @SuppressWarnings("rawtypes")
            List productMatchers = SelfExtractor.parseAppliesTo(missingRequirementWithMaxVersion.getRequirementName());
            String feature = RepositoryDownloadUtil.getAssetNameFromMassiveResource(missingRequirementWithMaxVersion.getOwningResource());
            String errMsg = "";
            if (InstallUtils.containsIgnoreCase(assetNames, feature)) {
                errMsg = validateProductMatches(feature, productMatchers, installDir, installingAsset);

            } else {
                String assetsStr = assetNames.size() == 1 ? assetNames.iterator().next() : InstallUtils.getFeatureListOutput(assetNames);
                errMsg = validateProductMatches(assetsStr, feature, productMatchers, installDir, installingAsset);
            }
            if (!errMsg.isEmpty()) {
                return create(errMsg, e, InstallException.NOT_VALID_FOR_CURRENT_PRODUCT);
            }
        }

        InstallException ie;
        if (isOpenLiberty) {
            ie = create(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage(installingAsset ? "ERROR_FAILED_TO_RESOLVE_ASSETS" : "ERROR_FAILED_TO_RESOLVE_FEATURES_FOR_OPEN_LIBERTY",
                                                                       InstallUtils.getFeatureListOutput(assetNames)),
                        e);
        } else {
            ie = create(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage(installingAsset ? "ERROR_FAILED_TO_RESOLVE_ASSETS" : "ERROR_FAILED_TO_RESOLVE_FEATURES",
                                                                       InstallUtils.getFeatureListOutput(assetNames)),
                        e);
        }

        ie.setData(assetNames);

        return ie;
    }
537880
def min_version(self):
        """"""
        data = self.version_downloads
        if not data:
            return (None, 0)
        return min(data.items(), key=lambda item: item[1])
533087
def check_extra_requirements(pkgname, pkgver):
    '''
    
    '''
    keyword = None

    match = re.match('^(~)?([<>])?(=)?([^<>=]*)$', pkgver)
    if match:
        keyword, gt_lt, eq, verstr = match.groups()
        prefix = gt_lt or ''
        prefix += eq or ''
        # We need to delete quotes around use flag list elements
        verstr = verstr.replace("'", "")
        # If no prefix characters were supplied and verstr contains a version, use '='
        if verstr[0] != ':' and verstr[0] != '[':
            prefix = prefix or '='
            atom = '{0}{1}-{2}'.format(prefix, pkgname, verstr)
        else:
            atom = '{0}{1}'.format(pkgname, verstr)
    else:
        return True

    try:
        cpv = _porttree().dbapi.xmatch('bestmatch-visible', atom)
    except portage.exception.InvalidAtom as iae:
        log.error('Unable to find a matching package for %s: (%s)', atom, iae)
        return False

    if cpv == '':
        return False

    try:
        cur_repo, cur_use = _vartree().dbapi.aux_get(cpv, ['repository', 'USE'])
    except KeyError:
        return False

    des_repo = re.match(r'^.+::([^\[]+).*$', atom)
    if des_repo and des_repo.group(1) != cur_repo:
        return False

    des_uses = set(portage.dep.dep_getusedeps(atom))
    cur_use = cur_use.split()
    if [x for x in des_uses.difference(cur_use) if x[0] != '-' or x[1:] in cur_use]:
        return False

    if keyword:
        if not __salt__['portage_config.has_flag']('accept_keywords', atom, '~ARCH'):
            return False

    return True
591288
def exit_with_error(self, error, **kwargs):
        
        self.error(error, **kwargs)
        raise SystemExit(error)
457624
def minizinc_version():
    """"""
    vs = _run_minizinc('--version')
    m = re.findall('version ([\d\.]+)', vs)
    if not m:
        raise RuntimeError('MiniZinc executable not found.')
    return m[0]