Skip to content

Commit

Permalink
Add python venv to setup-macos.sh and Makefile (facebookincubator#10668)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
majetideepak authored and facebook-github-bot committed Aug 12, 2024
1 parent 5f32870 commit 23c862e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ autoconf/autom4te.cache
projects/*
!projects/*.*
!projects/Makefile

.venv

#==============================================================================#
# Autotools artifacts
Expand Down
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
# limitations under the License.
.PHONY: all cmake build clean debug release unit

SHELL=/bin/bash
BUILD_BASE_DIR=_build
BUILD_DIR=release
BUILD_TYPE=Release
BENCHMARKS_BASIC_DIR=$(BUILD_BASE_DIR)/$(BUILD_DIR)/velox/benchmarks/basic/
BENCHMARKS_DUMP_DIR=dumps
TREAT_WARNINGS_AS_ERRORS ?= 1
ENABLE_WALL ?= 1
PYTHON_VENV ?= .venv

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

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

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

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

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

circleci-container: #: Build the linux container for CircleCi
$(MAKE) linux-container CONTAINER_NAME=circleci
Expand Down
7 changes: 6 additions & 1 deletion scripts/setup-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set -x # Print commands that are executed.

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

NPROC=$(getconf _NPROCESSORS_ONLN)

Expand Down Expand Up @@ -71,7 +72,11 @@ function install_build_prerequisites {
do
install_from_brew ${pkg}
done
pip3 install --user cmake-format regex pyyaml
if [ ! -f ${PYTHON_VENV}/pyvenv.cfg ]; then
echo "Creating Python Virtual Environment at ${PYTHON_VENV}"
python3 -m venv ${PYTHON_VENV}
fi
source ${PYTHON_VENV}/bin/activate; pip3 install cmake-format regex pyyaml
}

function install_velox_deps_from_brew {
Expand Down

0 comments on commit 23c862e

Please sign in to comment.