Write and read more complex git sha info

Instead of encoding the git sha into the version string, add it to
a metadata file. This will allow us to get out of the business of
arguing with pip and setuptools about version info. In order to make
this really nice, provide a command line utility called "pbr" that has
subcommands to print out the metadata that we're now including in the
egg-info dir.

Change-Id: I35a1489c9ab637769218d1e6a26d1115a52a7051
Stop including git sha in version strings

We include it in pbr.json now. Including it is contentious in the world
of python, and it's up for debate as to whether or not it provides
value.

Change-Id: Ie2ca34f59e9b42a3126c95edf36640fef32feed8
Only import sphinx during hook processing

When pbr is imported to handle writing the egg_info file because of
the entry point, it's causing sphinx to get imported. This has a
cascading effect once docutils is trying to be installed on a
system with pbr installed. If some of the imports fail along the way,
allow pbr to continue usefully but without the Sphinx extensions
available. Eventually, when everything is installed, those extensions
will work again when the commands for build_sphinx, etc. are run
separately.

Also slip in a change to reorder the default list of environments run by
tox so the testr database is created using a dbm format available to all
python versions.

Change-Id: I79d67bf41a09d7e5aad8ed32eaf107f139167eb8
Closes-bug: #1403510
Use post version signifiers

PEP440 is unhappy about revcounts after pre-release tags.

Change-Id: I553a0bf9f522d50bcbdb16756c994058bd27da77
Properly check for git before getting git dir

We cannot get the git dir if git is not installed. Check that git is
installed before querying for the git dir. Return None if the git dir
cannot be found or if git is not installed.

Change-Id: Ic8e0c74a779b23842369a8cf01fcbf37885202ef
Fixes-bug: 1326682
Move write_pbr_json to avoid issues with nose

Put write_pbr_json in pbr.pbr_json so that you do not need to import
pbr.packaging to use it. This avoids python3 errors with nose where nose
is imported by pbr before it is converted to python3 by 2to3 under
python3.

Also port the pbr.git refactor from the master branch.

Co-Authored-By: Jeremy Stanley <fungi@yuggoth.org>
Change-Id: I1c420fed609bc60bbfdf78eb219e067ccab1a61e
(cherry picked from commit 3550e89db42002e226ea70b1d0314a319b2ecd10)
Integration test PBR commits

* pbr/packaging.py(_get_version_from_git): Correct a bug which is
causing install failures for PBR-based projects with no Git tags.
This slipped through because integration testing was using the most
recent PBR release rather than the commit being proposed.

* tools/integration.sh: Make sure that if a PBR commit is being
tested then we install and use that source rather than the latest
PBR release.

* tox.ini(testenv:pep8): Get rid of the custom deps list for pep8
and inherit the one from testenv which is already fixed with the
self-dependency. Without this, pep8 jobs fail when run with
Setuptools 8.

Change-Id: Icc7275261e8fc0df8b0ae99184437ca50b89c13a
Merge tag '0.10.3' into master

Releasing 0.10.3

Change-Id: If8dd160585172a09064413305123eb2d1079d5b6
Merge tag '0.10.4' into master

Releasing 0.10.4

Change-Id: I048cd25bf21eacd39883801ab79c4b91832fb395
Merge tag '0.10.5' into master

tag 0.10.5

Change-Id: I2c7c4ffdf853c352101b804447d7e4ba69f74ee0
Merge tag '0.10.6' into master

tag 0.10.6

Change-Id: I8eee890e579c40b00a4a9b504584c307772f9cbf