Repository navigation
Expand file tree
/
Copy pathbuild_standalone.bat
More file actions
173 lines (150 loc) Β· 4.66 KB
/
Copy pathbuild_standalone.bat
File metadata and controls
173 lines (150 loc) Β· 4.66 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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@echo off
setlocal enabledelayedexpansion
echo.
echo =======================================
echo π§ Python Thinker Standalone Builder
echo =======================================
echo.
REM Check if Python is available
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo β Python is not installed or not in your PATH
echo Please install Python and try again
pause
exit /b 1
)
echo β
Python found
python --version
REM Check if PyInstaller is installed
echo.
echo π Checking for PyInstaller...
python -m PyInstaller --version >nul 2>&1
if %errorlevel% neq 0 (
echo β PyInstaller not found
echo π¦ Installing PyInstaller...
python -m pip install pyinstaller
if !errorlevel! neq 0 (
echo β Failed to install PyInstaller
pause
exit /b 1
)
echo β
PyInstaller installed successfully
) else (
echo β
PyInstaller found
)
REM Clean previous builds
echo.
echo π§Ή Cleaning previous builds...
if exist "dist" rmdir /s /q "dist"
if exist "build" rmdir /s /q "build"
if exist "PythonThinker.spec" del "PythonThinker.spec"
REM Build the executable
echo.
echo π¨ Building standalone executable...
REM Base PyInstaller command
set "cmd=python -m PyInstaller --onefile --name=PythonThinker --distpath=dist --workpath=build --specpath=. launcher.py"
REM Add data files if they exist
if exist "demo_thoughts.json" (
set "cmd=!cmd! --add-data=demo_thoughts.json;."
)
if exist "workflow_demo.json" (
set "cmd=!cmd! --add-data=workflow_demo.json;."
)
REM Add icon if it exists
if exist "icon.ico" (
set "cmd=!cmd! --icon=icon.ico"
)
REM Execute the build command
!cmd!
if %errorlevel% neq 0 (
echo β Build failed!
pause
exit /b 1
)
echo β
Executable built successfully!
REM Create portable package
echo.
echo π¦ Creating portable package...
set "packageDir=PythonThinker_Portable"
REM Remove existing package directory
if exist "%packageDir%" rmdir /s /q "%packageDir%"
mkdir "%packageDir%"
REM Copy executable
if exist "dist\PythonThinker.exe" (
copy "dist\PythonThinker.exe" "%packageDir%"
echo β
Copied executable to %packageDir%
) else (
echo β Executable not found!
pause
exit /b 1
)
REM Copy documentation and demo files
if exist "README.md" (
copy "README.md" "%packageDir%"
echo β
Copied README.md
)
if exist "demo_thoughts.json" (
copy "demo_thoughts.json" "%packageDir%"
echo β
Copied demo_thoughts.json
)
if exist "workflow_demo.json" (
copy "workflow_demo.json" "%packageDir%"
echo β
Copied workflow_demo.json
)
REM Create a batch file to run the app
echo @echo off > "%packageDir%\Start_PythonThinker.bat"
echo echo. >> "%packageDir%\Start_PythonThinker.bat"
echo echo ======================================= >> "%packageDir%\Start_PythonThinker.bat"
echo echo π§ Python Thinker App (Portable) >> "%packageDir%\Start_PythonThinker.bat"
echo echo ======================================= >> "%packageDir%\Start_PythonThinker.bat"
echo echo. >> "%packageDir%\Start_PythonThinker.bat"
echo echo Starting Python Thinker... >> "%packageDir%\Start_PythonThinker.bat"
echo echo. >> "%packageDir%\Start_PythonThinker.bat"
echo PythonThinker.exe >> "%packageDir%\Start_PythonThinker.bat"
echo echo. >> "%packageDir%\Start_PythonThinker.bat"
echo echo Application closed. >> "%packageDir%\Start_PythonThinker.bat"
echo pause >> "%packageDir%\Start_PythonThinker.bat"
echo β
Created Start_PythonThinker.bat
REM Create portable README
(
echo # Python Thinker - Portable Version
echo.
echo This is a standalone version of Python Thinker that doesn't require Python to be installed.
echo.
echo ## How to Run
echo.
echo ### Option 1: Double-click the executable
echo - Double-click `PythonThinker.exe` to start the application
echo.
echo ### Option 2: Use the batch file
echo - Double-click `Start_PythonThinker.bat` for a better experience
echo.
echo ## Features
echo.
echo - Complete Python Thinker functionality
echo - No Python installation required
echo - Portable - copy this folder to any Windows computer
echo - All your data is saved in the same folder
echo.
echo ## Data Storage
echo.
echo Your thoughts and sessions are automatically saved to `thoughts.json` in this folder.
echo You can backup this file to preserve your data.
echo.
echo ## System Requirements
echo.
echo - Windows 7 or later
echo - No other software required!
) > "%packageDir%\PORTABLE_README.md"
echo β
Created PORTABLE_README.md
echo.
echo π Build complete!
echo.
echo You now have:
echo 1. Single executable: dist\PythonThinker.exe
echo 2. Portable package: %packageDir%\
echo.
echo The portable package can be copied to any Windows computer
echo and run without installing Python!
echo.
pause