python3: Add basic python3 compatibility.

Use six.text_type to replace unicode() in python2
and str in python3.

Change-Id: I61e961248241014380ec464429f2585a9497333b
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Move synchronized body to a first-class function

synchronized is being widely used throughout OpenStack for managing
locks by decorating methods / functions. However, it's functionality is
trapped within that decorator definition and makes it difficult to
manage locks by using it in other cases (like w/o decorating).

This patch moves decorator's body into a first-class function called
lock which is intended to be used as a context manager type (with
statement).

Some examples:

    with lockutils.lock("test") as sem:
        print('Inside the lock')

Things I'm not 100% convinced:

    * The `lock` function yields a Semaphore when external is False and
    an InterProcessLock instance otherwise. Although it is not 'good' to
    yield different values depending on the input parameters, it's
    pretty explicit (by reading the documentation) that external locks
    are handled differently. Other options for this case are:

        1. Always yield a Semaphore instance
        2. Don't yield anything

The patch doesn't break backward compatibility so no change is needed to
existing projects.

Implements blueprint cache-backend-abstraction

Change-Id: I96b2ee84da5a2dcd7f0bd469f8a1e52b74e50c75
Remove the unused notifier.add_driver() API

This was only needed to support the plugins framework which is now
removed.

Change-Id: Id3d08c23f7791bfef9739f1f65af844fd429777c
python3: Add basic compatibility support.

Add python2/python3 compatibility support:

- Change basestring to use six.string_type so that
six will either use str() or basestring().
- Use six.iteritems to replace dictionary.iteritems() on
python2 or dictionary.items() on python3.

Change-Id: I3a8eb1ba5b2fb2859169299d37ae6eeb9bb4cac0
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Merge "Remove the unused notifier.add_driver() API"
Merge "python3: Add basic python3 compatibility."
Merge "python3: Add basic compatibility support."
Merge "Move synchronized body to a first-class function"