woob.core.repositories

open_for_config(filename)[source]
class ModuleInfo(name)[source]

Bases: object

Information about a module available on a repository.

load(items)[source]
has_caps(*caps)[source]

Return True if module implements at least one of the caps.

is_installed()[source]
is_local()[source]
dump()[source]
exception RepositoryUnavailable[source]

Bases: Exception

Repository in not available.

class Repository(url)[source]

Bases: object

Represents a repository.

INDEX = 'modules.list'
KEYDIR = '.keys'
KEYRING = 'trusted.gpg'
localurl2path()[source]

Get a local path of a file:// URL.

retrieve_index(browser, repo_path)[source]

Retrieve the index file of this repository. It can use network if this is a remote repository.

Parameters:

repo_path (str or None) – path to save the downloaded index file (if any).

retrieve_keyring(browser, keyring_path, progress)[source]
parse_index(fp)[source]

Parse index of a repository

Parameters:

fp (buffer) – file descriptor to read

build_index(path, filename)[source]

Rebuild index of modules of repository.

Parameters:
  • path (str) – path of the repository

  • filename (str) – file to save index

static get_tree_mtime(path, include_root=False)[source]
save(filename, private=False)[source]

Save repository into a file (modules.list for example).

Parameters:
  • filename (str) – path to file to save repository.

  • private (bool) – if enabled, save URL of repository. (default: False)

class Versions(path)[source]

Bases: object

VERSIONS_LIST = 'versions.list'
get(name)[source]
set(name, version)[source]
save()[source]
class IProgress[source]

Bases: object

progress(percent, message)[source]
error(message)[source]
prompt(message)[source]
class PrintProgress[source]

Bases: IProgress

progress(percent, message)[source]
error(message)[source]
prompt(message)[source]
class SubProgress(target, steps)[source]

Bases: IProgress

progress(percent, message)[source]
recursive_deps(direct_deps, key, result=None)[source]

take a dict of direct dependencies and get all dependencies of an element

>>> recursive_deps({1: {2, 3}, 2: {3}, 3: {4}, 4: set()}, 1)
{2, 3, 4}
class DepList(iterable=(), /)[source]

Bases: list

move_value_after(val, afters)[source]
dependency_sort(deps_rules)[source]
>>> dependency_sort({1: {2}, 2: {4}, 3: set(), 4: {3}})
[3, 4, 2, 1]
class Repositories(workdir, datadir, version)[source]

Bases: object

SOURCES_LIST = 'sources.list'
MODULES_DIR = 'modules'
MODULES_SUBDIR = 'woob_modules'
REPOS_DIR = 'repositories'
KEYRINGS_DIR = 'keyrings'
ICONS_DIR = 'icons'
SHARE_DIRS = ['modules', 'repositories', 'keyrings', 'icons']
load_browser()[source]
create_dir(name)[source]
namespace_package_content = 'from pkgutil import extend_path\n__path__ = extend_path(__path__, __name__)\n'
create_namespace_package(path)[source]
get_all_modules_info(caps=None)[source]

Get all ModuleInfo instances available.

Parameters:

caps (list[str]) – filter on capabilities: (default: None)

Return type:

dict[ModuleInfo]

get_module_info(name)[source]

Get ModuleInfo object of a module.

It tries all repositories from last to first, and set the ‘path’ attribute of ModuleInfo if it is installed.

load()[source]

Load repositories from ~/.local/share/woob/repositories/.

get_module_icon_path(module)[source]
retrieve_icon(module)[source]

Retrieve the icon of a module and save it in ~/.local/share/woob/icons/.

update_repositories(progress=PrintProgress())[source]

Update list of repositories by downloading them and put them in ~/.local/share/woob/repositories/.

Parameters:

progress (IProgress) – observer object. (default: PrintProgress())

check_repositories()[source]

Check if sources.list is consistent with repositories

update(progress=PrintProgress())[source]

Update repositories and install new packages versions.

Parameters:

progress (IProgress) – observer object. (default: PrintProgress())

install(module, progress=PrintProgress())[source]
static url2filename(url)[source]

Get a safe file name for an URL.

All non-alphanumeric characters are replaced by _.

property errors
exception InvalidSignature(filename)[source]

Bases: Exception

class Keyring(path)[source]

Bases: object

EXTENSION = '.gpg'
exists()[source]
save(keyring_data, version)[source]
static find_gpgv()[source]
static find_gpg()[source]
is_valid(data, sigdata)[source]

Check if the data is signed by an accepted key. data and sigdata should be strings.