Elevate the pants version to a 1st class option.

Review Request #2627 - Created Aug. 15, 2015 and submitted

Information
John Sirois
pants
jsirois/setup/pants_version
1983
493296f...
Reviewers
pants-reviews
benjyw, stuhood, zundel
Currently `pants_version` is a config option relied on by pants tooling
but not formalized as a registered option in the pants codebase.  This
change lifts all forms of pants version (`-V`, `--version` and the new
`--pants-version`) to be a global option.  The option is configured to
work as both a 0-arg command-line flag to trigger version help printing
as well as an option to use for setting the desired pants_version in
pants.ini (or via an the PANTS_VERSION env var).  The pantsbuild/setup
script and other proprietary pants bootstrap scripts use this option to
bootstrap pants to the requested version today and in the future pants
itself will use the version in this way.

 build-support/bin/ci.sh                             |  3 ++-
 build-support/bin/release.sh                        |  4 ++--
 src/python/pants/bin/goal_runner.py                 | 15 +++++++++++----
 src/python/pants/option/BUILD                       |  1 -
 src/python/pants/option/arg_splitter.py             | 14 --------------
 src/python/pants/option/global_options.py           | 18 +++++++++++++++++-
 src/python/pants/option/options.py                  |  9 +++------
 tests/python/pants_test/option/test_arg_splitter.py | 19 +------------------
 8 files changed, 36 insertions(+), 47 deletions(-)

Verified a 4x speed improvement in ./pants --version! - heh.

Verified pants_version is picked up as a pants.ini option like so:

$ git diff -U1 pants.ini
diff --git a/pants.ini b/pants.ini
index a557fbf..8b2eeea 100644
--- a/pants.ini
+++ b/pants.ini
@@ -11,2 +11,4 @@
 [DEFAULT]
+pants_version: jake
+
 print_exception_stacktrace: True

$ ./pants -V
0.0.41
$ ./pants -h | grep version
-V=<str>, --pants-version=<str>, --version=<str> (default: jake)
    Prints pants' version number and exits.

Note that the real version of pants is printed when -V is requested
on the CLI, but the configured pants_version print as the default in
help output. Once pantsbuild/setup (next change) and, in the future,
pants itself uses pants_version to bootstrap the proper pants version
this will always align as expected.

CI is away here:
https://travis-ci.org/pantsbuild/pants/builds/75679069

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Eric Ayers
John Sirois
Benjy Weinberger
Eric Ayers
John Sirois
John Sirois
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...