[PATCH 1/2] Always store the information about display mode in ksdata
Anne Mulhern
amulhern at redhat.com
Wed Oct 8 18:55:24 UTC 2014
----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Wednesday, October 8, 2014 4:55:39 AM
> Subject: [PATCH 1/2] Always store the information about display mode in ksdata
>
> Once we know in which mode we are going to run we should store that
> information
> in ksdata.displaymode so that other parts of the code can make use of it.
>
> Related: rhbz#1073679
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
> anaconda | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/anaconda b/anaconda
> index 4b6c29a..56c4b95 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -1054,16 +1054,16 @@ if __name__ == "__main__":
> # now start the interface
> setupDisplay(anaconda, opts, addon_paths)
>
> + # we now know in which mode we are going to run so store the information
> + from pykickstart.constants import DISPLAY_MODE_GRAPHICAL,
> DISPLAY_MODE_CMDLINE, DISPLAY_MODE_TEXT
> + mode_char_to_const = {'g': DISPLAY_MODE_GRAPHICAL, 't':
> DISPLAY_MODE_TEXT, 'c': DISPLAY_MODE_CMDLINE}
> + ksdata.displaymode.displayMode =
> mode_char_to_const[anaconda.displayMode]
> +
> # if we're in text mode, the resulting system should be too
> # ...unless the kickstart specified otherwise
> if anaconda.displayMode != 'g':
> - if not anaconda.ksdata.xconfig.startX:
> - anaconda.ksdata.skipx.skipx = True
> - from pykickstart.constants import DISPLAY_MODE_CMDLINE,
> DISPLAY_MODE_TEXT
> - if anaconda.displayMode == 'c':
> - anaconda.ksdata.displaymode.displayMode = DISPLAY_MODE_CMDLINE
> - else:
> - anaconda.ksdata.displaymode.displayMode = DISPLAY_MODE_TEXT
> + if not ksdata.xconfig.startX:
> + ksdata.skipx.skipx = True
>
Since the rest of the body of the if statement is empty after change, might as well compress to:
if anaconda.displayMode != 'g' and not ksdata.xconfig.startX:
ksdata.skipx.skipx = True
OR, equivalently:
if ksdata.displaymode.displayMode != DISPLAY_MODE_GRAPHICAL and not ksdata.xconfig.startX:
ksdata.skipx.skipx = True
I'ld remove the comment just above the if, too. It's gotten a little weighty for just two lines of code.
> if flags.rescue_mode:
> from pyanaconda import rescue
> --
> 1.9.3
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
>
Otherwise, looks fine to me.
- mulhern
More information about the anaconda-patches
mailing list