[PATCH 2/2] Don't check anaconda version if just returning the CLI help text

Anne Mulhern amulhern at redhat.com
Wed May 7 16:01:46 UTC 2014





----- Original Message -----
> From: "Martin Kolman" <mkolman at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Wednesday, May 7, 2014 11:09:20 AM
> Subject: [PATCH 2/2] Don't check anaconda version if just returning the CLI	help text
> 
> As a result we don't have to import isys and users will be able to
> get the CLI help even for an Anaconda without compiled isys.
> 
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
>  anaconda | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/anaconda b/anaconda
> index 23f5c69..1ab031f 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -257,16 +257,24 @@ def getAnacondaVersion():
>      from pyanaconda import _isys
>      return _isys.getAnacondaVersion()
>  
> -def parseOptions(argv=None, cmdline=None):
> +def parseOptions(argv=None, cmdline=None, helpOnly=False):
>      from pyanaconda.anaconda_optparse import AnacondaOptionParser
>      from pyanaconda.anaconda_optparse import HelpTextParser
>  
> +    # we don't need to know the Anaconda version when returning
> +    # the help text, also like this the user can get the help
> +    # text even for an Anaconda without compiled isys
> +    if not helpOnly:
> +        anaconda_version = getAnacondaVersion()
> +    else:
> +        anaconda_version = ""
> +
>      # NOTE: for each long option (like '--repo'), AnacondaOptionParser
>      # checks the boot arguments for bootarg_prefix+option ('inst.repo').
>      # If require_prefix is False, it also accepts the option without the
>      # bootarg_prefix ('repo').
>      # See anaconda_optparse.py and BootArgs (in flags.py) for details.
> -    op = AnacondaOptionParser(version="%prog " + getAnacondaVersion(),
> +    op = AnacondaOptionParser(version="%prog " + anaconda_version,
>                                bootarg_prefix="inst.", require_prefix=False)
>      help_parser = HelpTextParser("/usr/share/anaconda/anaconda_options.txt")
>  
> @@ -748,7 +756,7 @@ if __name__ == "__main__":
>      # without importing random stuff and spamming stdout
>      import sys
>      if ("--help" in sys.argv) or ("-h" in sys.argv):
> -        parseOptions()
> +        parseOptions(helpOnly=True)
>  
>      print "Starting installer, one moment..."
>  
> --
> 1.9.0
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

Someday it may be necessary to know the anaconda version in order to supply the
correct help text.

- mulhern


More information about the anaconda-patches mailing list