eol.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:python-apt-mirror-updater 作者: xolox 项目源码 文件源码
def gather_eol_dates(context, directory=DISTRO_INFO_DIRECTORY):
    """
    Gather release `end of life`_ dates from distro-info-data_ CSV files.

    :param context: An execution context created by :mod:`executor.contexts`.
    :param directory: The pathname of a directory with CSV files containing
                      end-of-life dates (a string, defaults to
                      :data:`DISTRO_INFO_DIRECTORY`).
    :returns: A dictionary like :data:`KNOWN_EOL_DATES`.
    """
    known_dates = {}
    if context.is_directory(directory):
        for entry in context.list_entries(directory):
            filename = os.path.join(directory, entry)
            basename, extension = os.path.splitext(entry)
            if extension.lower() == '.csv':
                distributor_id = basename.lower()
                known_dates[distributor_id] = {}
                contents = context.read_file(filename)
                for row in csv.DictReader(StringIO(contents)):
                    series = row.get('series')
                    eol = row.get('eol-server') or row.get('eol')
                    if series and eol:
                        eol = time.mktime(parse_date(eol) + (-1, -1, -1))
                        known_dates[distributor_id][series] = int(eol)
    return known_dates
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号