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

Martin Kolman mkolman at redhat.com
Wed May 7 15:09:20 UTC 2014


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



More information about the anaconda-patches mailing list