Iterates over the AMIs available for the specified distro.

 === Parameters
 distro<String>:: Release name of the distro to display.

 === Returns
 Hash:: Keys are the AMI type, values are the AMI ID.
493661
def list_amis(distro)
      amis = Hash.new
      Ubuntu.release(distro).amis.each do |ami|
        amis[build_type(ami.region, ami.arch, ami.root_store, ami.virtualization_type)] = ami.name
      end
      amis
    end
688417
def package_releases(request, package_name, show_hidden=False):
    
    session = DBSession()
    package = Package.by_name(session, package_name)
    return [rel.version for rel in package.sorted_releases]
439156
def get_distribution_names(self):
        
        result = set()
        for locator in self.locators:
            try:
                result |= locator.get_distribution_names()
            except NotImplementedError:
                pass
        return result
1288640
def _get_openstack_release_string(self):
        
        releases = OrderedDict([
            ('trusty', 'icehouse'),
            ('xenial', 'mitaka'),
            ('yakkety', 'newton'),
            ('zesty', 'ocata'),
            ('artful', 'pike'),
            ('bionic', 'queens'),
            ('cosmic', 'rocky'),
            ('disco', 'stein'),
        ])
        if self.openstack:
            os_origin = self.openstack.split(':')[1]
            return os_origin.split('%s-' % self.series)[1].split('/')[0]
        else:
            return releases[self.series]
1286469
def interpret_distro_name(
        location, basename, metadata, py_version=None, precedence=SOURCE_DIST,
        platform=None
):
    
    # Generate alternative interpretations of a source distro name
    # Because some packages are ambiguous as to name/versions split
    # e.g. "adns-python-1.1.0", "egenix-mx-commercial", etc.
    # So, we generate each possible interepretation (e.g. "adns, python-1.1.0"
    # "adns-python, 1.1.0", and "adns-python-1.1.0, no version").  In practice,
    # the spurious interpretations should be ignored, because in the event
    # there's also an "adns" package, the spurious "python-1.1.0" version will
    # compare lower than any numeric version number, and is therefore unlikely
    # to match a request for it.  It's still a potential problem, though, and
    # in the long run PyPI and the distutils should go for "safe" names and
    # versions in distribution archive names (sdist and bdist).

    parts = basename.split('-')
    if not py_version and any(re.match(r'py\d\.\d$', p) for p in parts[2:]):
        # it is a bdist_dumb, not an sdist -- bail out
        return

    for p in range(1, len(parts) + 1):
        yield Distribution(
            location, metadata, '-'.join(parts[:p]), '-'.join(parts[p:]),
            py_version=py_version, precedence=precedence,
            platform=platform
        )
1037915
def os_major
      if os_name == 'Debian' &&
         facts[:ansible_distribution_major_version][%r{\/sid}i]
        debian_os_major_sid
      else
        facts[:ansible_distribution_major_version] ||
          facts[:ansible_lsb] && facts[:ansible_lsb]['major_release'] ||
          (facts[:version].split('R')[0] if os_name == 'junos')
      end
    end
804030
def check_release_files(package_info, *args):
    
    reason = "No release files uploaded"
    result = False

    release_urls = args[0]
    if len(release_urls) > 0:
        result = True

    return result, reason, HAS_RELEASE_FILES
629033
def attowiki_distro_path():
    
    attowiki_path = os.path.abspath(__file__)
    if attowiki_path[-1] != '/':
        attowiki_path = attowiki_path[:attowiki_path.rfind('/')]
    else:
        attowiki_path = attowiki_path[:attowiki_path[:-1].rfind('/')]
    return attowiki_path
43997
def parse_dist(self, os_version):
        
        supported = {'rhel': ['rhel', 'redhat', 'red hat'],
                    'sles': ['suse', 'sles'],
                    'ubuntu': ['ubuntu']}
        os_version = os_version.lower()
        for distro, patterns in supported.items():
            for i in patterns:
                if os_version.startswith(i):
                    # Not guarrentee the version is digital
                    remain = os_version.split(i, 2)[1]
                    release = self._parse_release(os_version, distro, remain)
                    return distro, release

        msg = 'Can not handle os: %s' % os_version
        raise exception.ZVMException(msg=msg)
1026932
def get_platform_info():
        

        try:
            system_name = platform.system()
            release_name = platform.release()
        except:
            system_name = "Unknown"
            release_name = "Unknown"

        return {
            'system': system_name,
            'release': release_name,
        }
221032
def linux_distribution(self, full_distribution_name=True):
        
        return (
            self.name() if full_distribution_name else self.id(),
            self.version(),
            self.codename()
        )
315478
def get_distribution_names(self):
        
        result = set()
        for root, dirs, files in os.walk(self.base_dir):
            for fn in files:
                if self.should_include(fn, root):
                    fn = os.path.join(root, fn)
                    url = urlunparse(('file', '',
                                      pathname2url(os.path.abspath(fn)),
                                      '', '', ''))
                    info = self.convert_url_to_download_info(url, None)
                    if info:
                        result.add(info['name'])
            if not self.recursive:
                break
        return result
868771
def installed_identities
      available = request_valid_identities
      ids = {}
      available.split("\n").each do |current|
        begin
          sha1 = current.match(/[a-zA-Z0-9]{40}/).to_s
          name = current.match(/.*\"(.*)\"/)[1]
          ids[sha1] = name
        rescue
          nil
        end # the last line does not match
      end

      ids
    end
1319616
def distutils_dir_name(dname):
    
    f = "{dirname}.{platform}-{version[0]}.{version[1]}"
    return f.format(dirname=dname,
                    platform=sysconfig.get_platform(),
                    version=sys.version_info)
583261
def _check_ver(pyver, op, wanted):
    '''
    
    '''
    pyver = distutils.version.LooseVersion(pyver)
    wanted = distutils.version.LooseVersion(wanted)
    return getattr(operator, '__{}__'.format(op))(pyver, wanted)
1300308
def dev_version():
  

  md5_hash = hashlib.md5()
  py_files = sorted(list_files(suffix=".py"))
  if not py_files:
    return ''
  for filename in py_files:
    with open(filename, 'rb') as fobj:
      content = fobj.read()
    md5_hash.update(content)
  return md5_hash.hexdigest()
621809
def dist_version(self):
        
        try:
            with open('/etc/lsb-release', 'r') as fp:
                lines = fp.readlines()
                for line in lines:
                    if "DISTRIB_RELEASE" in line:
                        return line.split("=")[1].strip()
            return False
        except IOError:
            return False