python3 compatibility:

python 2.6 does not have memoryview, so lets define it as buffer
python3 compatibility: dict

this patch
 1.) removes the iteritems/itervalues, which were dropped in py3
     items/values are used instead
 2.) add an extra list() in a cases the list-based access is needed
     (included appending, indexing and so)
 3.) changes a sorting idiom in few places
     instead of
     foo = dict.keys()
     foo.sort()
     for i in foo:

     there is a recommended

     for i in sorted(dict.keys()):
 4.) in one occassion it removes a if dict.has_key() by simpler
   dict.get(key, default)
python3 compatibility: except

changes 'except FooError, fe' to 'except FooError as fe'

available in python 2.6
python 3 compatibility: exec

exec is no longer a statement
python3 compatibility: funcattrs, methodattrs

the introspection names changed a lot in python3, so lets have two
implementations used by respective runtime
python3 compatibility: getcwdu

used just on one place, seems to be enough to simply remove it
python3 compatibility: has_key

don't use method removed from python3
python3 compatibility: idioms

more idiomatic code - changes

  * type(foo) == bar to isinstance(foo, bar)
  * changes the uneeded .sort calls by sorted()
python3 compatibility: use relative imports

Use relative imports when using module's own modules - this makes a
clear distinction between already developed copy and installed package.
python3 compatibility: import proper modules

Some modules (httplib, StringIO, ...) were renamed in python3. This
patch try to import the proper symbols from python3 and then fallback to
python2 in a case ImportError will appear.

There is one exception, python 2.7 got the io module with StringIO, but
it allow unicode arguments only. Therefor the old module is poked before
new one.
python3 compatibility: new syntax for literals

The octal literals got a new syntax 0755 -> 0o755
python3 compatibility: print function

The most visible change in python3 - removal of print statement and all
the crufty
   print >> sys.stderr, foo,

The from __future__ import print_function makes it available in python
2.6
python3 compatibility: raise

support for old style exceptions has been removed from python3
python3 compatibility: raw_input

raw_input has been removed and equals to input in py3. Unfortunatelly no
__future__ statement exists for that. Ensure all modules uses
osc.core.raw_input except osc.cmdln, where there is NameError way
implemented.
python3 compatibility: unicode

reintroduce unicode function - despite the fact I am pretty sure the
usage is plain wrong, because code says - return a unicode string from
utf-8 encoded one, which is probably not what was intended. I bet
something like encode the input as utf-8 was wanted.
python3 compatibility: urllib

fixes all renames in urllib, urllib2, urlparse modules in python3
python3 compatibility: fix all tests
python3 compatibility: make all unit test pass

There are many places can't be covered by 2to3, especially the
str/unicode -> str/bytes change done in python3. This is a big patch
incorporating all changes made in order to make python3 suite.py run
without any single failure.

It

 * adapt the introspect_handler_3 for case there are no __defaults__
 * adds the ET_ENCODING variable for ET.fromstring ("unicode" in py3,
  "utf-8" in py2)
 * (re)adds various builtins to both python versions
    - memoryview to python 2.6
    - bytes compatible with py3 to 2.6 and 2.7

and it changes few parts of tests/common.py in order to be compatible
with python3

 * new urlcompare method compares all components or url + parsed query
   string in a dictionary, so the ordering, neither quoting does not matter
 * bytes builtin has been added to 2.x and used in assertEqualMultiline
python3 compatibility: fix osc-wrapper

the sys reload trick does not work in python 3 and it is not needed, so
let's remove that