From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v2] tools/pygrub: Make pygrub understand default entry in string format Date: Fri, 27 Jun 2014 08:34:46 -0400 Message-ID: <53AD64E6.5010404@oracle.com> References: <1403811243-4867-1-git-send-email-boris.ostrovsky@oracle.com> <1403870281.25894.52.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1403870281.25894.52.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xen.org, ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On 06/27/2014 07:58 AM, Ian Campbell wrote: > On Thu, 2014-06-26 at 15:34 -0400, Boris Ostrovsky wrote: >> if self.commands[com] is not None: >> - if arg.strip() == "${saved_entry}": >> + arg_strip = arg.strip() >> + if arg_strip() == "${saved_entry}" or arg_strip == "${next_entry}": > Is arg_strip (being the result of arg.strip()) really a callable object > here? No, that's a typo. >> diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub >> index a4a2423..f46e54f 100644 >> --- a/tools/pygrub/src/pygrub >> +++ b/tools/pygrub/src/pygrub >> + # We don't fully support submenus. Look for the leaf value in >> + # "submenu0>submenu1>...>menuentry" and hope that it's unique. >> + title = self.cf.default >> + while (1): > I'm not much of a Python-head, but "while True:" surely? They are both valid constructs (although possibly without parentheses). In fact, pygrub uses both: ostr@workbase> egrep "while 1|while True" tools/pygrub/src/pygrub while 1: while 1: while True: ostr@workbase> Moreover, apparently, using '1' is very slightly faster. Not that I knew about it when I wrote this code ;-). -boris