[Yum-devel] [PATCH] Fix blank line at end of all scriptlet output

Seth Vidal skvidal at fedoraproject.org
Fri May 21 15:47:17 UTC 2010



On Fri, 21 May 2010, James Antill wrote:

> ---
> yum/history.py |    7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/yum/history.py b/yum/history.py
> index d5a167e..eaf264c 100644
> --- a/yum/history.py
> +++ b/yum/history.py
> @@ -507,7 +507,12 @@ class YumHistory:
>         cur = self._get_cursor()
>         if cur is None:
>             return # Should never happen, due to above
> -        for error in msg.split('\n'):
> +        if '\n' != msg[-1]: # "a\nb".split('\n') == ['a', 'b']
> +            msgs = msg.split('\n')
> +        else: # "a\nb\n".split('\n') == ['a', 'b', '']
> +            msgs = msg.split('\n')[:-1]
> +
> +        for error in msgs:
>             error = to_unicode(error)
>             executeSQL(cur,
>                        """INSERT INTO trans_script_stdout
> -- 
> 1.7.0.1
>

do you just want to do:
if msg.endswith('\n'):
     msg = msg[:-1]

?

-sv




More information about the Yum-devel mailing list