Skip to content

Commit b1870f1

Browse files
acvictorfacebook-github-bot
authored andcommitted
build: Install packages and modules for format (#11649)
Summary: Install regex, cmake-format and clang-format. make format-fix on a fresh Ubuntu installation returns ``` scripts/check.py format main --fix Traceback (most recent call last): File "/home/av/src/Velox/scripts/check.py", line 20, in <module> import regex ModuleNotFoundError: No module named 'regex' make: *** [Makefile:172: format-fix] Error 1 /bin/sh: 1: cmake-format: not found error: cannot find executable "clang-format" ``` Pull Request resolved: #11649 Reviewed By: kKPulla Differential Revision: D67881970 Pulled By: kevinwilfong fbshipit-source-id: ff061733efb7ba048adcf6a394969743f4d9ae81
1 parent 4d87e3b commit b1870f1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

scripts/setup-ubuntu.sh

+16-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ USE_CLANG="${USE_CLANG:-false}"
4343
export INSTALL_PREFIX=${INSTALL_PREFIX:-"/usr/local"}
4444
DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)/deps-download}
4545
VERSION=$(cat /etc/os-release | grep VERSION_ID)
46+
PYTHON_VENV=${PYTHON_VENV:-"${SCRIPTDIR}/../.venv"}
4647

4748
# On Ubuntu 20.04 dependencies need to be built using gcc11.
4849
# On Ubuntu 22.04 gcc11 is already the system gcc installed.
@@ -94,7 +95,12 @@ function install_build_prerequisites {
9495
git \
9596
pkg-config \
9697
wget
97-
98+
99+
if [ ! -f ${PYTHON_VENV}/pyvenv.cfg ]; then
100+
echo "Creating Python Virtual Environment at ${PYTHON_VENV}"
101+
python3 -m venv ${PYTHON_VENV}
102+
fi
103+
source ${PYTHON_VENV}/bin/activate;
98104
# Install to /usr/local to make it available to all users.
99105
${SUDO} pip3 install cmake==3.28.3
100106

@@ -106,6 +112,14 @@ function install_build_prerequisites {
106112

107113
}
108114

115+
# Install packages required to fix format
116+
function install_format_prerequisites {
117+
pip3 install regex
118+
${SUDO} apt install -y \
119+
clang-format \
120+
cmake-format
121+
}
122+
109123
# Install packages required for build.
110124
function install_velox_deps_from_apt {
111125
${SUDO} apt update
@@ -287,6 +301,7 @@ function install_velox_deps {
287301

288302
function install_apt_deps {
289303
install_build_prerequisites
304+
install_format_prerequisites
290305
install_velox_deps_from_apt
291306
}
292307

0 commit comments

Comments
 (0)