specifications.py

sysdirs.specifications

Copyright (C) 2018 Mathias Stelzer

sysdirs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

sysdirs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

exception sysdirs.specifications.InitializationError[source]

Bases: Exception

sysdirs.specifications.try_makedirs(path, mode=448)[source]
sysdirs.specifications.touch(path, mode=None)[source]
class sysdirs.specifications.DirectorySpecification(force=None)[source]

Bases: object

name = NotImplemented
description = NotImplemented
hidden = False
requires_root = False
force = False
init(installer)[source]

Initialize installer.

init_install()[source]

Initialize installation.

installer
is_available_for_installation()[source]
is_installed()[source]
all
uninstall()[source]
_install_type(type_dir, type_dir_mode, source=None, relpath=None, mode=None)[source]
config
get_config()[source]

Return the directory to store configuration files.

get_config_dirs()[source]

Return all possible configration locations.

get_config_files(relpath, first=False, create=False)[source]
any_config_dir_exists()[source]
install_config(source=None, relpath=None, mode=480)[source]
data
get_data()[source]

Return the directory to store (shared) data files.

get_data_dirs()[source]
get_data_files(relpath, first=False, create=False)[source]
any_data_dir_exists()[source]
install_data(source=None, relpath=None, mode=None)[source]
cache
get_cache()[source]

Return the directory to store cache files.

install_cache(source=None, relpath=None, mode=None)[source]
var
get_var()[source]

Return the directory to store variable files.

install_var(source=None, relpath=None, mode=None)[source]
run
get_run()[source]

Return the directory to store runtime files.

install_run(source=None, relpath=None, mode=None)[source]
log
get_log()[source]

Return the directory to store log files.

install_log(source=None, relpath=None, mode=None)[source]
sysdirs.specifications.get_gid_by_name(name)[source]
sysdirs.specifications.clean_group(answer)[source]
class sysdirs.specifications.FHS(force=False, chown_group=None, support_hier=True)[source]

Bases: sysdirs.specifications.DirectorySpecification

name = 'FHS'
description = '/etc, /usr, /var'
requires_root = True
is_available_for_installation()[source]
get_gid(group)[source]
init_install()[source]

Initialize installation.

_install_type(type_dir, type_dir_mode, source=None, relpath=None, mode=None)[source]
get_config()[source]

Return the directory to store configuration files.

get_data()[source]

Return the directory to store (shared) data files.

get_data_dirs()[source]
get_cache()[source]

Return the directory to store cache files.

get_var()[source]

Return the directory to store variable files.

get_run()[source]

Return the directory to store runtime files.

get_log()[source]

Return the directory to store log files.

class sysdirs.specifications.XDG(force=None)[source]

Bases: sysdirs.specifications.DirectorySpecification

name = 'XDG'
description = 'XDG_* environment variables. E.g. ~/.config, ~/.cache, ~/.local/share'
get_config()[source]

Return the directory to store configuration files.

get_config_dirs()[source]

Return all possible configration locations.

get_data()[source]

Return the directory to store (shared) data files.

get_data_dirs()[source]
get_cache()[source]

Return the directory to store cache files.

get_var()[source]

Return the directory to store variable files.

install_var(*args, **kwargs)[source]
get_run()[source]

Return the directory to store runtime files.

get_log()[source]

Return the directory to store log files.

install_log(*args, **kwargs)[source]
class sysdirs.specifications.DevDir(path, hidden=True)[source]

Bases: sysdirs.specifications.DirectorySpecification

name = 'dev'
description = 'Single directory for development'
get_config()[source]

Return the directory to store configuration files.

install_config(*args, **kwargs)[source]
get_data()[source]

Return the directory to store (shared) data files.

get_cache()[source]

Return the directory to store cache files.

install_cache(*args, **kwargs)[source]
get_var()[source]

Return the directory to store variable files.

install_var(*args, **kwargs)[source]
get_run()[source]

Return the directory to store runtime files.

install_run(*args, **kwargs)[source]
get_log()[source]

Return the directory to store log files.

install_log(*args, **kwargs)[source]
sysdirs.specifications.find_files(dirs, relpath, first=False, default=None)[source]