The distribution version identifying a published release on PyPI.
486341
def distVersion():
    
    from pkg_resources import parse_version
    build_number = buildNumber()
    parsedBaseVersion = parse_version(baseVersion)
    if isinstance(parsedBaseVersion, tuple):
        raise RuntimeError("Setuptools version 8.0 or newer required. Update by running "
                           "'pip install setuptools --upgrade'")

    if build_number is not None and parsedBaseVersion.is_prerelease:
        return baseVersion + '.dev' + build_number
    else:
        return baseVersion
663082
def package_version(self):
        """"""
        vbase = self.base_version
        if self.ncommits:
            vbase += '.dev{0}+{1}'.format(self.ncommits, self.sha)
        return vbase
385199
def _get_bgzip_version(exe):
    """"""
    p = subprocess.Popen([exe, "-h"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
    output = p.communicate()
    version_line = output[0].splitlines()[1]
    version = re.match(r"(?:Version:|bgzip \(htslib\))\s+(\d+\.\d+(\.\d+)?)", version_line).group(1)
    return version
982837
def distribution_version(name):
    """"""
    from pkg_resources import get_distribution, DistributionNotFound
    try:
        dist = get_distribution(name)
    except DistributionNotFound:
        pass
    else:
        return dist.version
1274432
def package_version(filename, varname):
    """"""
    _locals = {}
    with open(filename) as fp:
        exec(fp.read(), None, _locals)
    return _locals[varname]
872476
def get_impl_version_info():
    # type: () -> Tuple[int, ...]
    """"""
    if get_abbr_impl() == 'pp':
        # as per https://github.com/pypa/pip/issues/2882
        # attrs exist only on pypy
        return (sys.version_info[0],
                sys.pypy_version_info.major,  # type: ignore
                sys.pypy_version_info.minor)  # type: ignore
    else:
        return sys.version_info[0], sys.version_info[1]
729090
def _render_version():
        
        ver = sys.version[:3]
        dist = get_distribution('setuptools')
        tmpl = 'setuptools {dist.version} from {dist.location} (Python {ver})'
        print(tmpl.format(**locals()))
        raise SystemExit()
200273
def publish():
    """"""
    print("To be ready for release, remember:")
    print("      1) Update the version number (and associated test)")
    print("      2) Update the ChangeLog.rst (and other documentation)")
    print(
        "         ChangeLog should have an line (title) consisting of the version number"
    )
    print("      3) Tag Mercurial with 'Release <version>'")
    print("      4) Push updates to BitBucket")
    print("      5) Set the RELEASE environment variable")
    print("           $ export RELEASE=formic")

    cmd = [
        'bash', '-c',
        'yolk -M formic | grep "^version: " | sed "s/^version: \\(.*\\)$/\\1/"'
    ]
    published_version = subprocess.check_output(cmd).strip()
    our_version = open(os.path.join("formic", "VERSION.txt"), "r").read()

    # sanity test on version
    if "\n" in published_version or\
       len(published_version) < 3 or len(published_version) > 10:
        raise Exception(
            "Published version number seems weird: " + published_version)

    print("Published version:", published_version)
    print("Current version:  ", our_version)

    if our_version == published_version:
        raise Exception(
            "You are attempting to republish version " + our_version)

    # sanity: check ChangeLog starts with our version
    changelog = open("CHANGELOG.rst", "r")
    found = False
    for line in changelog.readlines():
        if line.strip() == our_version:
            print("ChangeLog has an entry")
            found = True
            break
    changelog.close()
    if not found:
        raise Exception(
            "The ChangeLog does not appear to include comments on this release"
        )

    # Sanity check: is there a release tag
    tags = subprocess.check_output("hg tags".split())
    found = False
    looking_for = "Release " + our_version
    for line in tags.split("\n"):
        match = re.match(r"^(.*)\s+[0-9]+:[0-9a-f]+$", line)
        if match:
            tag = match.group(1).strip()
            if tag == looking_for:
                print("Found tag", tag)
                found = True
                break

    if not found:
        raise Exception(
            "Mercurial does not have the release tag: " + looking_for)

    status = subprocess.check_output(["hg", "status"])
    for line in status.split("\n"):
        if len(line) > 0:
            raise Exception("Uncommitted changes present")

    try:
        v = os.environ["RELEASE"]
        if v != "formic":
            raise KeyError()
    except KeyError:
        print("$RELEASE environment variable is not set")
        raise

    subprocess.check_call("python setup.py bdist_egg upload".split())
    subprocess.check_call("python setup.py sdist upload".split())
1173325
def asVersion(self):
        
        return versions.Version(self.package, self.major, self.minor, self.micro)
155635
def get_version():
    """"""
    version = 'Not installed.'

    try:
        version = pkg_resources.get_distribution(__package__).version
    except pkg_resources.DistributionNotFound:
        pass

    return version
868820
def print_package_versions(self):
        """"""
        variants = self.context.get_tool_variants(self.tool_name)
        if variants:
            if len(variants) > 1:
                self._print_conflicting(variants)
                return 1
            else:
                from rez.packages_ import iter_packages
                variant = iter(variants).next()
                it = iter_packages(name=variant.name)
                rows = []
                colors = []

                for pkg in sorted(it, key=lambda x: x.version, reverse=True):
                    if pkg.version == variant.version:
                        name = "* %s" % pkg.qualified_name
                        col = heading
                    else:
                        name = "  %s" % pkg.qualified_name
                        col = local if pkg.is_local else None

                    label = "(local)" if pkg.is_local else ""
                    rows.append((name, pkg.path, label))
                    colors.append(col)

                _pr = Printer()
                for col, line in zip(colors, columnise(rows)):
                    _pr(line, col)
        return 0
703877
def is_published_version(self):
        
        pub_ver = getattr(self, 'published_version', None)
        this_ver = getattr(self, 'this_version', None)
        return this_ver and pub_ver and (this_ver == pub_ver)
1207448
def __list_package_updates(package_name, version):
    

    updates = get_package_update_list(package_name, version)

    if updates['newer_releases'] or updates['pre_releases']:
        print('%s (%s)' % (package_name, version))
        __list_updates('Major releases', updates['major_updates'])
        __list_updates('Minor releases', updates['minor_updates'])
        __list_updates('Patch releases', updates['patch_updates'])
        __list_updates('Pre releases', updates['pre_release_updates'])
        __list_updates('Unknown releases', updates['non_semantic_versions'])
        print("___")
72714
def _release_version():
    '''
    
    '''
    with io.open(os.path.join(SETUP_DIRNAME, 'saltpylint', 'version.py'), encoding='utf-8') as fh_:
        exec_locals = {}
        exec_globals = {}
        contents = fh_.read()
        if not isinstance(contents, str):
            contents = contents.encode('utf-8')
        exec(contents, exec_globals, exec_locals)  # pylint: disable=exec-used
        return exec_locals['__version__']
1360628
def _version_checker(module, minver):
    
    # We could use LooseVersion, but distutils imports imp which is deprecated
    version_regexp = r'[a-z]?((?:\d|\.)+\d+)(?:\.dev[0-9]+)?'
    version_tags = re.match(version_regexp, module.__version__)
    if not version_tags:
        return False
    version_tags = version_tags.group(1).split(".")
    version_tags = tuple(int(x) for x in version_tags)
    return version_tags >= minver
115966
def versions_report(include_salt_cloud=False):
    '''
    
    '''
    ver_info = versions_information(include_salt_cloud)

    lib_pad = max(len(name) for name in ver_info['Dependency Versions'])
    sys_pad = max(len(name) for name in ver_info['System Versions'])
    padding = max(lib_pad, sys_pad) + 1

    fmt = '{0:>{pad}}: {1}'
    info = []
    for ver_type in ('Salt Version', 'Dependency Versions', 'System Versions'):
        info.append('{0}:'.format(ver_type))
        # List dependencies in alphabetical, case insensitive order
        for name in sorted(ver_info[ver_type], key=lambda x: x.lower()):
            ver = fmt.format(name,
                             ver_info[ver_type][name] or 'Not Installed',
                             pad=padding)
            info.append(ver)
        info.append(' ')

    for line in info:
        yield line
74711
def read_release_version():
    """"""
    import re
    dirname = os.path.abspath(os.path.dirname(__file__))

    try:
        f = open(os.path.join(dirname, "_version.py"), "rt")
        for line in f.readlines():

            m = re.match("__version__ = '([^']+)'", line)
            if m:
                ver = m.group(1)
                return ver

    except:
        return None

    return None