diff --git a/pants b/pants index 00c0843e5..ddc8c54bf 100755 --- a/pants +++ b/pants @@ -6,35 +6,33 @@ # This ./pants bootstrap script comes from the pantsbuild/setup # project. It is intended to be checked into your code repository so # that other developers have the same setup. - # # Learn more here: https://www.pantsbuild.org/docs/installation # ==================================================================== set -eou pipefail +# NOTE: To use an unreleased version of Pants from the pantsbuild/pants master branch, +# locate the master branch SHA, set PANTS_SHA= in the environment, and run this script as usual. +# +# E.g., PANTS_SHA=725fdaf504237190f6787dda3d72c39010a4c574 ./pants --version + PYTHON_BIN_NAME="${PYTHON:-unspecified}" -# Set one of these to specify a non-standard location for this script to read the pants version from. +# Set this to specify a non-standard location for this script to read the Pants version from. # NB: This will *not* cause Pants itself to use this location as a config file. # You can use PANTS_CONFIG_FILES or --pants-config-files to do so. -PANTS_INI=${PANTS_INI:-pants.ini} PANTS_TOML=${PANTS_TOML:-pants.toml} -# NOTE: To use an unreleased version of Pants from the pantsbuild/pants master branch, -# locate the master branch SHA, set PANTS_SHA= in the environment, and run this script as usual. -# -# E.g., PANTS_SHA=725fdaf504237190f6787dda3d72c39010a4c574 ./pants --version - PANTS_BIN_NAME="${PANTS_BIN_NAME:-$0}" -PANTS_HOME="${PANTS_HOME:-${XDG_CACHE_HOME:-$HOME/.cache}/pants/setup}" +PANTS_SETUP_CACHE="${PANTS_SETUP_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/pants/setup}" # If given a relative path, we fix it to be absolute. -if [[ "$PANTS_HOME" != /* ]]; then - PANTS_HOME="${PWD}/${PANTS_HOME}" +if [[ "$PANTS_SETUP_CACHE" != /* ]]; then + PANTS_SETUP_CACHE="${PWD}/${PANTS_SETUP_CACHE}" fi -PANTS_BOOTSTRAP="${PANTS_HOME}/bootstrap-$(uname -s)-$(uname -m)" +PANTS_BOOTSTRAP="${PANTS_SETUP_CACHE}/bootstrap-$(uname -s)-$(uname -m)" VENV_VERSION=${VENV_VERSION:-16.4.3} @@ -63,38 +61,24 @@ function tempdir { } function get_exe_path_or_die { - exe="$1" + local exe="$1" if ! command -v "${exe}"; then die "Could not find ${exe}. Please ensure ${exe} is on your PATH." fi } -pants_config_file="" -if [[ -f "${PANTS_INI}" ]]; then - pants_config_file="${PANTS_INI}" -fi -if [[ -f "${PANTS_TOML}" ]]; then - pants_config_file="${PANTS_TOML}" -fi - function get_pants_config_value { - config_key="$1" - optional_space="[[:space:]]*" - if [[ "${pants_config_file}" == *.ini ]]; then - valid_delimiters="[:=]" - prefix="^${config_key}${optional_space}${valid_delimiters}${optional_space}" - sed -ne "/${prefix}/ s#${prefix}##p" "${PANTS_INI}" && return 0 - fi - if [[ "${pants_config_file}" == *.toml ]]; then - prefix="^${config_key}${optional_space}=${optional_space}" - raw_value="$(sed -ne "/${prefix}/ s#${prefix}##p" "${PANTS_TOML}")" - echo "${raw_value}" | tr -d \"\' && return 0 - fi + local config_key="$1" + local optional_space="[[:space:]]*" + local prefix="^${config_key}${optional_space}=${optional_space}" + local raw_value + raw_value="$(sed -ne "/${prefix}/ s#${prefix}##p" "${PANTS_TOML}")" + echo "${raw_value}" | tr -d \"\' && return 0 return 0 } function get_python_major_minor_version { - python_exe="$1" + local python_exe="$1" "$python_exe" <3 +interpreter_constraints = ">3" [test.pytest] # AURORA-1972: As a workaround for spuriously failing tests, test different # targets in isolation -fast: False - -[pytest] -# FIXME: Workaround for https://github.com/pytest-dev/pytest/issues/4770 -# Can be dropped once we upgrade to pants 1.14.0 -requirements: pytest==3.0.7 +fast = false # We have some modules that have side-effects upon import, including starting a repl, so we can't # use python-eval to validate our BUILD deps currently. [lint.python-eval] -skip: True +skip = true # We use isort for this. [pycheck-import-order] -skip: True +skip = true [pycheck-pycodestyle] # Code reference is here: http://pep8.readthedocs.org/en/latest/intro.html#error-codes -ignore: [ +ignore = [ # Aurora custom ignores: 'E114', # indentation is not a multiple of four (comment) 'E116', # unexpected indentation (comment) @@ -93,4 +88,4 @@ ignore: [ # T800 Instead of Context.CommandError use self.CommandError or cls.CommandError with # instancemethods and classmethods respectively. [pycheck-class-factoring] -skip: True +skip = true