@@ -110,11 +110,11 @@ for %%d in (
110110:: Check if the detected version is too old for Python 3.10+
111111if defined MATLAB_FOUND (
112112 set " _VER_OK = "
113- :: Extract year from version string (e.g., R2022b -> 2022)
113+ REM Extract year from version string (e.g., R2022b -> 2022)
114114 set " _MVER = !MATLAB_VER! "
115115 set " _MYEAR = !_MVER:~1 ,4 ! "
116116 set " _MSUF = !_MVER:~5 ,1 ! "
117- :: R2022b+ required: year>2022, or year==2022 and suffix>=b
117+ REM R2022b+ required: year> 2022, or year==2022 and suffix> =b
118118 if !_MYEAR! gtr 2022 set " _VER_OK = 1"
119119 if !_MYEAR! equ 2022 if /i " !_MSUF! " geq " b" set " _VER_OK = 1"
120120 if not defined _VER_OK (
@@ -245,18 +245,15 @@ python -c "import matlab.engine" >nul 2>&1
245245if %errorlevel% equ 0 (
246246 echo MATLAB Engine API already installed. Skipping.
247247) else (
248- :: The MATLAB Engine setup.py finds MATLAB by walking up the directory
249- :: tree from extern\engines\python. We can't build in C:\Program Files
250- :: (read-only), so we recreate the directory structure in %TEMP% and use
251- :: directory junctions (mklink /J, no admin needed) to point back to the
252- :: real MATLAB dirs that setup.py validates.
248+ REM Recreate MATLAB dir structure in TEMP with junctions back to real dirs.
249+ REM setup.py walks up from extern\engines\python to validate the install.
253250 set " ENGINE_TEMP = %TEMP% \matlab_engine_root"
254251 if exist " !ENGINE_TEMP! " rd /s /q " !ENGINE_TEMP! " > nul 2 > nul
255252
256253 echo Preparing MATLAB Engine build directory...
257254 mkdir " !ENGINE_TEMP! \extern\engines" 2 > nul
258255
259- :: Copy only the Python engine source (the part we need to build)
256+ REM Copy only the Python engine source (the part we need to build)
260257 robocopy " !ENGINE_API_DIR! " " !ENGINE_TEMP! \extern\engines\python" /E /NJH /NJS /NFL /NDL /NC /NS /NP > nul 2 > nul
261258 set " _RC = !errorlevel! "
262259 if !_RC! geq 8 (
@@ -265,8 +262,7 @@ if %errorlevel% equ 0 (
265262 goto :install_mcp
266263 )
267264
268- :: Create directory junctions so setup.py can validate the MATLAB install.
269- :: mklink /J does NOT require admin rights (unlike mklink /D).
265+ REM Create directory junctions (mklink /J, no admin needed) for validation
270266 mklink /J " !ENGINE_TEMP! \bin" " !MATLAB_ROOT! \bin" > nul 2 > nul
271267 mklink /J " !ENGINE_TEMP! \extern\include" " !MATLAB_ROOT! \extern\include" > nul 2 > nul
272268 mklink /J " !ENGINE_TEMP! \extern\lib" " !MATLAB_ROOT! \extern\lib" > nul 2 > nul
@@ -289,7 +285,7 @@ if %errorlevel% equ 0 (
289285 ) else (
290286 echo [OK] MATLAB Engine API installed.
291287 )
292- :: Clean up — remove junctions first (rd /s /q follows junctions!)
288+ REM Clean up — remove junctions first (rd /s /q follows junctions!)
293289 if exist " !ENGINE_TEMP! \bin" rmdir " !ENGINE_TEMP! \bin" > nul 2 > nul
294290 if exist " !ENGINE_TEMP! \extern\include" rmdir " !ENGINE_TEMP! \extern\include" > nul 2 > nul
295291 if exist " !ENGINE_TEMP! \extern\lib" rmdir " !ENGINE_TEMP! \extern\lib" > nul 2 > nul
0 commit comments