l.a.utils : module documentation

Part of lp.archiveuploader

Archive uploader utilities.
Class UploadError All upload errors are returned in this form.
Class UploadWarning All upload warnings are returned in this form.
Class DpkgSourceError Undocumented
Function get_source_file_extension Get the extension part of a source file name.
Function determine_source_file_type Determine the SourcePackageFileType of the given filename.
Function determine_binary_file_type Determine the BinaryPackageFileType of the given filename.
Function prefix_multi_line_string Utility function to split an input string and prefix,
Function extract_component_from_section Undocumented
Class ParseMaintError Exception raised for errors in parsing a maintainer field.
Function parse_maintainer Parses a Maintainer or Changed-By field into the name and address.
Function parse_maintainer_bytes Wrapper for parse_maintainer to handle both Unicode and bytestrings.
Function rfc822_encode_address Return a Unicode RFC822 encoding of a name and an email address.
Function extract_dpkg_source Extract a source package by dsc file path.
Function parse_file_list Undocumented
Function merge_file_lists Merge Files, Checksums-Sha1 and Checksums-Sha256 fields.
Function parse_and_merge_file_lists Undocumented
def get_source_file_extension(filename):
Get the extension part of a source file name.
def determine_source_file_type(filename):
Determine the SourcePackageFileType of the given filename.
def determine_binary_file_type(filename):
Determine the BinaryPackageFileType of the given filename.
def prefix_multi_line_string(str, prefix, include_blank_lines=0):
Utility function to split an input string and prefix,

Each line with a token or tag. Can be used for quoting text etc.

def extract_component_from_section(section, default_component='main'):
Undocumented
def parse_maintainer(maintainer, field_name='Maintainer'):
Parses a Maintainer or Changed-By field into the name and address.

maintainer, name and address are all Unicode.

def parse_maintainer_bytes(content, fieldname):
Wrapper for parse_maintainer to handle both Unicode and bytestrings.

It verifies the content type and transforms it to a unicode with guess(). Then we can safely call parse_maintainer().

def rfc822_encode_address(name, email):
Return a Unicode RFC822 encoding of a name and an email address.

name and email must be Unicode. If they contain non-ASCII characters, the result is not RFC822-compliant and you should use something like format_address instead.

This is similar to email.utils.format_addr, except that it handles special characters using the 'email (name)' format rather than '"name" (email)'.

def extract_dpkg_source(dsc_filepath, target, vendor=None):
Extract a source package by dsc file path.
Parametersdsc_filepathPath of the DSC file
targetTarget directory
def parse_file_list(s, field_name, count):
Undocumented
def merge_file_lists(files, checksums_sha1, checksums_sha256, changes=True):
Merge Files, Checksums-Sha1 and Checksums-Sha256 fields.

Turns lists of (MD5, size, [extras, ...,] filename), (SHA1, size, filename) and (SHA256, size, filename) into a list of (filename, {algo: hash}, size, [extras, ...], filename).

Duplicate filenames, size conflicts, and files with missing hashes will cause an UploadError.

'extras' is (section, priority) if changes=True, otherwise it is omitted.

def parse_and_merge_file_lists(tag_dict, changes=True):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.