[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] tools/pygrub: Make pygrub understand default entry in string format



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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.