pykickstart.options
index
/usr/lib/python2.6/site-packages/pykickstart/options.py

Specialized option handling.
 
This module exports two classes:
 
    KSOptionParser - A specialized subclass of OptionParser to be used
                     in BaseHandler subclasses.
 
    KSOption - A specialized subclass of Option.

 
Modules
       
gettext
imputil
re
sys
warnings

 
Classes
       
optparse.Option
KSOption
optparse.OptionParser(optparse.OptionContainer)
KSOptionParser

 
class KSOption(optparse.Option)
    # Creates a new Option class that supports several new attributes:
# - required:  any option with this attribute must be supplied or an exception
#              is thrown
# - introduced:  the kickstart syntax version that this option first appeared
#                in - an exception will be raised if the option is used and
#                the specified syntax version is less than the value of this
#                attribute
# - deprecated:  the kickstart syntax version that this option was deprecated
#                in - a DeprecationWarning will be thrown if the option is
#                used and the specified syntax version is greater than the
#                value of this attribute
# - removed:  the kickstart syntax version that this option was removed in - an
#             exception will be raised if the option is used and the specified
#             syntax version is greated than the value of this attribute
# Also creates a new type:
# - ksboolean:  support various kinds of boolean values on an option
# And two new actions:
# - map :  allows you to define an opt -> val mapping such that dest gets val
#          when opt is seen
# - map_extend:  allows you to define an opt -> [val1, ... valn] mapping such
#                that dest gets a list of vals built up when opt is seen
 
  Methods defined here:
__init__(self, *args, **kwargs)
process(self, opt, value, values, parser)
take_action(self, action, dest, opt, value, values, parser)
# Override default take_action method to handle our custom actions.

Data and other attributes defined here:
ACTIONS = ('store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count', 'callback', 'help', 'version', 'map', 'map_extend')
ATTRS = ['action', 'type', 'dest', 'default', 'nargs', 'const', 'choices', 'callback', 'callback_args', 'callback_kwargs', 'help', 'metavar', 'introduced', 'deprecated', 'removed', 'required']
CHECK_METHODS = [<function _check_action at 0x1ae4320>, <function _check_type at 0x1ae4398>, <function _check_choice at 0x1ae4410>, <function _check_dest at 0x1ae4488>, <function _check_const at 0x1ae4500>, <function _check_nargs at 0x1ae4578>, <function _check_callback at 0x1ae45f0>, <function _check_required at 0x1cb30c8>]
STORE_ACTIONS = ('store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count', 'map', 'map_extend')
TYPES = ('string', 'int', 'long', 'float', 'complex', 'choice', 'ksboolean', 'string')
TYPE_CHECKER = {'choice': <function check_choice at 0x1ae4050>, 'complex': <function check_builtin at 0x1ae2f50>, 'float': <function check_builtin at 0x1ae2f50>, 'int': <function check_builtin at 0x1ae2f50>, 'ksboolean': <function _check_ksboolean at 0x1b43410>, 'long': <function check_builtin at 0x1ae2f50>, 'string': <function _check_string at 0x1cb2f50>}

Methods inherited from optparse.Option:
__repr__ = _repr(self)
__str__(self)
check_value(self, opt, value)
convert_value(self, opt, value)
get_opt_string(self)
takes_value(self)

Data and other attributes inherited from optparse.Option:
ALWAYS_TYPED_ACTIONS = ('store', 'append')
CONST_ACTIONS = ('store_const', 'append_const')
TYPED_ACTIONS = ('store', 'append', 'callback')

 
class KSOptionParser(optparse.OptionParser)
    A specialized subclass of optparse.OptionParser to handle extra option
attribute checking, work error reporting into the KickstartParseError
framework, and to turn off the default help.
 
 
Method resolution order:
KSOptionParser
optparse.OptionParser
optparse.OptionContainer

Methods defined here:
__init__(self, map={}, version=None)
Create a new KSOptionParser instance.  Each KickstartCommand
subclass should create one instance of KSOptionParser, providing
at least the lineno attribute.  map and version are not required.
Instance attributes:
 
map     -- A mapping from option strings to different values.
version -- The version of the kickstart syntax we are checking
           against.
check_values(self, values, args)
error(self, msg)
exit(self, status=0, msg=None)
keys(self)
parse_args(self, *args, **kwargs)

Methods inherited from optparse.OptionParser:
add_option_group(self, *args, **kwargs)
destroy(self)
Declare that you are done with this OptionParser.  This cleans up
reference cycles so the OptionParser (and all objects referenced by
it) can be garbage-collected promptly.  After calling destroy(), the
OptionParser is unusable.
disable_interspersed_args(self)
Set parsing to stop on the first non-option. Use this if
you have a command processor which runs another command that
has options of its own and you want to make sure these options
don't get confused.
enable_interspersed_args(self)
Set parsing to not stop on the first non-option, allowing
interspersing switches with command arguments. This is the
default behavior. See also disable_interspersed_args() and the
class documentation description of the attribute
allow_interspersed_args.
expand_prog_name(self, s)
format_epilog(self, formatter)
format_help(self, formatter=None)
format_option_help(self, formatter=None)
get_default_values(self)
get_description(self)
get_option_group(self, opt_str)
get_prog_name(self)
get_usage(self)
get_version(self)
print_help(self, file=None)
print_help(file : file = stdout)
 
Print an extended help message, listing all options and any
help text provided with them, to 'file' (default stdout).
print_usage(self, file=None)
print_usage(file : file = stdout)
 
Print the usage message for the current program (self.usage) to
'file' (default stdout).  Any occurrence of the string "%prog" in
self.usage is replaced with the name of the current program
(basename of sys.argv[0]).  Does nothing if self.usage is empty
or not defined.
print_version(self, file=None)
print_version(file : file = stdout)
 
Print the version message for this program (self.version) to
'file' (default stdout).  As with print_usage(), any occurrence
of "%prog" in self.version is replaced by the current program's
name.  Does nothing if self.version is empty or undefined.
set_default(self, dest, value)
set_defaults(self, **kwargs)
set_process_default_values(self, process)
set_usage(self, usage)

Data and other attributes inherited from optparse.OptionParser:
standard_option_list = []

Methods inherited from optparse.OptionContainer:
add_option(self, *args, **kwargs)
add_option(Option)
add_option(opt_str, ..., kwarg=val, ...)
add_options(self, option_list)
format_description(self, formatter)
get_option(self, opt_str)
has_option(self, opt_str)
remove_option(self, opt_str)
set_conflict_handler(self, handler)
set_description(self, description)

 
Data
        BOOTPROTO_BOOTP = 'bootp'
BOOTPROTO_DHCP = 'dhcp'
BOOTPROTO_QUERY = 'query'
BOOTPROTO_STATIC = 'static'
CLEARPART_TYPE_ALL = 1
CLEARPART_TYPE_LINUX = 0
CLEARPART_TYPE_NONE = 2
DEVEL = 11000
DISPLAY_MODE_CMDLINE = 0
DISPLAY_MODE_GRAPHICAL = 1
DISPLAY_MODE_TEXT = 2
F10 = 8000
F11 = 9000
F12 = 10000
F13 = 11000
F7 = 5000
F8 = 6000
F9 = 7000
FC3 = 1000
FC4 = 2000
FC5 = 3000
FC6 = 4000
FIRSTBOOT_DEFAULT = 0
FIRSTBOOT_RECONFIG = 2
FIRSTBOOT_SKIP = 1
GROUP_ALL = 2
GROUP_DEFAULT = 1
GROUP_REQUIRED = 0
KS_INSTKEY_SKIP = -99
KS_MISSING_IGNORE = 1
KS_MISSING_PROMPT = 0
KS_REBOOT = 1
KS_SCRIPT_POST = 1
KS_SCRIPT_PRE = 0
KS_SCRIPT_TRACEBACK = 2
KS_SHUTDOWN = 2
KS_WAIT = 0
RHEL3 = 900
RHEL4 = 1100
RHEL5 = 4100
RHEL6 = 11100
SELINUX_DISABLED = 0
SELINUX_ENFORCING = 1
SELINUX_PERMISSIVE = 2
SUPPRESS_HELP = 'SUPPRESSHELP'
SUPPRESS_USAGE = 'SUPPRESSUSAGE'
versionMap = {'DEVEL': 11000, 'F10': 8000, 'F11': 9000, 'F12': 10000, 'F13': 11000, 'F7': 5000, 'F8': 6000, 'F9': 7000, 'FC3': 1000, 'FC4': 2000, ...}