Improve documentation
This commit is contained in:
parent
3df6dd8c9f
commit
cc16822604
31
__init__.py
31
__init__.py
|
@ -100,16 +100,14 @@ class AutoOption:
|
||||||
style the option style to use; see below for options
|
style the option style to use; see below for options
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Dependencies and dependencies that are not found respectively.
|
# The dependencies to check for. The elements are on the form
|
||||||
# elements of both are on the form (func, k, kw) where type
|
# (func, k, kw) where func is the function or function name that
|
||||||
# is a string equal to 'library', 'header', 'package' or
|
# is used for the check and k and kw are the arguments and
|
||||||
# 'program', func is the function or function name that is used
|
# options to give the function.
|
||||||
# for the check and k and kw are the arguments and options to
|
|
||||||
# give the check function.
|
|
||||||
self.deps = []
|
self.deps = []
|
||||||
|
|
||||||
# Whether or not the option should be enabled or not. None
|
# Whether or not the option should be enabled. None indicates
|
||||||
# indicates that the checks are not done yet.
|
# that the checks have not been performed yet.
|
||||||
self.enable = None
|
self.enable = None
|
||||||
|
|
||||||
self.help = help
|
self.help = help
|
||||||
|
@ -145,7 +143,7 @@ class AutoOption:
|
||||||
# --foo[=yes] | --foo=no or --no-foo
|
# --foo[=yes] | --foo=no or --no-foo
|
||||||
# enable:
|
# enable:
|
||||||
# --enable-foo | --disble-foo
|
# --enable-foo | --disble-foo
|
||||||
# wit:
|
# with:
|
||||||
# --with-foo | --without-foo
|
# --with-foo | --without-foo
|
||||||
if style in ['plain', 'yesno', 'yesno_and_hack']:
|
if style in ['plain', 'yesno', 'yesno_and_hack']:
|
||||||
self.no_option = '--no-' + name
|
self.no_option = '--no-' + name
|
||||||
|
@ -208,11 +206,10 @@ class AutoOption:
|
||||||
|
|
||||||
def _check(self, conf, required):
|
def _check(self, conf, required):
|
||||||
"""
|
"""
|
||||||
This private method runs checks all dependencies.
|
This private method checks all dependencies. It checks all
|
||||||
It checks all dependencies (even if some dependency was not
|
dependencies (even if some dependency was not found) so that the
|
||||||
found) so that the user can install all missing dependencies in
|
user can install all missing dependencies in one go, instead of
|
||||||
one go, instead of playing the infamous
|
playing the infamous hit-configure-hit-configure game.
|
||||||
hit-configure-hit-configure game.
|
|
||||||
|
|
||||||
This function returns True if all dependencies were found and
|
This function returns True if all dependencies were found and
|
||||||
False otherwise.
|
False otherwise.
|
||||||
|
@ -228,6 +225,7 @@ class AutoOption:
|
||||||
k = tuple(k)
|
k = tuple(k)
|
||||||
else:
|
else:
|
||||||
func = getattr(conf, f)
|
func = getattr(conf, f)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
func(*k, **kw)
|
func(*k, **kw)
|
||||||
except conf.errors.ConfigurationError:
|
except conf.errors.ConfigurationError:
|
||||||
|
@ -312,7 +310,7 @@ def opt(f):
|
||||||
@opt
|
@opt
|
||||||
def add_auto_option(self, *k, **kw):
|
def add_auto_option(self, *k, **kw):
|
||||||
"""
|
"""
|
||||||
This function adds an AutoOptions to the options context. It takes
|
This function adds an AutoOption to the options context. It takes
|
||||||
the same arguments as the initializer funtion of the AutoOptions
|
the same arguments as the initializer funtion of the AutoOptions
|
||||||
class.
|
class.
|
||||||
"""
|
"""
|
||||||
|
@ -364,8 +362,7 @@ def apply_auto_options_hack(self):
|
||||||
configure phase.
|
configure phase.
|
||||||
"""
|
"""
|
||||||
for option in auto_options:
|
for option in auto_options:
|
||||||
# With the hack the yesno options simply extend plain
|
# With the hack the yesno options simply extend plain options.
|
||||||
# options.
|
|
||||||
if option.style == 'yesno_and_hack':
|
if option.style == 'yesno_and_hack':
|
||||||
for i in range(1, len(sys.argv)):
|
for i in range(1, len(sys.argv)):
|
||||||
if sys.argv[i] == option.yes_option:
|
if sys.argv[i] == option.yes_option:
|
||||||
|
|
Loading…
Reference in New Issue