Fix gen_rst.py to use the correct encoding even on Python 2.
Switching b and c in _transformation_converter to fix issue #1886
added rcParam for x and y margin

Addresses issue #1766
shutil.move: Guard against IOError and print warnings instead of crashing.
matplotlib: _is_writable_dir uses os.access instead of TemporaryFile.

This is a more direct approach and avoids strange behaviour on systems that
provide a fake implementation of TemporaryFile. In particular, on Google App
Engine, TemporaryFile is equivalent to StringIO, so this would have always
succeeded, despite the fact that the directory is not actually writable.

It is also not particularly nice to go creating and deleting random files in the
user's home directory.
Matplotlib now works when the user has no home directory.

matplotlib.get_home now returns None if there is no home directory, instead of
raising RuntimeError. Updated code in several places to handle this gracefully.

matplotlib.get_configdir now returns a temporary directory if there is no home
directory, instead of raising RuntimeError.
get_configdir returns None if tempfile.gettempdir() is not available.

Previously, it would raise NotImplementedError. This is necessary on restricted
platforms such as Google App Engine that do not provide gettempdir.
Deal with all cases where get_configdir might return None.

Each case is either handled gracefully, or raises a RuntimeError.
font_manager: Gracefully handle the case of there being no config dir.

Instead of raising RuntimeError, now avoids reading and writing the font cache.
texmanager: Gracefully handle the case of there being no config dir upon import.

Instead of raising RuntimeError, now avoids creating the cache dir. This permits
texmanager to be imported in a restricted environment such as Google App Engine.

Actually constructing a TexManager object will fail, but it can be imported.
finance: Gracefully handle the case of there being no config dir.

Instead of raising RuntimeError, now avoids reading and writing the cache.
Fix formatting and other misc code tweaks.
matplotlib.get_home: Removing catch-all except blocks.
matplotlib, texmanager: Change WARNING prints into real warnings.
matplotlib, texmanager: Only print the rename message if it actually succeeded.
finance: Fixed caching when cachename is supplied.

Previously, it would not cache if there was no cachedir, even if cachename was
supplied.
matplotlib: Use cbook.mkdirs instead of os.makedirs.
matplotlib: Remove catch for OSError.

os.access does not raise this exception.
matplotlib: _is_writable_dir checks that it is a directory.
matplotlib: _is_writable_dir tests with os.access and TemporaryFile.

This fails either if the OS tells us it isn't writable, or if a file cannot be
created there.