Skip to content

Commit 2ebc280

Browse files
committed
Exit if symlink is not enabled on Windows
1 parent ca31e4c commit 2ebc280

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
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%

setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,6 @@ def run(self):
635635
dst_root = self.get_package_dir(".")
636636
else:
637637
dst_root = os.path.join(self.build_lib, "executorch")
638-
# On Windows the package directory might not exist yet when building from a
639-
# clean tree. Ensure it is created before we attempt to write version.py.
640-
self.mkpath(dst_root)
641638
# Create the version file.
642639
Version.write_to_python_file(os.path.join(dst_root, "version.py"))
643640

0 commit comments

Comments
 (0)