[PATCH rhel7-branch] Fix various pylint problems caused by the new rescue mode.

Vratislav Podzimek vpodzime at redhat.com
Wed Jul 22 19:23:38 UTC 2015


On Wed, 2015-07-22 at 14:18 -0400, Chris Lumens wrote:
> Related: rhbz#965985
> ---
>  pyanaconda/constants_text.py |  1 -
>  pyanaconda/rescue.py         | 12 ++++++------
>  tests/gettext/style_guide.py |  3 ++-
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/pyanaconda/constants_text.py b/pyanaconda/constants_text.py
> index 07882a3..bb0f113 100644
> --- a/pyanaconda/constants_text.py
> +++ b/pyanaconda/constants_text.py
> @@ -19,7 +19,6 @@
>  
>  # pylint: disable=wildcard-import
>  from pyanaconda.constants import *
> -from pyanaconda.i18n import _, N_
>  
>  # Make the return calls from the UIScreen input() function more clear
>  INPUT_PROCESSED = None
> diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
> index d5d596b..e040406 100644
> --- a/pyanaconda/rescue.py
> +++ b/pyanaconda/rescue.py
> @@ -151,7 +151,7 @@ class RescueMode(NormalTUISpoke):
>                           "to find your Linux installation and mount it under 
> "
>                           "the directory : %s.  You can then make any changes 
> "
>                           "required to your system.  Choose '1' to proceed 
> with "
> -                         "this step.\nYou can choose to mount your file"
> +                         "this step.\nYou can choose to mount your file "
>                           "systems read-only instead of read-write by choosing 
> "
>                           "'2'.\nIf for some reason this process does not work 
> "
>                           "choose '3' to skip directly to a shell.\n\n") % 
> (iutil.getSysroot())), ""]
> @@ -350,10 +350,10 @@ class RescueMountSpoke(NormalTUISpoke):
>                      if flags.automatedInstall:
>                          log.info("System has been mounted under: %s", 
> iutil.getSysroot())
>                      else:
> -                        text = TextWidget(_("Your system has been mounted 
> under %s.\n\nIf "
> +                        text = TextWidget(_("Your system has been mounted 
> under %(mountpoint)s.\n\nIf "
>                                              "you would like to make your 
> system the root "
> -                                            "environment, run the 
> command:\n\n\tchroot %s\n"
> -                                            % (iutil.getSysroot(), 
> iutil.getSysroot())))
> +                                            "environment, run the 
> command:\n\n\tchroot %(mountpoint)s\n")
> +                                            % {"mountpoint": 
> iutil.getSysroot()} )
>                          self._window.append(text)
>                      rootmounted = True
>  
> @@ -377,7 +377,7 @@ class RescueMountSpoke(NormalTUISpoke):
>                      # set a libpath to use mounted fs
>                      libdirs = os.environ.get("LD_LIBRARY_PATH", 
> "").split(":")
>                      mounted = map(lambda dir: "/mnt/sysimage%s" % dir, 
> libdirs)
> -                    os.environ["LD_LIBRARY_PATH"] = ":".join(libdirs + 
> mounted)
> +                    iutil.setenv("LD_LIBRARY_PATH", ":".join(libdirs + 
> mounted))
>  
>                      # do we have bash?
>                      try:
> @@ -387,7 +387,7 @@ class RescueMountSpoke(NormalTUISpoke):
>                          pass
>              except (ValueError, LookupError, SyntaxError, NameError):
>                  pass
> -            except Exception as e:
> +            except Exception as e: # pylint: disable=broad-except
>                  if flags.automatedInstall:
>                      msg = _("Run %s to unmount the system when you are 
> finished.\n") % ANACONDA_CLEANUP
>  
> diff --git a/tests/gettext/style_guide.py b/tests/gettext/style_guide.py
> index 9f7d273..f486ec2 100755
> --- a/tests/gettext/style_guide.py
> +++ b/tests/gettext/style_guide.py
> @@ -38,7 +38,8 @@ bad_strings = {'(?i)bootloader': 'boot loader',
>  # write a more specific regex. List occurrences here.
>  # {'filename': {'matched string', occurrences}}
>  expected_badness = {'pyanaconda/bootloader.py': {'mountpoint': 1},  # format 
> string specifier
> -                    'pyanaconda/network.py':    {'vlan': 1}}        # format 
> string specifier
> +                    'pyanaconda/network.py':    {'vlan': 1},        # format 
> string specifier
> +                    'pyanaconda/rescue.py':     {'mountpoint': 1}}  # format 
> string specifier
>  
>  # Use polib to parse anaconda.pot
>  try:
I'm quite sure I have already seen some patch fixing at least some of these
things (for master maybe?), but the changes all look good to me.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list