File size: 3,537 Bytes
84fc8e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
@echo off
setlocal enabledelayedexpansion

echo ========================================
echo AI File Converter Pro - Build Script
echo ========================================
echo.



REM Check Python/pyinstaller availability
echo [0/4] Checking build tools...
where pyinstaller >nul 2>&1
if %errorlevel% neq 0 (
    echo ERROR: PyInstaller not found! Install with: pip install pyinstaller
    pause
    exit /b 1
)



REM Clean previous builds
echo [1/4] Cleaning previous builds...
if exist build rmdir /s /q build
if exist dist rmdir /s /q dist
if exist *.spec del /q *.spec
echo Clean complete.



REM Run PyInstaller with better options
echo [2/4] Creating executable with PyInstaller...
echo This may take several minutes...



REM Use --collect-all for problematic packages and --hidden-import for missing modules
pyinstaller --noconsole --onefile ^
    --icon=logo.ico ^
    --name="AIFileConverter" ^
    --hidden-import=pycparser.lextab ^
    --hidden-import=pycparser.yacctab ^
    --hidden-import=scipy.special._cdflib ^
    --collect-all=torch ^
    --collect-all=transformers ^
    --collect-all=cv2 ^
    --add-data="logo.ico;." ^
    main.py

if !errorlevel! neq 0 (
    echo ERROR: PyInstaller failed with error !errorlevel!
    pause
    exit /b !errorlevel!
)



REM Check if executable was created
if not exist "dist\AIFileConverter.exe" (
    echo ERROR: Executable not found at dist\AIFileConverter.exe!
    pause
    exit /b 1
)



REM Get executable size for info
for %%A in ("dist\AIFileConverter.exe") do (
    set EXE_SIZE=%%~zA
    set /a EXE_SIZE_MB=!EXE_SIZE!/1048576
    echo Executable size: !EXE_SIZE_MB! MB
)



REM Create installer with Inno Setup
echo [3/4] Creating installer with Inno Setup...



REM Check if Inno Setup installer script exists
if not exist "setup_advanced.iss" (
    echo WARNING: setup_advanced.iss not found in current directory!
    echo Listing current directory contents:
    dir *.iss 2>nul
    echo.
    echo Please ensure setup_advanced.iss exists.
    pause
    exit /b 1
)



REM Try to find Inno Setup compiler
set ISCC_PATH=
if exist "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" set ISCC_PATH=C:\Program Files (x86)\Inno Setup 6\ISCC.exe
if exist "C:\Program Files\Inno Setup 6\ISCC.exe" set ISCC_PATH=C:\Program Files\Inno Setup 6\ISCC.exe
if exist "C:\Program Files (x86)\Inno Setup 7\ISCC.exe" set ISCC_PATH=C:\Program Files (x86)\Inno Setup 7\ISCC.exe
if exist "C:\Program Files\Inno Setup 7\ISCC.exe" set ISCC_PATH=C:\Program Files\Inno Setup 7\ISCC.exe

if "%ISCC_PATH%"=="" (
    echo ERROR: Inno Setup not found!
    echo Please install Inno Setup from: https://jrsoftware.org/isdl.php
    echo Or place ISCC.exe in your PATH.
    pause
    exit /b 1
)

echo Using Inno Setup at: %ISCC_PATH%
"%ISCC_PATH%" setup_advanced.iss

if !errorlevel! neq 0 (
    echo ERROR: Inno Setup compilation failed with error !errorlevel!
    pause
    exit /b !errorlevel!
)



REM Check if installer was created
if exist "InstallerOutput\AI_File_Converter_Pro_v2.0_Setup.exe" (
    echo.
    echo [4/4] Build completed successfully!
    echo.
    echo ========================================
    echo Installer created: InstallerOutput\AI_File_Converter_Pro_v2.0_Setup.exe
    echo ========================================
) else (
    echo WARNING: Build completed but installer not found at expected location!
    echo Check Inno Setup output for actual location.
)

echo.
pause