* [PATCH] Replace print statement with sys.stdout.write for python3 compatibility
@ 2013-12-04 1:14 Mike Gilbert
2013-12-04 10:12 ` Colin Watson
0 siblings, 1 reply; 5+ messages in thread
From: Mike Gilbert @ 2013-12-04 1:14 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 52 bytes --]
Gmail likes to mangle patches, so I'm attaching it.
[-- Attachment #2: gentpl-python3.patch --]
[-- Type: text/x-patch, Size: 1158 bytes --]
From 1ac0d1f8feda7cbbe3e706074aebcc805e4f3667 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Tue, 3 Dec 2013 20:06:07 -0500
Subject: [PATCH] Replace print statement with sys.stdout.write for python3
compatibility
---
ChangeLog | 5 +++++
gentpl.py | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 33206cd..5e1a088 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-04 Mike Gilbert <floppym@gentoo.org>
+
+ * gentpl.py: Replace print statement with sys.stdout.write for
+ python3 compatibility.
+
2013-12-03 Colin Watson <cjwatson@ubuntu.com>
* grub-core/Makefile.core.def (setjmp): Distribute
diff --git a/gentpl.py b/gentpl.py
index 1d4583c..9960c2d 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -19,6 +19,7 @@ __metaclass__ = type
from optparse import OptionParser
import re
+import sys
#
# This is the python script used to generate Makefile.*.am
@@ -434,7 +435,7 @@ def output(s, section=''):
def write_output(section=''):
for s in outputs.get(section, []):
- print s,
+ sys.stdout.write(s)
#
# Global variables
--
1.8.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Replace print statement with sys.stdout.write for python3 compatibility
2013-12-04 1:14 [PATCH] Replace print statement with sys.stdout.write for python3 compatibility Mike Gilbert
@ 2013-12-04 10:12 ` Colin Watson
2013-12-04 15:28 ` Mike Gilbert
0 siblings, 1 reply; 5+ messages in thread
From: Colin Watson @ 2013-12-04 10:12 UTC (permalink / raw)
To: grub-devel
On Tue, Dec 03, 2013 at 08:14:09PM -0500, Mike Gilbert wrote:
> Gmail likes to mangle patches, so I'm attaching it.
Could we please use the clearer bilingual form of "from __future__
import print_function" at the top followed by print(s, end="")? This
does require bumping our minimum required Python version to 2.6; but
that was released five years ago, so I would have thought that would be
an acceptable requirement by now.
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Replace print statement with sys.stdout.write for python3 compatibility
2013-12-04 10:12 ` Colin Watson
@ 2013-12-04 15:28 ` Mike Gilbert
2013-12-05 15:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 5+ messages in thread
From: Mike Gilbert @ 2013-12-04 15:28 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 573 bytes --]
On Wed, Dec 4, 2013 at 5:12 AM, Colin Watson <cjwatson@ubuntu.com> wrote:
> On Tue, Dec 03, 2013 at 08:14:09PM -0500, Mike Gilbert wrote:
>> Gmail likes to mangle patches, so I'm attaching it.
>
> Could we please use the clearer bilingual form of "from __future__
> import print_function" at the top followed by print(s, end="")? This
> does require bumping our minimum required Python version to 2.6; but
> that was released five years ago, so I would have thought that would be
> an acceptable requirement by now.
>
That's fine by me. I have attached a patch for that.
[-- Attachment #2: gentpl-python3-print.patch --]
[-- Type: application/octet-stream, Size: 1604 bytes --]
From f3fdde6a82873f908a0c3141cbd7da853027fe2f Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Wed, 4 Dec 2013 10:24:21 -0500
Subject: [PATCH] gentpl.py: Use python3-style print function
---
ChangeLog | 5 +++++
INSTALL | 2 +-
gentpl.py | 4 +++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 33206cd..f773d6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-04 Mike Gilbert <floppym@gentoo.org>
+
+ * INSTALL: Raise minimum python version to 2.6.
+ * gentpl.py: Use python3-style print function.
+
2013-12-03 Colin Watson <cjwatson@ubuntu.com>
* grub-core/Makefile.core.def (setjmp): Distribute
diff --git a/INSTALL b/INSTALL
index ad27f3d..bd41eee 100644
--- a/INSTALL
+++ b/INSTALL
@@ -54,7 +54,7 @@ To build GRUB's graphical terminal (gfxterm), you need:
If you use a development snapshot or want to hack on GRUB you may
need the following.
-* Python 2.5.2 or later
+* Python 2.6 or later
* Autoconf 2.60 or later
* Automake 1.10.1 or later
diff --git a/gentpl.py b/gentpl.py
index 1d4583c..02bf335 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import print_function
+
__metaclass__ = type
from optparse import OptionParser
@@ -434,7 +436,7 @@ def output(s, section=''):
def write_output(section=''):
for s in outputs.get(section, []):
- print s,
+ print(s, end='')
#
# Global variables
--
1.8.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Replace print statement with sys.stdout.write for python3 compatibility
2013-12-04 15:28 ` Mike Gilbert
@ 2013-12-05 15:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-05 16:07 ` Colin Watson
0 siblings, 1 reply; 5+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-12-05 15:31 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 861 bytes --]
On 04.12.2013 16:28, Mike Gilbert wrote:
> On Wed, Dec 4, 2013 at 5:12 AM, Colin Watson <cjwatson@ubuntu.com> wrote:
>> On Tue, Dec 03, 2013 at 08:14:09PM -0500, Mike Gilbert wrote:
>>> Gmail likes to mangle patches, so I'm attaching it.
>>
>> Could we please use the clearer bilingual form of "from __future__
>> import print_function" at the top followed by print(s, end="")? This
>> does require bumping our minimum required Python version to 2.6; but
>> that was released five years ago, so I would have thought that would be
>> an acceptable requirement by now.
>>
>
> That's fine by me. I have attached a patch for that.
>
If Colin is ok with this patch then so am I.
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Replace print statement with sys.stdout.write for python3 compatibility
2013-12-05 15:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-12-05 16:07 ` Colin Watson
0 siblings, 0 replies; 5+ messages in thread
From: Colin Watson @ 2013-12-05 16:07 UTC (permalink / raw)
To: grub-devel
On Thu, Dec 05, 2013 at 04:31:55PM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 04.12.2013 16:28, Mike Gilbert wrote:
> > On Wed, Dec 4, 2013 at 5:12 AM, Colin Watson <cjwatson@ubuntu.com> wrote:
> >> On Tue, Dec 03, 2013 at 08:14:09PM -0500, Mike Gilbert wrote:
> >>> Gmail likes to mangle patches, so I'm attaching it.
> >>
> >> Could we please use the clearer bilingual form of "from __future__
> >> import print_function" at the top followed by print(s, end="")? This
> >> does require bumping our minimum required Python version to 2.6; but
> >> that was released five years ago, so I would have thought that would be
> >> an acceptable requirement by now.
> >
> > That's fine by me. I have attached a patch for that.
>
> If Colin is ok with this patch then so am I.
Yeah, I am - thanks, Mike. Rebased and pushed.
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-05 16:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-04 1:14 [PATCH] Replace print statement with sys.stdout.write for python3 compatibility Mike Gilbert
2013-12-04 10:12 ` Colin Watson
2013-12-04 15:28 ` Mike Gilbert
2013-12-05 15:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-05 16:07 ` Colin Watson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).