Add support for building with Python 3
authorDavid Coles <dcoles@gaikai.com>
Sat, 9 Apr 2011 00:47:05 +0000 (17:47 -0700)
committerJulien Danjou <julien@danjou.info>
Wed, 4 May 2011 13:00:21 +0000 (15:00 +0200)
commit294c9f455c3534d836b010dacd2e7aa62a7dde9d
treeef1ba507c91d0dc14942cbc553f2a9013517e532
parente300ee4920bf4618f58618f3063b362f811154c1
Add support for building with Python 3

Python 3 introduces some language changes that cause issues when running
c_client.py. This also breaks compatibility with Python 2.5 since it does not
support the "as" statement in try/except blocks and does not have reduce() in
the functools package.

The main changes are:
* try/except blocks require `except ... as ...:` to resolve syntactical ambiguity
* map() and filter() return iterators rather than lists in Python 3
* reduce() is now in functools package (and not built-in in Python 3)
* Dictionaries don't have a has_key() method in Python 3
* None and int types can't be directly compared in Python 3
* print() is a statement in Python 3

See http://diveintopython3.org/porting-code-to-python-3-with-2to3.html and
PEP-3110 for details.

Verified on Python 2.6.5 and 3.1.3.

Signed-off-by: David Coles <dcoles@gaikai.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
configure.ac
src/c_client.py