-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-mmassx.bat
More file actions
65 lines (53 loc) · 1.87 KB
/
Copy pathbuild-mmassx.bat
File metadata and controls
65 lines (53 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@echo off
setlocal enabledelayedexpansion
:: Dynamically determine source path (the folder where this script is located)
set SCRIPT_DIR=%~dp0
set SOURCE_DIR=%SCRIPT_DIR:~0,-1%
set BUILD_DIR=C:\build\mMassX
set ENV_DIR=%BUILD_DIR%\.mmass_env
echo [INFO] Locating conda.bat...
for /f "delims=" %%i in ('where conda.bat 2^>nul') do set "CONDA_BAT=%%i"
if not defined CONDA_BAT (
echo [ERROR] conda.bat not found in PATH.
echo Please ensure Miniconda or Anaconda is installed and "conda" is available in your system PATH.
pause
exit /b 1
)
echo [INFO] Using Conda at: %CONDA_BAT%
echo [1/7] Removing old build folder...
if exist "%BUILD_DIR%" (
rmdir /s /q "%BUILD_DIR%"
)
mkdir "%BUILD_DIR%"
echo [2/7] Copying project from %SOURCE_DIR% to %BUILD_DIR% (excluding .git and .mmass_env) ...
robocopy "%SOURCE_DIR%" "%BUILD_DIR%" /E /XO /XD .git .mmass_env datasets
echo [3/7] Creating Conda environment with Python 3.9.19...
call "%CONDA_BAT%" create -y --prefix "%ENV_DIR%" python=3.9.19
echo [4/7] Installing packages into environment...
call "%CONDA_BAT%" install -y --prefix "%ENV_DIR%" -c conda-forge ^
wxwidgets=3.1.5 ^
wxpython=4.1.1 ^
numpy=1.20.3 ^
pandas=1.3.4 ^
pyinstaller=6.9.0 ^
joblib=1.5.0
echo [5/7] Running PyInstaller build...
cd /d "%BUILD_DIR%"
call "%CONDA_BAT%" activate "%ENV_DIR%"
"%ENV_DIR%\python.exe" -m PyInstaller --clean mmassx.spec
echo [6/7] Verifying build output...
if not exist "%BUILD_DIR%\dist" (
echo [ERROR] Build failed — no 'dist' directory found.
pause
exit /b 1
)
if not exist "%BUILD_DIR%\dist\*.exe" (
echo [ERROR] Build failed — no .exe created.
pause
exit /b 1
)
echo [7/7] Copying .exe files to %SOURCE_DIR%\dist ...
robocopy "%BUILD_DIR%\dist" "%SOURCE_DIR%\dist" *.exe /NFL /NDL /NJH /NJS /NC /NS /NP
echo [OK] Build complete. Executable(s) copied to %SOURCE_DIR%\dist
pause
endlocal