@@ -23,6 +23,19 @@ if exist %CLONEDIR% ( rmdir /s /q %CLONEDIR% )
2323git clone -l -s . %CLONEDIR%
2424pushd %CLONEDIR%
2525
26+ @ REM Backup PYTHONPATH
27+ set OLD_PYTHONPATH = %PYTHONPATH%
28+ @ REM Make a new virtual environment for building the executable
29+ set VENV_DIR = %REPODIR% \..\%LIBNAME% -temp-venv
30+ if exist %VENV_DIR% ( rmdir /s /q %VENV_DIR% )
31+ %PYTHON% -m venv %VENV_DIR%
32+ set PYTHON = %VENV_DIR% \Scripts\python.exe
33+ set PYTHONPATH = %CLONEDIR%
34+ @ REM Install required packages in the virtual environment
35+ %PYTHON% -m pip install --upgrade pip setuptools wheel
36+ @ REM Install DataLab and its dependencies
37+ %PYTHON% -m pip install .[exe]
38+
2639@ REM Generating icon
2740set INKSCAPE_PATH = " C:\Program Files\Inkscape\bin\inkscape.exe"
2841set RESPATH = %CLONEDIR% \resources
@@ -33,7 +46,7 @@ magick "%RESPATH%\tmp-*.png" "%RESPATH%\DataLab.ico"
3346del " %RESPATH% \tmp-*.png"
3447
3548@ REM Building executable
36- pyinstaller DataLab.spec --noconfirm --clean
49+ %PYTHON% -m PyInstaller DataLab.spec --noconfirm --clean
3750
3851@ REM Windows 7 SP1 compatibility fix
3952copy " %RESPATH% \api-ms-win-core-path-l1-1-0.dll" " dist\DataLab\_internal" /Y
@@ -50,5 +63,10 @@ move %CLONEDIR%\dist\%ZIPNAME% %REPODIR%\dist
5063@ REM Move generated folder to dist directory
5164move %CLONEDIR% \dist\DataLab %REPODIR% \dist
5265
66+ @ REM Cleanup temporary directories
5367rmdir /s /q %CLONEDIR%
68+ rmdir /s /q %VENV_DIR%
69+ @ REM Restore PYTHONPATH
70+ set PYTHONPATH = %OLD_PYTHONPATH%
71+
5472call %FUNC% EndOfScript
0 commit comments