Comment 20 for bug 1874250

Revision history for this message
Jaroslaw Smorczewski (smoczyna) wrote :

All right, cosidering Brian feedback I found the way to override the issue.

This is my modification to distro-info.py file sitting in:
 /usr/local/lib/python3.6/dist-packages/

I had to add 2 methods to get going, all the rest of the code is the same.

class DistroRecord(object):
    def __init__(self, row):
        self.version = row['version']
        self.codename = row['codename']
        self.series = row['series']
        self.created = row['created']
        self.release = row['release']
        self.eol = row['eol']
        # self.eol_server = row['eol-server'] if not None else None
        # self.eol_esm = row['eol-esm'] if not None else None

class DistroInfo(object):
    """Base class for distribution information.
    Use DebianDistroInfo or UbuntuDistroInfo instead of using this directly.
    """

    def __init__(self, distro):
        self._distro = distro
        filename = os.path.join(_get_data_dir(), distro.lower() + ".csv")
        csvfile = open(filename)
        csv_reader = csv.DictReader(csvfile)
        self._rows = []
        self._date = datetime.date.today()
        self.versions = []
        for row in csv_reader:
            for column in ("created", "release", "eol", "eol-server"):
                if column in row:
                    row[column] = convert_date(row[column])
            self._rows.append(row)
            self.versions.append(DistroRecord(row))

    @property
    def all(self, result="codename"):
        """List all known distributions."""
        return [self._format(result, x) for x in self._rows]

    def get_all(self, mode):
        if mode=='object':
            return self.versions

    def version(self, codename):
        return next((x.version for x in self.versions if x.series == codename), None)

...
all the same after this

with those changes distro upgrade gets going, so far.