Skip to content

Commit

Permalink
Update pex tool usages to work with pex 1.6.+.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Apr 3, 2019
1 parent c301846 commit 12a7144
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
8 changes: 2 additions & 6 deletions build-support/bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,13 @@ function run_pex() {
# TODO: Cache this in case we run pex multiple times
(
PEX_VERSION="$(requirement pex | sed -e "s|pex==||")"
PEX_PEX=pex27
if [[ "${python_three:-false}" == "true" ]]; then
PEX_PEX=pex36
fi

pexdir="$(mktemp -d -t build_pex.XXXXX)"
trap "rm -rf ${pexdir}" EXIT

pex="${pexdir}/${PEX_PEX}"
pex="${pexdir}/pex"

curl -sSL "${PEX_DOWNLOAD_PREFIX}/v${PEX_VERSION}/${PEX_PEX}" > "${pex}"
curl -sSL "${PEX_DOWNLOAD_PREFIX}/v${PEX_VERSION}/pex" > "${pex}"
chmod +x "${pex}"
"${pex}" "$@"
)
Expand Down
14 changes: 3 additions & 11 deletions src/python/pants/backend/python/rules/python_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,9 @@ def run_python_test(transitive_hydrated_target, pytest):
target_root = transitive_hydrated_target.root

# TODO: Inject versions and digests here through some option, rather than hard-coding it.
interpreter_major, interpreter_minor = sys.version_info[0:2]
pex_name, digest = {
(2, 7): ("pex27", Digest('0ecbf48e3e240a413189194a9f829aec10446705c84db310affe36e23e741dbc', 1812737)),
(3, 6): ("pex36", Digest('ba865e7ce7a840070d58b7ba24e7a67aff058435cfa34202abdd878e7b5d351d', 1812158)),
(3, 7): ("pex37", Digest('51bf8e84d5290fe5ff43d45be78d58eaf88cf2a5e995101c8ff9e6a73a73343d', 1813189))
}.get((interpreter_major, interpreter_minor), (None, None))
if pex_name is None:
raise ValueError("Current interpreter {}.{} is not supported, as there is no corresponding PEX to download.".format(interpreter_major, interpreter_minor))

pex_snapshot = yield Get(Snapshot,
UrlToFetch("https://github.com/pantsbuild/pex/releases/download/v1.6.1/{}".format(pex_name), digest))
url = 'https://github.com/pantsbuild/pex/releases/download/v1.6.6/pex'
digest = Digest('61bb79384db0da8c844678440bd368bcbfac17bbdb865721ad3f9cb0ab29b629', 1826945)
pex_snapshot = yield Get(Snapshot, UrlToFetch(url, digest))

all_targets = [target_root] + [dep.root for dep in transitive_hydrated_target.dependencies]

Expand Down

0 comments on commit 12a7144

Please sign in to comment.