/pidgin/main: bd00e2d2b32e: Merge with release-2.x.y.

Elliott Sales de Andrade qulogic at pidgin.im
Sat May 11 18:06:08 EDT 2013


Changeset: bd00e2d2b32e64d3e556a77efa921bd0c1fc14c5
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2013-05-11 18:02 -0400
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/bd00e2d2b32e

Description:

Merge with release-2.x.y.

diffstat:

 COPYRIGHT                                    |   1 +
 ChangeLog                                    |   3 +
 configure.ac                                 |  10 +-
 libpurple/dbus-analyze-functions.py          |  83 ++++++++++++++-------------
 libpurple/dbus-analyze-signals.py            |  14 ++--
 libpurple/dbus-analyze-types.py              |  28 +++-----
 libpurple/plugins/dbus-buddyicons-example.py |   3 +-
 libpurple/plugins/startup.py                 |  13 ++--
 libpurple/protocols/mxit/protocol.c          |  28 ++++++++-
 9 files changed, 103 insertions(+), 80 deletions(-)

diffs (truncated from 443 to 300 lines):

diff --git a/COPYRIGHT b/COPYRIGHT
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -216,6 +216,7 @@ Christian Grothoff
 Vladislav Guberinić
 Gideon N. Guillen
 Aman Gupta
+Ashish Gupta
 Christian Hammond
 Erick Hamness
 Fred Hampton
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -57,6 +57,9 @@ version 3.0.0 (??/??/????):
 	* The Offline Message Emulation plugin now adds a note that the message
 	  was an offline message. (Flavius Anton) (#2497)
 
+	General:
+	* Add support for Python3 in build scripts. (Ashish Gupta) (#15624)
+
 	Windows-Specific Changes:
 	* Updates to dependencies:
 		* NSS 3.14.3 and NSPR 4.9.5
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1636,13 +1636,13 @@ dnl Check for Python headers (currently 
 dnl (Thanks to XChat)
 if test "x$enable_consoleui" = "xyes" -a ! -z "$PYTHON" -a x"$PYTHON" != x"no" ; then
 	AC_MSG_CHECKING(for Python compile flags)
-	PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
-	PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
+	PY_PREFIX=`$PYTHON -c 'import sys ; sys.stdout.write(sys.prefix)'`
+	PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; sys.stdout.write(sys.exec_prefix)'`
 	changequote(<<, >>)dnl
-	PY_VERSION=`$PYTHON -c 'import sys ; print sys.version[0:3]'`
-	PY_MAJOR=`$PYTHON -c 'import sys ; print sys.version[0:2]'`
+	PY_VERSION=`$PYTHON -c 'import sys ; sys.stdout.write(sys.version[0:3])'`
+	PY_MAJOR=`$PYTHON -c 'import sys ; sys.stdout.write(sys.version[0:2])'`
 	changequote([, ])dnl
-	if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h -a "$PY_MAJOR" = "2."; then
+	if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h; then
 		AC_MSG_RESULT()
 		AC_CHECK_LIB(pthread, pthread_create, )
 		AC_CHECK_LIB(util, openpty, )
diff --git a/libpurple/dbus-analyze-functions.py b/libpurple/dbus-analyze-functions.py
--- a/libpurple/dbus-analyze-functions.py
+++ b/libpurple/dbus-analyze-functions.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
 import re
 import string
 import sys
@@ -240,38 +241,38 @@ class ClientBinding (Binding):
         paramslist = ", ".join(self.paramshdr)
         if (paramslist == "") :
             paramslist = "void"
-        print "%s %s(%s)" % (self.functiontype, self.function.name,
-                             paramslist),
+        print("%s %s(%s)" % (self.functiontype, self.function.name,
+                             paramslist), end=' ')
 
         if self.headersonly:
-            print ";"
+            print(";")
             return
 
-        print "{"
+        print("{")
 
         for decl in self.decls:
-            print decl
+            print(decl)
 
-        print 'dbus_g_proxy_call(purple_proxy, "%s", NULL,' % ctopascal(self.function.name)
+        print('dbus_g_proxy_call(purple_proxy, "%s", NULL,' % ctopascal(self.function.name))
         
         for type_name in self.inputparams:
-            print "\t%s, %s, " % type_name,
-        print "G_TYPE_INVALID,"
+            print("\t%s, %s, " % type_name, end=' ')
+        print("G_TYPE_INVALID,")
 
         for type_name in self.outputparams:
-            print "\t%s, &%s, " % type_name,
-        print "G_TYPE_INVALID);"
+            print("\t%s, &%s, " % type_name, end=' ')
+        print("G_TYPE_INVALID);")
         
         for code in self.returncode:
-            print code
+            print(code)
 
-        print "}\n"
+        print("}\n")
         
 
     def definepurplestructure(self, type):
         if (self.headersonly) and (type[0] not in self.knowntypes):
-            print "struct _%s;" % type[0]
-            print "typedef struct _%s %s;" % (type[0], type[0])
+            print("struct _%s;" % type[0])
+            print("typedef struct _%s %s;" % (type[0], type[0]))
             self.knowntypes.append(type[0])
 
     def inputsimple(self, type, name, us):
@@ -357,39 +358,39 @@ class ServerBinding (Binding):
         self.argfunc = "dbus_message_get_args"
 
     def flush(self):
-        print "static DBusMessage*"
-        print "%s_DBUS(DBusMessage *message_DBUS, DBusError *error_DBUS) {" % \
-              self.function.name
+        print("static DBusMessage*")
+        print("%s_DBUS(DBusMessage *message_DBUS, DBusError *error_DBUS) {" % \
+              self.function.name)
         
-        print "\tDBusMessage *reply_DBUS;"
+        print("\tDBusMessage *reply_DBUS;")
 
         for decl in self.cdecls:
-            print decl
+            print(decl)
 
-        print "\t%s(message_DBUS, error_DBUS," % self.argfunc,
+        print("\t%s(message_DBUS, error_DBUS," % self.argfunc,end=' ')
         for param in self.cparams:
-            print "DBUS_TYPE_%s, &%s," % param,
-        print "DBUS_TYPE_INVALID);"
+            print("DBUS_TYPE_%s, &%s," % param, end=' ')
+        print("DBUS_TYPE_INVALID);")
 
-        print "\tCHECK_ERROR(error_DBUS);"
+        print("\tCHECK_ERROR(error_DBUS);")
 
         for code in self.ccode:
-            print code
+            print(code)
 
-        print "\treply_DBUS = dbus_message_new_method_return (message_DBUS);"
+        print("\treply_DBUS = dbus_message_new_method_return (message_DBUS);")
 
-        print "\tdbus_message_append_args(reply_DBUS,",
+        print("\tdbus_message_append_args(reply_DBUS,", end=' ')
         for param in self.cparamsout:
             if type(param) is str:
-                print "%s," % param,
+                print("%s," % param, end=' ')
             else:
-                print "DBUS_TYPE_%s, &%s," % param,
-        print "DBUS_TYPE_INVALID);"
+                print("DBUS_TYPE_%s, &%s," % param, end=' ')
+        print("DBUS_TYPE_INVALID);")
 
         for code in self.ccodeout:
-            print code
+            print(code)
 
-        print "\treturn reply_DBUS;\n}\n"
+        print("\treturn reply_DBUS;\n}\n")
 
 
     def addstring(self, *items):
@@ -440,7 +441,7 @@ class ServerBinding (Binding):
         self.cdecls.append("\t%s *%s;" % (type[0], name))
         self.cparams.append(("INT32", name + "_ID"))
         self.ccode.append("\tPURPLE_DBUS_ID_TO_POINTER(%s, %s_ID, %s, error_DBUS);"  % \
-                       (name, name, type[0]))
+                          (name, name, type[0]))
         self.addintype("i", name)
 
     def inputpointer(self, type, name):
@@ -543,7 +544,7 @@ class BindingSet:
 
                 
     def process(self):
-        print "/* Generated by %s.  Do not edit! */" % sys.argv[0]
+        print("/* Generated by %s.  Do not edit! */" % sys.argv[0])
 
         for line in self.inputiter:
             words = line.split()
@@ -558,7 +559,7 @@ class BindingSet:
             # empty line has been encountered
             myline = line.strip()
             while (myline.count("(") > myline.count(")")) or self.typeregexp.match(myline):
-                newline = self.inputiter.next().strip()
+                newline = next(self.inputiter).strip()
                 if len(newline) == 0:
                     break
                 myline += " " + newline
@@ -601,15 +602,15 @@ class ServerBindingSet (BindingSet):
         self.functions.append((binding.function.name, binding.dparams))
         
     def flush(self):
-        print "static PurpleDBusBinding bindings_DBUS[] = { "
+        print("static PurpleDBusBinding bindings_DBUS[] = { ")
         for function, params in self.functions:
-            print '{"%s", "%s", %s_DBUS},' % \
-                  (ctopascal(function), params, function)
+            print('{"%s", "%s", %s_DBUS},' % \
+                  (ctopascal(function), params, function))
 
-        print "{NULL, NULL, NULL}"
-        print "};"
+        print("{NULL, NULL, NULL}")
+        print("};")
 
-        print "#define PURPLE_DBUS_REGISTER_BINDINGS(handle) purple_dbus_register_bindings(handle, bindings_DBUS)"
+        print("#define PURPLE_DBUS_REGISTER_BINDINGS(handle) purple_dbus_register_bindings(handle, bindings_DBUS)")
         
 class ClientBindingSet (BindingSet):
     def __init__(self, inputfile, fprefix, headersonly):
@@ -647,7 +648,7 @@ else:
 
 if "client" in options:
     bindings = ClientBindingSet(sys.stdin, fprefix,
-                                options.has_key("headers"))
+                                "headers" in options)
 else:
     bindings = ServerBindingSet(sys.stdin, fprefix)
 bindings.process()
diff --git a/libpurple/dbus-analyze-signals.py b/libpurple/dbus-analyze-signals.py
--- a/libpurple/dbus-analyze-signals.py
+++ b/libpurple/dbus-analyze-signals.py
@@ -5,7 +5,7 @@
 #   <signal name="Changed">
 #       <arg name="new_value" type="b"/>
 #   </signal>
-
+from __future__ import print_function
 import re
 import sys
 
@@ -23,8 +23,8 @@ excluded = [\
 registerregex = re.compile("purple_signal_register[^;]+\"([\w\-]+)\"[^;]+(purple_marshal_\w+)[^;]+;")
 nameregex = re.compile('[-_][a-z]')
 
-print "/* Generated by %s.  Do not edit! */" % sys.argv[0]
-print "const char *dbus_signals = "
+print("/* Generated by %s.  Do not edit! */" % sys.argv[0])
+print("const char *dbus_signals = ")
 for match in registerregex.finditer(sys.stdin.read()):
     signal = match.group(1)
     marshal = match.group(2)
@@ -32,7 +32,7 @@ for match in registerregex.finditer(sys.
         continue
 
     signal = nameregex.sub(lambda x:x.group()[1].upper(), '-'+signal)
-    print "\"    <signal name='%s'>\\n\""%signal
+    print("\"    <signal name='%s'>\\n\"" % signal)
 
     args = marshal.split('_')
     # ['purple', 'marshal', <return type>, '', args...]
@@ -52,9 +52,9 @@ for match in registerregex.finditer(sys.
                 type = 't'
             elif arg == "BOOLEAN":
                 type = 'b'
-            print "\"      <arg type='%s'/>\\n\""%type
+            print("\"      <arg type='%s'/>\\n\"" % type)
 
-    print "\"    </signal>\\n\""
+    print("\"    </signal>\\n\"")
 
-print ";"
+print(";")
 
diff --git a/libpurple/dbus-analyze-types.py b/libpurple/dbus-analyze-types.py
--- a/libpurple/dbus-analyze-types.py
+++ b/libpurple/dbus-analyze-types.py
@@ -7,14 +7,14 @@
 #
 # --enum    DBUS_POINTER_NAME1,
 #           DBUS_POINTER_NAME2,
-#           DBUS_POINTER_NAME3, 
-# 
+#           DBUS_POINTER_NAME3,
+#
 # --list    NAME1
 #           NAME2
 #           NAME3
-# 
+#
 
-
+from __future__ import print_function
 import re
 import sys
 
@@ -37,39 +37,33 @@ for arg in sys.argv[1:]:
 
 keyword = options.get("keyword", "struct")
 pattern = options.get("pattern", "%s")
-verbatim = options.has_key("verbatim")
+verbatim = "verbatim" in options
 
 structregexp1 = re.compile(r"^(typedef\s+)?%s\s+\w+\s+(\w+)\s*;" % keyword)
 structregexp2 = re.compile(r"^(typedef\s+)?%s" % keyword)
 structregexp3 = re.compile(r"^}\s+(\w+)\s*;")
 



More information about the Commits mailing list