Return the version of the OS distribution, as a tuple of version
        numbers.

        For details, see :func:`distro.version_parts`.
431212
def version_parts(self, best=False):
        
        version_str = self.version(best=best)
        if version_str:
            version_regex = re.compile(r'(\d+)\.?(\d+)?\.?(\d+)?')
            matches = version_regex.match(version_str)
            if matches:
                major, minor, build_number = matches.groups()
                return major, minor or '', build_number or ''
        return '', '', ''
115313
def _get_python_version_string():
    
    version_info = sys.version_info
    return '.'.join(map(str, [version_info[0], version_info[1], version_info[2]]))
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
1173325
def asVersion(self):
        
        return versions.Version(self.package, self.major, self.minor, self.micro)
948217
def get_version():
    
    contents = read(os.path.join(PATH_BASE, 'srptools', '__init__.py'))
    version = re.search('VERSION = \(([^)]+)\)', contents)
    version = version.group(1).replace(', ', '.').strip()
    return version
105846
def get_version():
    
    # Other OS check
    if not 'win' in sys.platform:
        return NO_WIN
    # Get infos
    win_ver = sys.getwindowsversion()
    try:
        # Python 3.6.x or upper -> Use 'platform_version' attribute
        major, minor, build = win_ver.platform_version
    except AttributeError:
        if sys.version_info < (3, 0):
            # Python 2.7.x -> Use 'platform' module to ensure the correct values (seems that Win 10 is not correctly detected)
            from platform import _get_real_winver
            major, minor, build = _get_real_winver(win_ver.major, win_ver.minor, win_ver.build)
            major, minor, build = int(major), int(minor), int(build) # 'long' to 'int'
        else:
            # Python 3.0.x - 3.5.x -> Keep 'sys.getwindowsversion()'' values
            major, minor, build = win_ver.major, win_ver.minor, win_ver.build
    # Check is is server or not (it works only on Python 2.7.x or newer)
    try:
        is_server = 1 if win_ver.product_type == 3 else 0
    except AttributeError:
        is_server = 0
    # Parse Service Pack version (or Build number)
    try:
        if major == 10:
            # The OS is Windows 10 or Windows Server 2016,
            # so the service pack version is instead the Build number
            sp_ver = build
        else:
            sp_ver = win_ver.service_pack_major or 0
    except AttributeError:
        try:
            sp_ver = int(win_ver.service_pack.rsplit(' ', 1))
        except (IndexError, ValueError):
            sp_ver = 0
    # Return the final version data
    return (major, minor, sp_ver, is_server)
1029577
def package_version(package_name: str) -> typing.Optional[str]:
    

    try:
        return pkg_resources.get_distribution(package_name).version
    except (pkg_resources.DistributionNotFound, AttributeError):
        return None
658535
def _get_version():
    """"""
    with open(os.path.join(os.path.dirname(__file__), PACKAGE_NAME, 'VERSION'), 'rb') as f:
        version = f.read().decode('ascii').strip()
    return version
1115701
def cluster_version(self):
        """"""
        versionstr = self.client.info()['version']['number']
        return [int(x) for x in versionstr.split('.')]
371557
def sys_version(version_tuple):
    

    old_version = sys.version_info
    sys.version_info = version_tuple
    yield
    sys.version_info = old_version
542581
def _get_version():
    '''
    
    '''
    version_string = __salt__['cmd.run'](
        [_check_pkgin(), '-v'],
        output_loglevel='trace')
    if version_string is None:
        # Dunno why it would, but...
        return False

    version_match = VERSION_MATCH.search(version_string)
    if not version_match:
        return False

    return version_match.group(1).split('.')
785277
def get_package_version():
    """"""
    base = os.path.abspath(os.path.dirname(__file__))
    with open(os.path.join(base, 'policy', '__init__.py'),
              mode='rt',
              encoding='utf-8') as initf:
        for line in initf:
            m = version.match(line.strip())
            if not m:
                continue
            return m.groups()[0]
490698
def get_bin_version(bin_path, version_flag='-v', kw={}):
    

    version_str = get_bin_version_str(bin_path, version_flag, kw)
    if version_str:
        return tuple(int(i) for i in version_str.split('.'))
891440
def get_versions():
    
    # import in the func (rather than top-level scope) so that at setup time,
    # `requests` isn't required -- otherwise, setuptools will fail to run
    # because requests isn't installed yet.
    import requests

    try:
        version_data = requests.get(
            "https://pypi.python.org/pypi/globus-cli/json"
        ).json()
        latest = max(LooseVersion(v) for v in version_data["releases"])
        return latest, LooseVersion(__version__)
    # if the fetch from pypi fails
    except requests.RequestException:
        return None, LooseVersion(__version__)
570305
def get_version():
    """"""
    proc = subprocess.Popen(
        ("git", "describe", "--tag", "--always"), 
        stdout=subprocess.PIPE, stderr=subprocess.STDOUT
    )
    output, _ = proc.communicate()
    result = output.decode("utf-8").strip()
    if proc.returncode != 0:
        sys.stderr.write(
            ">>> Git Describe Error:\n    " +
            result
        )
        return "1+unknown"
    split = result.split("-", 1)
    version = "+".join(split).replace("-", ".")

    if len(split) > 1:
        sys.stderr.write(
            ">>> Please verify the commit tag:\n    " +
            version + "\n"
        )
    return version
702259
def get_version():
    ""
    assert len(VERSION) == 5
    assert VERSION[3] in ('alpha', 'beta', 'rc', 'final')

    # Now build the two parts of the version number:
    # main = X.Y[.Z]
    # sub = .devN - for pre-alpha releases
    #     | {a|b|c}N - for alpha, beta and rc releases

    parts = 2 if VERSION[2] == 0 else 3
    main = '.'.join(str(x) for x in VERSION[:parts])

    sub = ''
    if VERSION[3] != 'final':
        mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
        sub = mapping[VERSION[3]] + str(VERSION[4])

    return str(main + sub)
699308
def get_version(cls):
        
        cmd_pieces = [cls.tool, '--version']
        process = Popen(cmd_pieces, stdout=PIPE, stderr=PIPE)
        out, err = process.communicate()
        if err:
            return ''
        else:
            return out.splitlines()[0].strip()