public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: David Malcolm <dmalcolm@redhat.com>
Cc: archer@sourceware.org
Subject: GDB port to python3?
Date: Mon, 17 Jan 2011 20:28:00 -0000	[thread overview]
Message-ID: <20110117202758.GA25762@host1.dyn.jankratochvil.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

Hi David,

do you recommend porting GDB to python3 (python-3.2, for Fedora 15)?

During my quick test [attached] the GDB python sources probably have to become
backward incompatible with python-2.x, do they have to?
	python2.7 ./python/python-config.py --libs
	  File "./python/python-config.py", line 15
	    file=sys.stderr)
	        ^
	SyntaxError: invalid syntax


Thanks for info,
Jan

[-- Attachment #2: python3.diff --]
[-- Type: text/plain, Size: 1500 bytes --]

--- a/gdb/python/python-config.py
+++ b/gdb/python/python-config.py
@@ -10,8 +10,9 @@ valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
               'ldflags', 'help']
 
 def exit_with_usage(code=1):
-    print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0],
-                                            '|'.join('--'+opt for opt in valid_opts))
+    print("Usage: %s [%s]" % (sys.argv[0],
+                              '|'.join('--'+opt for opt in valid_opts)),
+	  file=sys.stderr)
     sys.exit(code)
 
 try:
@@ -32,17 +33,17 @@ if '--help' in opt_flags:
 
 for opt in opt_flags:
     if opt == '--prefix':
-        print sysconfig.PREFIX
+        print(sysconfig.PREFIX)
 
     elif opt == '--exec-prefix':
-        print sysconfig.EXEC_PREFIX
+        print(sysconfig.EXEC_PREFIX)
 
     elif opt in ('--includes', '--cflags'):
         flags = ['-I' + sysconfig.get_python_inc(),
                  '-I' + sysconfig.get_python_inc(plat_specific=True)]
         if opt == '--cflags':
             flags.extend(getvar('CFLAGS').split())
-        print ' '.join(flags)
+        print(' '.join(flags))
 
     elif opt in ('--libs', '--ldflags'):
         libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
@@ -53,5 +54,5 @@ for opt in opt_flags:
             if not getvar('Py_ENABLE_SHARED'):
                 libs.insert(0, '-L' + getvar('LIBPL'))
             libs.extend(getvar('LINKFORSHARED').split())
-        print ' '.join(libs)
+        print(' '.join(libs))
 

                 reply	other threads:[~2011-01-17 20:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110117202758.GA25762@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=archer@sourceware.org \
    --cc=dmalcolm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).