From 1cc086ad5b2402580d84566471dfbebea5a00c12 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Wed, 17 Jul 2019 11:14:31 -0700 Subject: [PATCH] script/ptl-tool: update for python3 Signed-off-by: Patrick Donnelly --- src/script/ptl-tool.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/script/ptl-tool.py b/src/script/ptl-tool.py index 6d37467477b..569d2746c8b 100755 --- a/src/script/ptl-tool.py +++ b/src/script/ptl-tool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/python3 # README: # @@ -215,8 +215,8 @@ def build_branch(args): log.info("Detaching HEAD onto base: {}".format(base)) try: base_path = args.base_path + base - base = filter(lambda r: r.path == base_path, G.refs)[0] - except IndexError: + base = next(ref for ref in G.refs if ref.path == base_path) + except StopIteration: log.error("Branch " + base + " does not exist!") sys.exit(1) -- 2.47.3