[Piglit] [PATCH 2/5] framework: fix grouptools.commonprefix when len(args) == 1

Dylan Baker dylan at pnwbakers.com
Wed May 2 20:43:23 UTC 2018


Reviewed-by: Dylan Baker <dylan at pnwbakers.com>

Quoting Marek Olšák (2018-05-02 13:32:44)
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
> 
> ---
>  framework/grouptools.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/framework/grouptools.py b/framework/grouptools.py
> index f28241d3c..ce2e97c79 100644
> --- a/framework/grouptools.py
> +++ b/framework/grouptools.py
> @@ -82,21 +82,21 @@ def splitname(group):
>      i = group.rfind(SEPARATOR) + 1
>      head, tail = group[:i], group[i:]
>      head = head.rstrip(SEPARATOR)
>  
>      return head, tail
>  
>  
>  def commonprefix(args):
>      """Given a list of groups, returns the longest common leading component."""
>      if len(args) == 1:
> -        return args
> +        return args[0]
>      elif any(e == '' for e in args):
>          return ''
>  
>      common = []
>  
>      for elems in zip(*[split(a) for a in args]):
>          iter_ = iter(elems)
>          first = next(iter_)
>          if all(first == r for r in iter_):
>              common.append(first)
> -- 
> 2.17.0
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20180502/f0765f4c/attachment.sig>


More information about the Piglit mailing list