127127# PyInstaller 실행
128128log_info " PyInstaller를 사용하여 VibeCulling 앱 빌드 중..."
129129
130- # spec 파일 완전 제거하고 Python 파일로 직접 빌드
131- log_info " spec 파일 없이 Python 파일로 직접 빌드 시작..."
130+ # spec 파일 생성 완전 방지 - 임시 디렉토리에서 빌드
131+ log_info " 임시 디렉토리에서 spec 파일 없이 빌드 시작..."
132+
133+ # 임시 빌드 디렉토리 생성
134+ TEMP_BUILD_DIR=" /tmp/vibeculling_build_$$ "
135+ mkdir -p " ${TEMP_BUILD_DIR} "
136+ cp VibeCulling.py " ${TEMP_BUILD_DIR} /"
137+ cp -r resources " ${TEMP_BUILD_DIR} /" 2> /dev/null || true
138+ cp app_icon.icns " ${TEMP_BUILD_DIR} /" 2> /dev/null || true
139+ cp version_info.py " ${TEMP_BUILD_DIR} /" 2> /dev/null || true
140+
141+ # 임시 디렉토리에서 빌드 실행
142+ cd " ${TEMP_BUILD_DIR} "
132143pyinstaller \
133144 --name " ${APP_NAME} " \
134145 --windowed \
@@ -137,8 +148,9 @@ pyinstaller \
137148 --noconfirm \
138149 --noupx \
139150 --log-level=INFO \
140- --distpath ./dist \
141- --workpath ./build \
151+ --distpath " ${OLDPWD} /dist" \
152+ --workpath " ${OLDPWD} /build" \
153+ --specpath " ${TEMP_BUILD_DIR} " \
142154 --icon app_icon.icns \
143155 --add-data " app_icon.icns:." \
144156 --add-data " resources:resources" \
@@ -164,7 +176,13 @@ pyinstaller \
164176 --exclude-module unittest \
165177 VibeCulling.py
166178
167- # spec 파일이 생성되었다면 즉시 삭제
179+ # 원래 디렉토리로 돌아가기
180+ cd " ${OLDPWD} "
181+
182+ # 임시 디렉토리 정리
183+ rm -rf " ${TEMP_BUILD_DIR} " 2> /dev/null || true
184+
185+ # 혹시 생성된 spec 파일 삭제
168186rm -f VibeCulling.spec 2> /dev/null || true
169187
170188if [[ $? -ne 0 ]]; then
@@ -181,45 +199,63 @@ if [[ $? -ne 0 ]]; then
181199 # 작업 디렉토리 새로 생성
182200 mkdir -p dist build
183201
184- # 재시도 (spec 파일 완전 제거하고 Python 파일로 직접 빌드)
185- log_info " PyInstaller 재시도 중 (spec 파일 완전 제거)..."
186- pyinstaller \
187- --name " ${APP_NAME} " \
188- --windowed \
189- --clean \
190- --onedir \
191- --noconfirm \
192- --noupx \
193- --log-level=INFO \
194- --distpath ./dist \
195- --workpath ./build \
196- --icon app_icon.icns \
197- --add-data " app_icon.icns:." \
198- --add-data " resources:resources" \
199- --add-data " version_info.py:." \
200- --add-data " ${PY_SIDE_DIR} /platforms:Qt/plugins/platforms" \
201- --add-data " ${PY_SIDE_DIR} /styles:Qt/plugins/styles" \
202- --add-data " ${PY_SIDE_DIR} /imageformats:Qt/plugins/imageformats" \
203- --add-binary " ${EXIFTOOL_BIN} :." \
204- --add-binary " ${LIBRAW_DYLIB} :." \
205- --collect-all PySide6 \
206- --collect-all PIL \
207- --collect-all pillow \
208- --collect-all pillow_heif \
209- --hidden-import=PIL \
210- --hidden-import=PIL.Image \
211- --hidden-import=PIL.ExifTags \
212- --hidden-import=exifread \
213- --hidden-import=rawpy \
214- --exclude-module tkinter \
215- --exclude-module matplotlib \
216- --exclude-module numpy.testing \
217- --exclude-module test \
218- --exclude-module unittest \
219- VibeCulling.py
220-
221- # spec 파일이 생성되었다면 즉시 삭제
222- rm -f VibeCulling.spec 2> /dev/null || true
202+ # 재시도 (임시 디렉토리에서 spec 파일 생성 방지)
203+ log_info " PyInstaller 재시도 중 (임시 디렉토리 사용)..."
204+
205+ # 재시도용 임시 빌드 디렉토리 생성
206+ RETRY_TEMP_BUILD_DIR=" /tmp/vibeculling_retry_build_$$ "
207+ mkdir -p " ${RETRY_TEMP_BUILD_DIR} "
208+ cp VibeCulling.py " ${RETRY_TEMP_BUILD_DIR} /"
209+ cp -r resources " ${RETRY_TEMP_BUILD_DIR} /" 2> /dev/null || true
210+ cp app_icon.icns " ${RETRY_TEMP_BUILD_DIR} /" 2> /dev/null || true
211+ cp version_info.py " ${RETRY_TEMP_BUILD_DIR} /" 2> /dev/null || true
212+
213+ # 임시 디렉토리에서 재시도 빌드 실행
214+ cd " ${RETRY_TEMP_BUILD_DIR} "
215+ pyinstaller \
216+ --name " ${APP_NAME} " \
217+ --windowed \
218+ --clean \
219+ --onedir \
220+ --noconfirm \
221+ --noupx \
222+ --log-level=INFO \
223+ --distpath " ${OLDPWD} /dist" \
224+ --workpath " ${OLDPWD} /build" \
225+ --specpath " ${RETRY_TEMP_BUILD_DIR} " \
226+ --icon app_icon.icns \
227+ --add-data " app_icon.icns:." \
228+ --add-data " resources:resources" \
229+ --add-data " version_info.py:." \
230+ --add-data " ${PY_SIDE_DIR} /platforms:Qt/plugins/platforms" \
231+ --add-data " ${PY_SIDE_DIR} /styles:Qt/plugins/styles" \
232+ --add-data " ${PY_SIDE_DIR} /imageformats:Qt/plugins/imageformats" \
233+ --add-binary " ${EXIFTOOL_BIN} :." \
234+ --add-binary " ${LIBRAW_DYLIB} :." \
235+ --collect-all PySide6 \
236+ --collect-all PIL \
237+ --collect-all pillow \
238+ --collect-all pillow_heif \
239+ --hidden-import=PIL \
240+ --hidden-import=PIL.Image \
241+ --hidden-import=PIL.ExifTags \
242+ --hidden-import=exifread \
243+ --hidden-import=rawpy \
244+ --exclude-module tkinter \
245+ --exclude-module matplotlib \
246+ --exclude-module numpy.testing \
247+ --exclude-module test \
248+ --exclude-module unittest \
249+ VibeCulling.py
250+
251+ # 원래 디렉토리로 돌아가기
252+ cd " ${OLDPWD} "
253+
254+ # 재시도용 임시 디렉토리 정리
255+ rm -rf " ${RETRY_TEMP_BUILD_DIR} " 2> /dev/null || true
256+
257+ # 혹시 생성된 spec 파일 삭제
258+ rm -f VibeCulling.spec 2> /dev/null || true
223259 if [[ $? -ne 0 ]]; then
224260 log_error " PyInstaller 재시도도 실패"
225261 exit 1
0 commit comments