mini_buildd package

Subpackages

Submodules

Module contents

mini_buildd.NEWLINE = '\n'

For use in fstrings

mini_buildd.fopen(path, mode='r', **kwargs)

Text file open with our fixed char encoding (UTF-8).

UTF-8 may become default for open at some point, but not just yet.

See https://www.python.org/dev/peps/pep-0597/

class mini_buildd.PyCompat

Bases: object

Misc helpers to stay compatible with python <= 3.6 (see debian/control).

static removeprefix(s, prefix)

Attention

compat (python < 3.9): str.removeprefix.

static shlex_join(split_command)

Attention

compat (python < 3.8): shlex.join.

mini_buildd.http_endpoint(number=0)
mini_buildd.get_daemon()

Shortcut to access daemon singleton.

mini_buildd.mdls()

Get python package mini_buildd.models with all needed modules available (sort-of dependency injection).

Code may just use this w/o the need to import django-related code, neither as proper main import (this usually fails as django needs to be set up first) nor as in-code import (this is dirty and also usually needs a static code checker exemption).

class mini_buildd.Rfc7807(status, detail=None)

Bases: object

to_json()
classmethod from_json(json)
exception mini_buildd.HTTPError(status, detail=None)

Bases: Exception

Public (HTTP) exception – raise this if the exception string is ok for user consumption.

exception mini_buildd.HTTPOk(detail=None)

Bases: HTTPError

exception mini_buildd.HTTPNotFound(detail=None)

Bases: HTTPError

exception mini_buildd.HTTPBadRequest(detail=None)

Bases: HTTPError

exception mini_buildd.HTTPUnauthorized(detail=None)

Bases: HTTPError

exception mini_buildd.HTTPUnavailable(detail=None)

Bases: HTTPError

exception mini_buildd.HTTPInternal(detail=None)

Bases: HTTPError

mini_buildd.log_exception(log, message, exception, level=30)
mini_buildd.log_stack(log, level=20)

Log stack (for debugging)

mini_buildd.e2http(exception, status=HTTPStatus.INTERNAL_SERVER_ERROR)
mini_buildd.rrpes(func, *args, **kwargs)

Run func. On exception, return public error str.

mini_buildd.check_program(path, deb=None)
mini_buildd.systemcert_workaround()

Set environment SSL_CERT_FILE to point to system’s certificate store (ca-certificates) when not using libssl3

Tip

compat (< libssl3): python fails for (self-signed) certificate even though it’s enrolled with system’s ca-certificates?

You will get some error like certificate verify failed: self signed certificate.

This seems to occur with libssl1, while it seems fine with libssl3 (even though Debian Bug #805646 never got closed).

Check the package deps on libpythonX.Y-minimal to see if it was build against libssl1 or libssl3 (or mini-buildd’s log for warning message).

Simplest workaround is to set SSL_CERT_FILE environment, for example like so:

export SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"