forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpants3
executable file
·21 lines (17 loc) · 1.11 KB
/
pants3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
# This bootstrap script invokes Pants using a Python 3 interpreter.
#
# To constrain to a specific Python 3 version, such as 3.7, prefix the script with `PY=python3.7`.
# Default to using Python 3 if not otherwise specified.
export PY="${PY:-python3}"
# Set interpreter constraints to exactly match the interpreter used for the venv.
# Note that $PY only impacts which virtualenv we use for the parent Pants process; we must also set
# PANTS_PYTHON_SETUP_INTERPRETER_CONSTRAINTS to constrain spawned subprocesses such as tests. Without
# any interpreter constraints, we get the _Py_Dealloc exception (#6985) as Pants will try to use Python 2
# for subprocesses. Without the exact constraints we set, we could end up using a different Python 3
# minor version for subprocesses than we do for Pants.
py_major_minor=$(${PY} -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))')
export PANTS_PYTHON_SETUP_INTERPRETER_CONSTRAINTS="['CPython==${py_major_minor}.*']"
./pants "$@"