Skip to content

Commit 23c862e

Browse files
majetideepakfacebook-github-bot
authored andcommitted
Add python venv to setup-macos.sh and Makefile (facebookincubator#10668)
Summary: Create python virtual environment in the Velox root directory if missing. Resolves facebookincubator#9519 Pull Request resolved: facebookincubator#10668 Reviewed By: xiaoxmeng Differential Revision: D61134745 Pulled By: pedroerp fbshipit-source-id: 89679ec7fdebe79f6861872c6104d9f4290e9887
1 parent 5f32870 commit 23c862e

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ autoconf/autom4te.cache
4848
projects/*
4949
!projects/*.*
5050
!projects/Makefile
51-
51+
.venv
5252

5353
#==============================================================================#
5454
# Autotools artifacts

Makefile

+19-1
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
# limitations under the License.
1414
.PHONY: all cmake build clean debug release unit
1515

16+
SHELL=/bin/bash
1617
BUILD_BASE_DIR=_build
1718
BUILD_DIR=release
1819
BUILD_TYPE=Release
1920
BENCHMARKS_BASIC_DIR=$(BUILD_BASE_DIR)/$(BUILD_DIR)/velox/benchmarks/basic/
2021
BENCHMARKS_DUMP_DIR=dumps
2122
TREAT_WARNINGS_AS_ERRORS ?= 1
2223
ENABLE_WALL ?= 1
24+
PYTHON_VENV ?= .venv
2325

2426
# Option to make a minimal build. By default set to "OFF"; set to
2527
# "ON" to only build a minimal set of components. This may override
@@ -169,17 +171,33 @@ fuzzertest: debug
169171
--minloglevel=0
170172

171173
format-fix: #: Fix formatting issues in the main branch
174+
ifneq ("$(wildcard ${PYTHON_VENV}/pyvenv.cfg)","")
175+
source ${PYTHON_VENV}/bin/activate; scripts/check.py format main --fix
176+
else
172177
scripts/check.py format main --fix
178+
endif
173179

174180
format-check: #: Check for formatting issues on the main branch
175181
clang-format --version
182+
ifneq ("$(wildcard ${PYTHON_VENV}/pyvenv.cfg)","")
183+
source ${PYTHON_VENV}/bin/activate; scripts/check.py format main
184+
else
176185
scripts/check.py format main
186+
endif
177187

178-
header-fix: #: Fix license header issues in the current branch
188+
header-fix: #: Fix license header issues in the current branch
189+
ifneq ("$(wildcard ${PYTHON_VENV}/pyvenv.cfg)","")
190+
source ${PYTHON_VENV}/bin/activate; scripts/check.py header main --fix
191+
else
179192
scripts/check.py header main --fix
193+
endif
180194

181195
header-check: #: Check for license header issues on the main branch
196+
ifneq ("$(wildcard ${PYTHON_VENV}/pyvenv.cfg)","")
197+
source ${PYTHON_VENV}/bin/activate; scripts/check.py header main
198+
else
182199
scripts/check.py header main
200+
endif
183201

184202
circleci-container: #: Build the linux container for CircleCi
185203
$(MAKE) linux-container CONTAINER_NAME=circleci

scripts/setup-macos.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ set -x # Print commands that are executed.
3030

3131
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
3232
source $SCRIPTDIR/setup-helper-functions.sh
33+
PYTHON_VENV=${PYHTON_VENV:-"${SCRIPTDIR}/../.venv"}
3334

3435
NPROC=$(getconf _NPROCESSORS_ONLN)
3536

@@ -71,7 +72,11 @@ function install_build_prerequisites {
7172
do
7273
install_from_brew ${pkg}
7374
done
74-
pip3 install --user cmake-format regex pyyaml
75+
if [ ! -f ${PYTHON_VENV}/pyvenv.cfg ]; then
76+
echo "Creating Python Virtual Environment at ${PYTHON_VENV}"
77+
python3 -m venv ${PYTHON_VENV}
78+
fi
79+
source ${PYTHON_VENV}/bin/activate; pip3 install cmake-format regex pyyaml
7580
}
7681

7782
function install_velox_deps_from_brew {

0 commit comments

Comments
 (0)