()
return sorted(result, key=lambda r: (r.distributor_id, r.version or 0, r.series))
Discover known Debian and Ubuntu releases.

    :returns: A list of discovered :class:`Release` objects sorted by
             :attr:`~Release.distributor_id` and :attr:`~Release.version`.

    The first time this function is called it will try to parse the CSV files
    in ``/usr/share/distro-info`` and merge any releases it finds with the
    releases embedded into the source code of this module. The result is cached
    and returned each time the function is called. It's not a problem if the
    ``/usr/share/distro-info`` directory doesn't exist or doesn't contain any
    ``*.csv`` files (it won't cause a warning or error). Of course in this case
    only the embedded releases will be returned.
Discover known Debian and Ubuntu releases.
Discover known Debian and Ubuntu releases .
def discover_releases():
    """
    Discover known Debian and Ubuntu releases.

    :returns: A list of discovered :class:`Release` objects sorted by
             :attr:`~Release.distributor_id` and :attr:`~Release.version`.

    The first time this function is called it will try to parse the CSV files
    in ``/usr/share/distro-info`` and merge any releases it finds with the
    releases embedded into the source code of this module. The result is cached
    and returned each time the function is called. It's not a problem if the
    ``/usr/share/distro-info`` directory doesn't exist or doesn't contain any
    ``*.csv`` files (it won't cause a warning or error). Of course in this case
    only the embedded releases will be returned.
    """
    # Discover the known releases on the first call to discover_releases().
    # First we check the CSV files on the system where apt-smart
    # is running, because those files may be more up-to-date than the
    # bundled information is.
    result = set()
    for filename in glob.glob(os.path.join(DISTRO_INFO_DIRECTORY, '*.csv')):
        for release in parse_csv_file(filename):
            result.add(release)
    # Add the releases bundled with apt-smart to the result
    # without causing duplicate entries (due to the use of a set and key
    # properties).
    result.update(BUNDLED_RELEASES)
    # Sort the releases by distributor ID and version / series.
    return sorted(result, key=lambda r: (r.distributor_id, r.version or 0, r.series))
def discover_releases ( ) : # Discover the known releases on the first call to discover_releases(). # First we check the CSV files on the system where apt-smart # is running, because those files may be more up-to-date than the # bundled information is. result = set ( ) for filename in glob . glob ( os . path . join ( DISTRO_INFO_DIRECTORY , '*.csv' ) ) : for release in parse_csv_file ( filename ) : result . add ( release ) # Add the releases bundled with apt-smart to the result # without causing duplicate entries (due to the use of a set and key # properties). result . update ( BUNDLED_RELEASES ) # Sort the releases by distributor ID and version / series. return sorted ( result , key = lambda r : ( r . distributor_id , r . version or 0 , r . series ) )