Skip to content

Commit 6e2a46b

Browse files
authored
Error out if git symlink not enabled on Windows (#15684)
When I install executorch on windows I run into this error: error: [Errno 2] No such file or directory: 'pip-out\\lib.win-amd64-cpython-312\\executorch\\version.py' This is because we are not enabling symlink in git. Need to run: ``` git config --global core.symlinks true ``` and reclone the repo. This PR fails the installation when that happens.
1 parent c8e9684 commit 6e2a46b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

install_executorch.bat

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@ECHO OFF
2+
setlocal EnableDelayedExpansion
23

34
rem Copyright (c) Meta Platforms, Inc. and affiliates.
45
rem All rights reserved.
@@ -7,9 +8,24 @@ rem This batch file provides a basic functionality similar to the bash script.
78

89
cd /d "%~dp0"
910

11+
rem Verify that Git checked out symlinks correctly. Without this the Python install
12+
rem will fail when attempting to copy files from src\executorch.
13+
where git >NUL 2>&1
14+
if not errorlevel 1 (
15+
set "GIT_SYMLINKS="
16+
for /f "usebackq delims=" %%i in (`git config --get core.symlinks 2^>nul`) do set "GIT_SYMLINKS=%%i"
17+
if /I not "!GIT_SYMLINKS!"=="true" (
18+
echo ExecuTorch requires Git symlink support on Windows.
19+
echo Enable Developer Mode and run: git config --global core.symlinks true
20+
echo Re-clone the repository after enabling symlinks, then rerun install_executorch.bat.
21+
exit /b 1
22+
)
23+
)
24+
1025
rem Under windows, it's always python
1126
set PYTHON_EXECUTABLE=python
1227

1328
"%PYTHON_EXECUTABLE%" install_executorch.py %*
1429

15-
exit /b %ERRORLEVEL%
30+
set "EXIT_CODE=%ERRORLEVEL%"
31+
endlocal & exit /b %EXIT_CODE%

0 commit comments

Comments
 (0)