pbds module (PBDS class)

Author:Chris Warrick <chris@chriswarrick.com>
Copyright:© 2011-2017, Chris Warrick.
License:BSD (see /LICENSE or Appendix B.)
Date:2017-01-08
Version:4.2.10

PBDS

New in version 2.1.0.0.

class PBDS

This is the class used for storing data. Currently, it stores the following information (not including information humans should not touch and care about):

variable contents/usage default/acceptable values
colors colors currently used in the script [colors]
pacman using wrapper-friendly behavior? [pacman] False
validate validating package installation? True
depcheck checking if deps are installed? True
pkginst if makepkg should install packages True
inttext text shown while interrupting (^C) [inttext]
wrapperinttext text shown while wrapper is interrupting (^C) [wrapperinttext]
paccommand Pacman command to use pacman
hassudo If sudo is present (see sudo()) (bool)
uid Current UID os.geteuid()
confhome configuration home ~/.config/
kwdir directory used by all projects by yours truly ~/.config/kwpolska
confdir configuration directory ~/.config/kwpolska/pkgbuilder
log logger object (e.g. PBDS.log.info) logger object
ui an instance of pkgbuilder.ui.UI None or pkgbuilder.ui.UI
pyc a pycman instance None or pycman instance
[colors]Code below.
colors = {
    'all_off':    '\x1b[1;0m',
    'bold':       '\x1b[1;1m',
    'blue':       '\x1b[1;1m\x1b[1;34m',
    'green':      '\x1b[1;1m\x1b[1;32m',
    'red':        '\x1b[1;1m\x1b[1;31m',
    'yellow':     '\x1b[1;1m\x1b[1;33m'
}
[pacman]wrapper-friendly behavior (-S): building in /tmp; Utils.print_package() says aur/name
[inttext]Used by /bin/pkgbuilder, internationalized, looks like this: Aborted by user! Quitting...
[wrapperinttext]Used by /bin/pb, internationalized, looks like this: Interrupt signal received\n
[conf]In order: ~/.config/, ~/.config/kwpolska, ~/.config/kwpolska/pkgbuilder (may differ depending on system config)

PKGBUILDer Data Storage.

Copyright:© 2011-2017, Chris Warrick.
License:BSD (see /LICENSE).
class pkgbuilder.pbds.PBDS[source]

PKGBUILDer Data Storage.

colorsoff()[source]

Disable colors.

colorson()[source]

Enable colors.

debugmode(nochange=False)[source]

Print all the logged messages to stderr.

fancy_error(text)[source]

Display error messages.

fancy_error2(text)[source]

Display error sub-messages.

fancy_msg(text)[source]

Display main messages.

fancy_msg2(text)[source]

Display sub-messages.

fancy_warning(text)[source]

Display warning messages.

fancy_warning2(text)[source]

Display warning sub-messages.

get_setting(name, config_section, config_option, positive, negative)[source]

Get the value of a setting, based on config file and arguments.

Parameters:
  • name (str) – name of setting, used for error on conflict
  • config_section (bool) – configuration file section
  • config_option (bool) – configuration file option
  • positive (bool) – positive argument
  • negative (bool) – negative argument
Returns:

the value requested by the user, defaults to config

Return type:

bool

pyc

Return a pycman handle, initializing one if necessary.

pycreload()[source]

Reload pycman.

root_crash()[source]

Crash if running as root.

run_command(args, prepend=None, asonearg=False)[source]

Run a command.

Note

Accepts only one command. shell=False, for safety. asonearg is for su -c and most people don’t need nor want it.

Note

since version 2.1.6.2, args must be a list.

sudo(args)[source]

Run as root.

Uses sudo if present, su -c otherwise, nothing if already running as root.

Note

Accepts only one command. shell=False, for safety.