SlackLog parsers

SlackLog parser takes a string representation of a Slackware ChangeLog.txt and produces an in-memory representation of it.

The in-memory representation is an instance of SlackLog.

class slacklog.parsers.SlackLogParser[source]

Bases: object

Parser for Slackware ChangeLog.txt files. Works for Slackware 12.x and newer.

quiet

If True, warnings about date parsing are not printed.

min_date

If set to a datetime object, older log entries are ignored.

ENTRY

Counter of entries (debugging).

PKG

Counter of packages (debugging).

parse(data)[source]

Return SlackLog object representing parsed data.

split_log_to_entries(data)[source]

Split the ChangeLog into individual entries.

parse_entry(data, log)[source]

Parse a single entry.

gen_entry_checksum(data)[source]

Generate SHA512 checksum of entry.

gen_entry_identifier(data, checksum, parent)[source]

Generate SHA512 identifier for entry.

parse_entry_timestamp(data)[source]

Parse timestamp of entry and return timestamp, timezone, 12-hour flag, and remaining data.

parse_entry_description(data)[source]

Parse entry description and return description + remaining data.

split_entry_to_pkgs(data)[source]

Split entry content into package blocks.

parse_pkg(data, entry)[source]

Parse a package from a block of text.

parse_pkg_name(data)[source]

Extract package name and description from a line.

parse_pkg_description(data)[source]

Return package description.

get_line(data)[source]

Consume and return first line + remainder.

parse_date(data)[source]

Parse date string to datetime in UTC.

parse_date_with_timezone(data)[source]

Parse date string to datetime + original tzinfo.