Add basic lazy gettext implementation

This is the first part of an implementation towards
a deferred localization functionality in OpenStack.
This change adds a Message class for encapsulating a
translatable message and its relevant data, as well
as an example LogHandler of how such a class can be
used in the logging context.

bp delayed-message-translation

Change-Id: I8485a346d32925327ea9185e0da3822e4e19c2f5
Rename requires files to standard names.

Rename tools/pip-requires to requirements.txt and tools/test-requires
to test-requirements.txt. These are standard files, and tools in the
general world are growing intelligence about them.

Fixes: bug #1179008
Change-Id: I033876ec304fea97c66365c16bcf0cccaa1d810e
Add common code for fileutils.

This code is present in nova, cinder and also needed by ironic package.
* delete_if_exists
* remove_path_on_error

Also added some tests.

openstack/common/fileutils.py => nova.common.utils <=> cinder.common.utils

Change-Id: Id5001db161bb8e7dfb20d1b2cc2033e886cda32f
Implements: blueprint image-tools
Merge "Rename requires files to standard names."
Merge "Add common code for fileutils."
Added common code into fileutils and strutils.

This methods are present in nova, cinder and also needed by ironic package.

openstack.common.strutils => nova.utils <=> cinder.utils
    to_bytes(text, default=0)

openstack.common.fileutils => nova.utils <=> cinder.utils <=> nova/virt/libvirt/utils.py
    file_open(*args, **kwargs)

Change-Id: Ia65499b77eb551c0ffb6d48767b899435469bfb6
Implements: blueprint image-tools
Merge "Add basic lazy gettext implementation"
Add fileutils maintainer

Change-Id: I1f909a84589ef173ac4e858e4c27a8a536d991ba
Use Python 3.x compatible except construct

Per (proposed) Hacking H203 check, always use the
except x as y: construct, which works with any
Python version >= 2.6, including Python 3.x.

Change-Id: I46028647d5a2a53ba8e9ce4d2e8fc6e71850fdae
Changed processing unique constraint name.

Mr. Devananda found that dollar sign can be used as special symbol in
various programming langugages and proposed to use `0` instead of `$`.
So unique constraint name convention was changed from "uniq_t$c1$c2$c3"
to "uniq_t0c10c20c3" where `0` it is delimiter, `t` it is table name and
columns `c1`, `c2`, `c3` are in UniqueConstraint.

Function `_raise_if_duplicate_entry_error()` modified respectively to
new unique constraint name convention.

Change-Id: I88208dc03b55bbbc709b18580048c008004c9fda
Merge "Changed processing unique constraint name."
Use Python 3.x compatible octal literal notation

0o755 is accepted by Python 2.6 and newer (did not
check older versions)

Change-Id: I764fb56f8ae26c63981a96e1d988d6da37e1bd02
Use param keyword for docstrings

Change-Id: I381a5f917a1c274634173d843dde730218806506
Make lock_file_prefix optional

Currently, the lock_file_prefix says it should end with an hypen if
specified. It seems that it was intended to be optional. Since that
behavior makes sense, this patch changes the synchronized's signature
and makes lock_file_prefix optional.

With this patch, the prefix will not be required to end with an hypen
anymore, such sign will be added to the prefix if specified and if not
already present.

This patch doesn't change synchronized's behavior at all, which means it
doesn't break backward compatibility.

Change-Id: I8841da1e8d105aac4a86b247228a9c935e00afc5
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 funcionality 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.

This patch is needed as part of the blueprint cache-backend-abstraction

Change-Id: I96b2ee84da5a2dcd7f0bd469f8a1e52b74e50c75
Add a Dynamic read-write lock

The patch adds a read-write lock whose name can be set dynamically when
calling the read / write method.

This patch is implemented as part of the blueprint
cache-backend-abstraction and will be used for synchronizing read /
write operations in a per-key basis.

Change-Id: I0820a98bec701f2b8ab9a707ecdf673a00af116f
Mocking oslo-cache up
Some changes:

* Added incr and append method
* Added working code to memory.py and its test case
* Updated README.rst
Moved backends/base.py to cache/backends.py

* Made backends package private
* Renamed Cache into BaseCache
Remove return None

Change-Id: I58f82f8a03b39a08842aeb1037a1c00a5abfc58f