Determines if the first version tuple is newer than the second.
    True if newer, False if older, None if difference is after specified version parts.
480353
def newer(new_ver, old_ver, strict=False):
    """"""
    if old_ver == new_ver or old_ver + (0,) == new_ver:
        return False
    for n, o in zip(new_ver, old_ver):
        if not isinstance(n, int):
            o = str(o)
        if o < n:
            return True
        elif o > n:
            return False
    return not strict
1068487
def is_newer_than(pth1, pth2):
    

    return not os.path.exists(pth1) or not os.path.exists(pth2) or \
       os.stat(pth1).st_mtime > os.stat(pth2).st_mtime
1280731
function versions(a, b) {
    if (!a || !b) return false;

    a = Array.isArray(a) ? a : Object.keys(a);
    b = Array.isArray(a) ? a : Object.keys(a);

    return a.length === b.length && a.reduce(function has(memo, item) {
      return memo && ~b.indexOf(item);
    }, true);
  }
1133500
def is_newer_b(a, bfiles):
    
    if isinstance(bfiles, basestring):
        bfiles = [bfiles]

    if not op.exists(a): return False
    if not all(op.exists(b) for b in bfiles): return False

    atime = os.stat(a).st_mtime # modification time
    for b in bfiles:
        # a has been modified since
        if atime > os.stat(b).st_mtime:
            return False
    return True
1216750
def all_versions_equal(self, versions):  # type: (Dict[str,str]) -> bool
        
        if len(versions) <= 1:
            return True

        semver = None
        for key, version in versions.items():
            if semver is None:
                try:
                    semver, _, __ = version_object_and_next(version)
                except ValueError:
                    logger.error("Invalid version at:" + unicode((key, version)))
                    return False
                continue
            try:
                version_as_version, _, __ = version_object_and_next(version)
            except:
                return False
            if version_as_version != semver:
                return False
        return True
1184620
def _check_ver_range(self, version, ver_range):
        

        lower, upper, lower_inc, upper_inc = ver_range

        #If the range extends over everything, we automatically match
        if lower is None and upper is None:
            return True

        if lower is not None:
            if lower_inc and version < lower:
                return False
            elif not lower_inc and version <= lower:
                return False

        if upper is not None:
            if upper_inc and version > upper:
                return False
            elif not upper_inc and version >= upper:
                return False

        # Prereleases have special matching requirements
        if version.is_prerelease:
            # Prereleases cannot match ranges that are not defined as prereleases
            if (lower is None or not lower.is_prerelease) and (upper is None or not upper.is_prerelease):
                return False

            # Prereleases without the same major.minor.patch as a range end point cannot match
            if (lower is not None and version.release_tuple != lower.release_tuple) and \
               (upper is not None and version.release_tuple != upper.release_tuple):
                return False

        return True
1268078
function versionGEThan (otherVersion) {
      if (otherVersion === version) return true;

      if (typeof(otherVersion) === 'number' && typeof(version) === 'number') {
        return otherVersion > version;
      }

      // The versions have multiple components (i.e. 0.10.30) and
      // must be compared piecewise.
      // Note: I'm ignoring the case where one version has multiple
      // components and the other doesn't.
      var v1 = otherVersion.split('.'),
          v2 = version.split('.'),
          versionLength = (v1.length > v2.length ? v2 : v1).length;

      for (var i = 0; i < versionLength; ++i) {
        if (parseInt(v1[i], 10) > parseInt(v2[i], 10)) {
          return true;
        }
      }

      // Special case, v1 has extra components but the initial components
      // were identical, we assume this means newer but it might also mean
      // that someone changed versioning systems.
      if (i < v1.length) {
        return true;
      }

      return false;
    }
35478
def get_new_version(self, last_version, last_commit,
                        diff_to_increase_ratio):
        

        version = Version(last_version)
        diff = self.get_diff(last_commit, self.get_last_commit_hash())
        total_changed = diff[Diff.ADD] + diff[Diff.DEL]

        version.increase_by_changes(total_changed, diff_to_increase_ratio)
        return version
693136
def check_version(version_)
      v = version
      f = false
      if v.kind_of?(Hash) && v.include?("version") &&
          v['version'] >= "#{version_}" then
	f = true
      end

      [f, v['version']]
    end
402860
def version_tuple(self):
    """"""
    try:
      return tuple([int(digit, 10) for digit in self.version.split('.')])
    except (AttributeError, TypeError, ValueError):
      return None
150227
function compareVersions(installed, required) {

	var a = installed.split('.');
	var b = required.split('.');

	for (var i = 0; i < a.length; ++i) {
		a[i] = Number(a[i]);
	}
	for (var i = 0; i < b.length; ++i) {
		b[i] = Number(b[i]);
	}
	if (a.length == 2) {
		a[2] = 0;
	}

	if (a[0] > b[0]) return true;
	if (a[0] < b[0]) return false;

	if (a[1] > b[1]) return true;
	if (a[1] < b[1]) return false;

	if (a[2] > b[2]) return true;
	if (a[2] < b[2]) return false;

	return true;
}
152576
public int compare(Version other) {
        if (other == null) throw new NullPointerException("other version is null");
        if (this._version < other._version) return -1;
        if (this._version > other._version) return 1;
        if (this._revision < other._revision) return -1;
        if (this._revision > other._revision) return 1;
        if (this._subrevision < other._subrevision) return -1;
        if (this._subrevision > other._subrevision) return 1;
        return 0;
    }
952620
def compare_versions(first, second)
      raise ArgumentError, "bad version format, version=#{first}" unless first =~ Orientdb4r::Client::SERVER_VERSION_PATTERN
      raise ArgumentError, "bad version format, version=#{second}" unless second =~ Orientdb4r::Client::SERVER_VERSION_PATTERN

      firstv = /^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)/.match(first)[0]
      secondv = /^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)/.match(second)[0]

      rslt = 0
      rslt = 1 if firstv > secondv
      rslt = -1 if firstv < secondv

      yield rslt if block_given?

      rslt
    end
847863
def compare_version(lhs_version, rhs_version):
    

    lhs_major, lhs_minor, lhs_revision = [
        int(v) for v in lhs_version.split(".")]
    rhs_major, rhs_minor, rhs_revision = [
        int(v) for v in rhs_version.split(".")]

    if lhs_major < rhs_major:
        return -1
    elif lhs_major > rhs_major:
        return 1

    if lhs_minor < rhs_minor:
        return -1
    elif lhs_minor > rhs_minor:
        return 1

    if lhs_revision < rhs_revision:
        return -1
    elif lhs_revision > rhs_revision:
        return 1

    return 0
100287
def get_previous_version(self):
        """"""
        gh = self.get_github_api()
        repo = gh.repository(self.repo_owner, self.repo_name)
        most_recent = None
        for release in repo.releases():
            # Return the second release that matches the release prefix
            if release.tag_name.startswith(self.project__git__prefix_release):
                if most_recent is None:
                    most_recent = release
                else:
                    return LooseVersion(self.get_version_for_tag(release.tag_name))
529359
public static int compareVersions(String version_1, String version_2)
	{
		for (int j = 0; j < Math.min(version_2.length(), version_1.length()); j++)
		{

			char v1_c = version_1.charAt(j);
			char v2_c = version_2.charAt(j);

			if (v1_c == v2_c)
			{

				continue;
			}

			if (v2_c == '.')
			{

				// version1 higher (e.g. 10.2 -vs- 1.2)

				return (+1);

			} else if (v1_c == '.')
			{

				// version2 higher ( e.g. 1.2 -vs- 10.2 )

				return (-1);

			} else
			{

				return (v1_c - v2_c);
			}
		}

		// longest one wins. e.g. 1.2.1 -vs- 1.2

		return (version_1.length() - version_2.length());
	}
156604
def get_compare_version():
    

    state, latest_version = compare_latest_version()
    if state < 0:
        return -1, "A new version of Modis is available (v{})".format(latest_version)
    elif state == 0:
        return 0, "You are running the latest version of Modis (v{})".format(version)
    else:
        return 1, "You are running a preview version of Modis (v{} pre-release)".format(version)