File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -145,14 +145,31 @@ if [[ -z "$TOOLCHAIN" ]]; then
145145fi
146146[[ -f " $TOOLCHAIN " ]] || { echo >&2 " Toolchain file $TOOLCHAIN does not exist." ; exit 1; }
147147
148+ BUCK2=$( " $PYTHON " " $SOURCE_ROOT_DIR /tools/cmake/resolve_buck.py" --cache_dir=" $SOURCE_ROOT_DIR /buck2-bin" )
149+
150+ if [[ " $BUCK2 " == " buck2" ]]; then
151+ BUCK2=$( command -v buck2)
152+ fi
153+
148154check_command () {
149- command -v " $1 " > /dev/null 2>&1 || { echo >&2 " $1 is not installed" ; exit 1; }
155+ if [[ " $1 " == * /* ]]; then
156+ if [[ ! -x " $1 " ]]; then
157+ echo " Error: Command not found or not executable at '$1 '" >&2
158+ exit 1
159+ fi
160+ else
161+ if ! command -v " $1 " > /dev/null 2>&1 ; then
162+ echo " Error: Command '$1 ' not found in PATH" >&2
163+ exit 1
164+ fi
165+ fi
150166}
151167
152168check_command cmake
153169check_command rsync
154170check_command " $PYTHON "
155171check_command " $FLATC "
172+ check_command " $BUCK2 "
156173
157174echo " Building libraries"
158175
@@ -205,14 +222,6 @@ echo "Exporting headers"
205222
206223mkdir -p " $HEADERS_PATH "
207224
208- BUCK2=$( " $PYTHON " " $SOURCE_ROOT_DIR /tools/cmake/resolve_buck.py" --cache_dir=" $SOURCE_ROOT_DIR /buck2-bin" )
209- if [[ -z " $BUCK2 " ]]; then
210- echo " Could not find buck2 executable in any buck2-bin directory under $SOURCE_ROOT_DIR "
211- BUCK2=$( which buck2)
212- fi
213-
214- check_command " $BUCK2 "
215-
216225" $SOURCE_ROOT_DIR " /build/print_exported_headers.py --buck2=$( realpath " $BUCK2 " ) --targets \
217226 //extension/module: \
218227 //extension/tensor: \
You can’t perform that action at this time.
0 commit comments