Support loading config from multiple files.

This subsumes two disparate pieces of functionality:

A) PANTS_CONFIG_OVERRIDES.
B) rcfiles.

A) This env variable has been retconned int a --config-overrides
   bootstrap option.

B) Rcfiles used to contain extra command-line flags for various commands, which
   was weird. Since all flags are now options, and so can be set from config,
   the new rcfiles are just regular pants.ini-style config files.

After deploying pants with this commit, existing rcfiles will need to be converted
to pants.ini style. However currently rcfiles are broken anyway, so this isn't
an onerous requirement.

This commit also includes various changes needed to get things to work under
this new config scheme. Some of these are temporary hacks that will go away
when we get rid of Command, or when we get rid of all direct accesses to config.

One prominent change is a modification to config caching. Previously
configs were keyed by the file they were read from. But in practice
code always calls Config.from_cache() with no argument, which
defaults to the regular pants.ini. This leads to dangerous confusion
when config can be read from other files. So now there's just a single
global cached config, which must be set explicitly. Again, this will
go away once we convert all direct config accesses to options accesses,
and plumb options through to all the necessary places.

Testing Done:
CI passes.

Reviewed at https://rbcommons.com/s/twitter/r/1442/
doc: on skinny displays, don't show navigation UI by default.

also on skinny displays, show a button that toggles navigation UI [in]visible

Testing Done:
Looked at test-publish
http://pantsbuild.github.io/lahosken-okskinny/
with a few browsers, including my Android's built-in and Chrome on Android.

Reviewed at https://rbcommons.com/s/twitter/r/1440/
Support loading plugins via pkg_resources entry points

This provides an alternative way to find the methods `build_file_aliases` and `register_goals` that
are called as part of extension loading, specifically that for off-the-shelf plugins installed as
distrubutions, these methods are found using pkg_resources' entry points configuration.

Source backends are useful for quick and easy loading of custom tasks or aliases from sources that
live in a project. This change is not entended to replace source backends, but rather to make use
of richer metadata avilable on packaged distributions used for deploying off-the-shelf plugins.

Distributions (egg/sdist/etc) have version information and can define their entry points, which allows
cleaner separation of layout and implementation from core pants. Version requirements can be checked at
load and plugins can assert other plugins are loaded before them (since order matters eg "replace=True").

Adding such a plugin when using virtualenv pants would consist of adding it to requirements.txt used to
setup the virtualenv (or simply pip installing if using global site-packages), then adding it to
pants.ini's `plugins` list under the section `backends`.

For deployments running pants from a pex, the plugins could either be built into the distributed pex or
plugins could still be installed to a virualenv using a requirments.txt if that env were somehow then
added to the python path when invoking the pex.

This change does not include support for resolving, fetching or in any way installing plugins at
runtime -- requested plugins are loaded if they are found or an error is raised if not.  If or how how
to support loading plugins that are not previously installed is left for a separate discussion.

Testing Done:
https://travis-ci.org/pantsbuild/pants/builds/43419387
Added tests with mocked out distributions to test_extension_loader.py.
Demo repo: https://github.com/foursquare/pants-plugins-demo

Bugs closed: 843

Reviewed at https://rbcommons.com/s/twitter/r/1429/
Remove the old setup_py command.

It has been replaced by the python_setup goal.

There are no longer any remaining commands in pants, other than GoalRunner.

Note that this requires 49bb9f43eeb1331342f35cef331265cf4b8199bb, so it may not work if you cherry-pick it.

Testing Done:
CI passes.

Reviewed at https://rbcommons.com/s/twitter/r/1448/
Move the spec exclude integration test from command to base.

It is base-level functionality that has nothing to do with command.

Testing Done:
Integration test passed in its new location.

CI baking.

Reviewed at https://rbcommons.com/s/twitter/r/1449/
migrate_config only complain about keys not from defaults

has_option seems to return true if a key is found from defaults even if it isn't overridden
in a given section (ours was complaining about 'confs' in a a mostly empty junit-run section).

This seems to fix it, though in the event a section was actually overriding a default,
just with the same value, it will ignore that. I couldn't figure out how to see if a section
actually defined a key without poking around in ConfigParser's private fields.

Reviewed at https://rbcommons.com/s/twitter/r/1451/
Gracefully handle another run creating latest link

Gracefully handle a race with another run creating or removing the latest link (which can happen with concurrent runs).

Testing Done:
Concurrent runs ~8µs apart.
https://travis-ci.org/pantsbuild/pants/builds/41989058

Bugs closed: 827

Reviewed at https://rbcommons.com/s/twitter/r/1396/
Refactor options bootstrapping.

Instead of free-floating functions, the bootstrapping is now
encapsulated in a bootstrapper class. This class exposes both the
bootstrap and full options.

This is necessary to support the startup sequence in pants_exe.py properly:

- To create full options we need the known scopes.
- To get the known scopes we need to load plugins and extensions.
- The plugin and extension registration code may use config.

Therefore we need a way to load the bootstrap config, then do some work,
then load the full options.

Currently we achieve this with a gross manual config-reading hack in pants_exe.py.
This change will allow us to get rid of that hack.

This change also fixes an issue where in tests the buildroot wasn't plumbed in
everywhere it should be.

Testing Done:
Unit tests pass. Integration tests pass.

Reviewed at https://rbcommons.com/s/twitter/r/1453/
Fix ./pants to ./pants goal gaols in tutorial.

Fix ./pants to ./pants goal goals

Since ./pants gives you an error saying no goals to prepare.

Reviewed at https://rbcommons.com/s/twitter/r/1427/
Always relativize the classpath where possible.

Mesos produces very long path names, and repeating these names in the classpath can exceed the max length of a single argument (which defaults to 131072 on Linux).

Testing Done:
https://travis-ci.org/pantsbuild/pants/builds/43541955

(and then ran new tests locally).

Reviewed at https://rbcommons.com/s/twitter/r/1455/
Fix gitignore path for bin to only include root bin directory
(which is created by eclipse); remove unnecessary unexclusions.

Reviewed at https://rbcommons.com/s/twitter/r/1456/
s/whre/where/ in first tutorial

Reviewed at https://rbcommons.com/s/twitter/r/1464/
Fix a bug where a request for help wasn't detected.

Testing Done:
options unittests pass.

Reviewed at https://rbcommons.com/s/twitter/r/1467/
Get rid of the Command class completely.

GoalRunner now just extends object.

The functionality previously in Command is now in GoalRunner.

Most of the functionality in pants_exe.py is now in GoalRunner too.

RIP old pants...

Testing Done:
All integration and unit tests pass.

Reviewed at https://rbcommons.com/s/twitter/r/1465/
Optimize goal changed

Make goal changed approximately O(paths + targets), instead of something much worse.

Testing Done:
Correctness: https://travis-ci.org/pantsbuild/pants/builds/43764453

Performance: tested on a megachange branch on Twitter's monorepo; previous time was on the order of hours; time with patch is 3 minutes.

Reviewed at https://rbcommons.com/s/twitter/r/1470/
Handle UTF-8 in thrift files for python

Testing Done:
Ran new tests (red/green/go)

Reviewed at https://rbcommons.com/s/twitter/r/1459/
Move GoalRunner to the bin package, together with pants_exe.py.

Gets rid of the command package.

Testing Done:
Pants builds. Dev and regular pants work.

Reviewed at https://rbcommons.com/s/twitter/r/1471/
docs: update a couple of examples that showed Pants output. old Pants output

specifically, we caught these as places that contain the string "BUILD:", and
in a refactor a while back, that string was a symptom of obsolescence.

We fixed most of those in passing, but these remain, https://github.com/pantsbuild/pants/issues/461

Testing Done:
rendered at
* http://pantsbuild.github.io/lahosken-demo/build_files.html#debugging-a-build-file
* http://pantsbuild.github.io/lahosken-demo/publish.html#does-not-provide-an-artifact

Bugs closed: 461

Reviewed at https://rbcommons.com/s/twitter/r/1401/
Cleanup after custom options bootstrapping in reflect.

The custom bootstrapping to get a symbolic buildroot for
doc generation was affecting global state and leaving a
buildroot of <buildroot> laying around for subsequent code
to pick up and unwittingly try to use.

Testing Done:
Locally this was failing before, passed after:
```console
$ PANTS_DEV=1 ./pants goal test tests/python/pants_test/tasks:reflect tests/python/pants_test/backend/python:test_builder
```

Also generated docs and confirmed the intended symbolic <buildroot> was being interpolated: http://pantsbuild.github.io/jsirois/goals_reference.html#Common

Installed python 3.2.5 after which the following failed but then passed after diff 3:
```console
$ PATH=/home/jsirois/.pyenv/versions/3.2.5/bin:$PATH pants.dev goal test tests/python/pants_test/tasks:reflect tests/python/pants_test/backend/python:test_builder
```

CI went green here: https://travis-ci.org/pantsbuild/pants/builds/43773742

Bugs closed: 861

Reviewed at https://rbcommons.com/s/twitter/r/1468/
Restore the deprecation warning for specifying 'goal' on the cmdline.

Reviewed at https://rbcommons.com/s/twitter/r/1476/