def get_linux_distribution():
    (distrib, version, _) = distro.linux_distribution()
    distrib = six.ensure_str(distrib)
    version = six.ensure_str(version)
    if (distrib in ['LinuxMint', 'Linux Mint', 'KDE neon']):
        if ('.' in version):
            (major, _) = version.split('.', 1)
        else:
            major = version
        if (major == '20'):
            base_version = '20.04'
        elif (major == '19'):
            base_version = '18.04'
        elif (major == '18'):
            base_version = '16.04'
        else:
            raise Exception(('unsupported version of %s: %s' % (distrib, version)))
        (distrib, version) = ('Ubuntu', base_version)
    elif (distrib == 'Pop!_OS'):
        if ('.' in version):
            (major, _) = version.split('.', 1)
        else:
            major = version
        if (major == '20'):
            base_version = '20.04'
        elif (major == '19'):
            base_version = '18.04'
        elif (major == '18'):
            base_version = '16.04'
        else:
            raise Exception(('unsupported version of %s: %s' % (distrib, version)))
        (distrib, version) = ('Ubuntu', base_version)
    elif (distrib.lower() == 'elementary'):
        if (version == '5.0'):
            base_version = '18.04'
        elif (version[0:3] == '0.4'):
            base_version = '16.04'
        else:
            raise Exception(('unsupported version of %s: %s' % (distrib, version)))
        (distrib, version) = ('Ubuntu', base_version)
    elif (distrib.lower() == 'ubuntu'):
        if (version > '21.04'):
            raise Exception(('unsupported version of %s: %s' % (distrib, version)))
    elif (distrib.lower() not in ['centos', 'centos linux', 'debian gnu/linux', 'fedora', 'void', 'nixos']):
        raise Exception(('mach bootstrap does not support %s, please file a bug' % distrib))
    return (distrib, version)
def get_linux_distribution():
    (distrib, version, _) = distro.linux_distribution()
    distrib = six.ensure_str(distrib)
    version = six.ensure_str(version)
    if (distrib in ['LinuxMint', 'Linux Mint', 'KDE neon']):
        if ('.' in version):
            (major, _) = version.split('.', 1)
        else:
            major = version
        if (major == '20'):
            base_version = '20.04'
        elif (major == '19'):
            base_version = '18.04'
        elif (major == '18'):
            base_version = '16.04'
        else:
            raise Exception(('unsupported version of %s: %s' % (distrib, version)))
        (distrib, version) = ('Ubuntu', base_version)
    elif (distrib == 'Pop!_OS'):
        if ('.' in version):
            (major, _) = version.split('.', 1)
        else:
            major = version
        if (major == '20'):
            base_version = '20.04'
        elif (major == '19'):
            base_version = '18.04'
        elif (major == '18'):
            base_version = '16.04'
        else:
            raise Exception(('unsupported version of %s: %s' % (distrib, version)))
        (distrib, version) = ('Ubuntu', base_version)
    elif (distrib.lower() == 'elementary'):
        if (version == '5.0'):
            base_version = '18.04'
        elif (version[0:3] == '0.4'):
            base_version = '16.04'
        else:
            raise Exception(('unsupported version of %s: %s' % (distrib, version)))
        (distrib, version) = ('Ubuntu', base_version)
    elif (distrib.lower() == 'ubuntu'):
        if (version > '21.04'):
            raise Exception(('unsupported version of %s: %s' % (distrib, version)))
    elif (distrib.lower() not in ['centos', 'centos linux', 'debian gnu/linux', 'fedora', 'void', 'nixos']):
        raise Exception(('mach bootstrap does not support %s, please file a bug' % distrib))
    return (distrib, version)