(self)
The distribution codename (a lowercase string like 'trusty' or 'xenial')

        The value of this property is determined using APT sources.list and should be more robust.
        Similar to :func:`find_current_mirror` but return token[2] instead.
        Also refer code of :func:`coerce_release`.
The distribution codename (a lowercase string like 'trusty' or 'xenial')
The distribution codename ( a lowercase string like trusty or xenial )
def distribution_codename(self):
        """
        The distribution codename (a lowercase string like 'trusty' or 'xenial')

        The value of this property is determined using APT sources.list and should be more robust.
        Similar to :func:`find_current_mirror` but return token[2] instead.
        Also refer code of :func:`coerce_release`.

        """
        for line in self.get_sources_list().splitlines():
            # The first token should be `deb' or `deb-src', the second token is
            # the mirror's URL, the third token is the `distribution' and any
            # further tokens are `components'.
            tokens = line.split()
            if (len(tokens) >= 4
                    and tokens[0] in ('deb', 'deb-src')
                    and tokens[1].startswith(('http://', 'https://', 'ftp://', 'mirror://'))
                    and 'main' in tokens[3:]):
                matches = [release for release in discover_releases() if tokens[2].lower() in release.codename.lower()]
                if len(matches) != 1:
                    continue
                if self.ubuntu_mode and matches[0].distributor_id == 'linuxmint':
                    self.current_mirror = tokens[1]
                    continue
                if self.ubuntu_mode:
                    logging.info("In Ubuntu Mode, pretend to be %s" % coerce_release(tokens[2]))
                return tokens[2]
        raise EnvironmentError("Failed to determine the distribution codename using apt's package resource list!")
def distribution_codename ( self ) : for line in self . get_sources_list ( ) . splitlines ( ) : # The first token should be `deb' or `deb-src', the second token is # the mirror's URL, the third token is the `distribution' and any # further tokens are `components'. tokens = line . split ( ) if ( len ( tokens ) >= 4 and tokens [ 0 ] in ( 'deb' , 'deb-src' ) and tokens [ 1 ] . startswith ( ( 'http://' , 'https://' , 'ftp://' , 'mirror://' ) ) and 'main' in tokens [ 3 : ] ) : matches = [ release for release in discover_releases ( ) if tokens [ 2 ] . lower ( ) in release . codename . lower ( ) ] if len ( matches ) != 1 : continue if self . ubuntu_mode and matches [ 0 ] . distributor_id == 'linuxmint' : self . current_mirror = tokens [ 1 ] continue if self . ubuntu_mode : logging . info ( "In Ubuntu Mode, pretend to be %s" % coerce_release ( tokens [ 2 ] ) ) return tokens [ 2 ] raise EnvironmentError ( "Failed to determine the distribution codename using apt's package resource list!" )