Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 261cd22

Browse files
Merge pull request #12 from grapl-security/pants-2.10.0
Update Pants to version 2.10.0
2 parents 17d31a7 + d6c36a6 commit 261cd22

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

pants

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ fi
3434

3535
PANTS_BOOTSTRAP="${PANTS_SETUP_CACHE}/bootstrap-$(uname -s)-$(uname -m)"
3636

37-
_PEX_VERSION=2.1.42
37+
_PEX_VERSION=2.1.62
3838
_PEX_URL="https://github.com/pantsbuild/pex/releases/download/v${_PEX_VERSION}/pex"
39-
_PEX_EXPECTED_SHA256="69d6b1b1009b00dd14a3a9f19b72cff818a713ca44b3186c9b12074b2a31e51f"
39+
_PEX_EXPECTED_SHA256="56668b1ca147bd63141e586ffee97c7cc51ce8e6eac6c9b7a4bf1215b94396e5"
4040

4141
VIRTUALENV_VERSION=20.4.7
4242
VIRTUALENV_REQUIREMENTS=$(
@@ -87,13 +87,18 @@ function get_exe_path_or_die {
8787
fi
8888
}
8989

90-
function get_pants_config_value {
90+
function get_pants_config_string_value {
9191
local config_key="$1"
9292
local optional_space="[[:space:]]*"
9393
local prefix="^${config_key}${optional_space}=${optional_space}"
9494
local raw_value
95-
raw_value="$(sed -ne "/${prefix}/ s#${prefix}##p" "${PANTS_TOML}")"
96-
echo "${raw_value}" | tr -d \"\' && return 0
95+
raw_value="$(sed -ne "/${prefix}/ s|${prefix}||p" "${PANTS_TOML}")"
96+
local optional_suffix="${optional_space}(#.*)?$"
97+
echo "${raw_value}" \
98+
| sed -E \
99+
-e "s|^'([^']*)'${optional_suffix}|\1|" \
100+
-e 's|^"([^"]*)"'"${optional_suffix}"'$|\1|' \
101+
&& return 0
97102
return 0
98103
}
99104

@@ -125,7 +130,7 @@ function determine_pants_version {
125130
return
126131
fi
127132

128-
pants_version="$(get_pants_config_value 'pants_version')"
133+
pants_version="$(get_pants_config_string_value 'pants_version')"
129134
if [[ -z "${pants_version}" ]]; then
130135
die "Please explicitly specify the \`pants_version\` in your \`pants.toml\` under the \`[GLOBAL]\` scope.
131136
See https://pypi.org/project/pantsbuild.pants/#history for all released versions
@@ -191,8 +196,8 @@ function determine_default_python_exe {
191196
if [[ -z "${interpreter_path}" ]]; then
192197
continue
193198
fi
194-
# Check if the Python version is installed via Pyenv but not activated.
195-
if [[ "$("${interpreter_path}" --version 2>&1 > /dev/null)" == "pyenv: python${version}"* ]]; then
199+
# Check if a version is shimmed by pyenv or asdf but not configured.
200+
if ! "${interpreter_path}" --version >/dev/null 2>&1; then
196201
continue
197202
fi
198203
if [[ -n "$(check_python_exe_compatible_version "${interpreter_path}")" ]]; then
@@ -249,7 +254,12 @@ function bootstrap_pex {
249254
local staging_dir
250255
staging_dir=$(tempdir "${PANTS_BOOTSTRAP}")
251256
cd "${staging_dir}"
252-
curl -LO "${_PEX_URL}"
257+
curl --proto "=https" \
258+
--tlsv1.2 \
259+
--silent \
260+
--location \
261+
--remote-name \
262+
"${_PEX_URL}"
253263
fingerprint="$(compute_sha256 "${python}" "pex")"
254264
if [[ "${_PEX_EXPECTED_SHA256}" != "${fingerprint}" ]]; then
255265
die "SHA256 of ${_PEX_URL} is not as expected. Aborting."
@@ -307,7 +317,12 @@ function get_version_for_sha {
307317

308318
# Retrieve the Pants version associated with this commit.
309319
local pants_version
310-
pants_version="$(curl --fail -sL "https://raw.githubusercontent.com/pantsbuild/pants/${sha}/src/python/pants/VERSION")"
320+
pants_version="$(curl --proto "=https" \
321+
--tlsv1.2 \
322+
--fail \
323+
--silent \
324+
--location \
325+
"https://raw.githubusercontent.com/pantsbuild/pants/${sha}/src/python/pants/VERSION")"
311326

312327
# Construct the version as the release version from src/python/pants/VERSION, plus the string `+gitXXXXXXXX`,
313328
# where the XXXXXXXX is the first 8 characters of the SHA.
@@ -342,9 +357,11 @@ function bootstrap_pants {
342357
(
343358
scrub_PEX_env_vars
344359
# shellcheck disable=SC2086
345-
"${python}" "${virtualenv_path}" --no-download "${staging_dir}/install" && \
346-
"${staging_dir}/install/bin/pip" install -U pip && \
347-
"${staging_dir}/install/bin/pip" install ${maybe_find_links} --progress-bar off "${pants_requirement}"
360+
"${python}" "${virtualenv_path}" --quiet --no-download "${staging_dir}/install" && \
361+
# Grab the latest pip, but don't advance setuptools past 58 which drops support for the
362+
# `setup` kwarg `use_2to3` which Pants 1.x sdist dependencies (pystache) use.
363+
"${staging_dir}/install/bin/pip" install --quiet -U pip "setuptools<58" && \
364+
"${staging_dir}/install/bin/pip" install ${maybe_find_links} --quiet --progress-bar off "${pants_requirement}"
348365
) && \
349366
ln -s "${staging_dir}/install" "${staging_dir}/${target_folder_name}" && \
350367
mv "${staging_dir}/${target_folder_name}" "${bootstrapped}" && \

pants.toml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[GLOBAL]
2-
pants_version = "2.9.0"
2+
pants_version = "2.10.0"
33
backend_packages = [
44
"pants.backend.shell",
55
"pants.backend.shell.lint.shellcheck",
@@ -40,14 +40,3 @@ args = ["-i 4", "-ci", "-sr"]
4040

4141
[test]
4242
output = "all"
43-
44-
[shellcheck]
45-
# Currently, Pants only knows about v0.7.1, but v0.7.2 has some nice
46-
# relative sourcing features we'd like to take advantage of (namely,
47-
# `script-path=SOURCEDIR`). Once Pants knows about v0.7.2 natively, we
48-
# can remove these configuration values.
49-
version = "v0.7.2"
50-
known_versions = [
51-
"v0.7.2|macos_x86_64|969bd7ef668e8167cfbba569fb9f4a0b2fc1c4021f87032b6a0b0e525fb77369|3988092",
52-
"v0.7.2|linux_x86_64|70423609f27b504d6c0c47e340f33652aea975e45f312324f2dbf91c95a3b188|1382204"
53-
]

0 commit comments

Comments
 (0)