|
34 | 34 |
|
35 | 35 | PANTS_BOOTSTRAP="${PANTS_SETUP_CACHE}/bootstrap-$(uname -s)-$(uname -m)"
|
36 | 36 |
|
37 |
| -_PEX_VERSION=2.1.42 |
| 37 | +_PEX_VERSION=2.1.62 |
38 | 38 | _PEX_URL="https://github.com/pantsbuild/pex/releases/download/v${_PEX_VERSION}/pex"
|
39 |
| -_PEX_EXPECTED_SHA256="69d6b1b1009b00dd14a3a9f19b72cff818a713ca44b3186c9b12074b2a31e51f" |
| 39 | +_PEX_EXPECTED_SHA256="56668b1ca147bd63141e586ffee97c7cc51ce8e6eac6c9b7a4bf1215b94396e5" |
40 | 40 |
|
41 | 41 | VIRTUALENV_VERSION=20.4.7
|
42 | 42 | VIRTUALENV_REQUIREMENTS=$(
|
@@ -87,13 +87,18 @@ function get_exe_path_or_die {
|
87 | 87 | fi
|
88 | 88 | }
|
89 | 89 |
|
90 |
| -function get_pants_config_value { |
| 90 | +function get_pants_config_string_value { |
91 | 91 | local config_key="$1"
|
92 | 92 | local optional_space="[[:space:]]*"
|
93 | 93 | local prefix="^${config_key}${optional_space}=${optional_space}"
|
94 | 94 | 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 |
97 | 102 | return 0
|
98 | 103 | }
|
99 | 104 |
|
@@ -125,7 +130,7 @@ function determine_pants_version {
|
125 | 130 | return
|
126 | 131 | fi
|
127 | 132 |
|
128 |
| - pants_version="$(get_pants_config_value 'pants_version')" |
| 133 | + pants_version="$(get_pants_config_string_value 'pants_version')" |
129 | 134 | if [[ -z "${pants_version}" ]]; then
|
130 | 135 | die "Please explicitly specify the \`pants_version\` in your \`pants.toml\` under the \`[GLOBAL]\` scope.
|
131 | 136 | See https://pypi.org/project/pantsbuild.pants/#history for all released versions
|
@@ -191,8 +196,8 @@ function determine_default_python_exe {
|
191 | 196 | if [[ -z "${interpreter_path}" ]]; then
|
192 | 197 | continue
|
193 | 198 | 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 |
196 | 201 | continue
|
197 | 202 | fi
|
198 | 203 | if [[ -n "$(check_python_exe_compatible_version "${interpreter_path}")" ]]; then
|
@@ -249,7 +254,12 @@ function bootstrap_pex {
|
249 | 254 | local staging_dir
|
250 | 255 | staging_dir=$(tempdir "${PANTS_BOOTSTRAP}")
|
251 | 256 | 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}" |
253 | 263 | fingerprint="$(compute_sha256 "${python}" "pex")"
|
254 | 264 | if [[ "${_PEX_EXPECTED_SHA256}" != "${fingerprint}" ]]; then
|
255 | 265 | die "SHA256 of ${_PEX_URL} is not as expected. Aborting."
|
@@ -307,7 +317,12 @@ function get_version_for_sha {
|
307 | 317 |
|
308 | 318 | # Retrieve the Pants version associated with this commit.
|
309 | 319 | 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")" |
311 | 326 |
|
312 | 327 | # Construct the version as the release version from src/python/pants/VERSION, plus the string `+gitXXXXXXXX`,
|
313 | 328 | # where the XXXXXXXX is the first 8 characters of the SHA.
|
@@ -342,9 +357,11 @@ function bootstrap_pants {
|
342 | 357 | (
|
343 | 358 | scrub_PEX_env_vars
|
344 | 359 | # 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}" |
348 | 365 | ) && \
|
349 | 366 | ln -s "${staging_dir}/install" "${staging_dir}/${target_folder_name}" && \
|
350 | 367 | mv "${staging_dir}/${target_folder_name}" "${bootstrapped}" && \
|
|
0 commit comments