flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.61k stars 455 forks source link

Build files not cleaned up when build fails #4036

Closed torablien closed 1 month ago

torablien commented 2 months ago

Duplicate Check

Describe the bug

When packaging via flet build macos -vv, build files seem to be generated in the directories like /var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/flet_flutter_build_* and /var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_temp*. If the build fails, the serious_python_temp files seem to linger potentially taking up a significant amount of space and not indicating to the user in any way that this exists and needs to be deleted manually.

Code sample

Happens with any app, though naturally this is a bigger problem with larger apps. In my case, I was debugging packaging issues so trying many builds and my serious_python_temp* directory quickly ballooned to > 80GB

To reproduce

Run flet build macos on an app that will fail to build. I ran into this issue while tracing down https://github.com/flet-dev/flet/issues/4007 which is trivially reproducible.

Expected behavior

No response

Screenshots / Videos

No response

Operating System

macOS

Operating system details

M1 Pro Sequioa 15.0 (also repro'd on Sonoma 14.5)

Flet version

0.24.1

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/yarl'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/yarl/__init__.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/yarl/_helpers.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/yarl/_helpers_py.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/yarl/_quoting.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/yarl/_quoting_py.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/yarl/_url.py'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/yarl-1.11.1.dist-info'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/__init__.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/__main__.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/_api.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/_cli.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/_errors.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/_html_unescaping.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/_settings.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/_transcripts.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/formatters.py'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/test'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/test/__init__.py'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/test/assets'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/test/assets/__init__.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/test/test_api.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/test/test_cli.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api/test/test_formatters.py'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/youtube_transcript_api-0.6.2.dist-info'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/zipp'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/zipp/__init__.py'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/zipp/compat'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/zipp/compat/__init__.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/zipp/compat/overlay.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/zipp/compat/py310.py'...
Compiling '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/zipp/glob.py'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/lib/python3.12/site-packages/zipp-3.20.2.dist-info'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/share'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/share/man'...
Listing '/var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV/venv/share/man/man1'...
[18:02:03] Deleting Flutter bootstrap directory /var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/flet_flutter_build_lPOpt2W7RB                                                                                                                            
           Error building Flet app - see the log of failed command above.                                                                                                                                                                                 
           Run subprocess: ['/Users/n/Code/flutter/bin/flutter', 'doctor']                                                                                                                                                                             
[18:02:11] Doctor summary (to see all details, run flutter doctor -v):                                                                                                                                                                                    
           [✓] Flutter (Channel stable, 3.24.3, on macOS 15.0 24A335 darwin-arm64, locale en-US)                                                                                                                                                          
           [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)                                                                                                                                                               
           [!] Xcode - develop for iOS and macOS (Xcode 16.0)                                                                                                                                                                                             
               ✗ Unable to get list of installed Simulator runtimes.                                                                                                                                                                                      
           [✓] Chrome - develop for the web                                                                                                                                                                                                               
           [✓] Android Studio (version 2023.1)                                                                                                                                                                                                            
           [✓] VS Code (version 1.92.0)                                                                                                                                                                                                                   
           [✓] VS Code (version 1.91.0-insider)                                                                                                                                                                                                           
           [✓] Connected device (3 available)                                                                                                                                                                                                             
           [✓] Network resources                                                                                                                                                                                                                          

           ! Doctor found issues in 1 category.                                                                                                                                                                                                           

(venv) n@macbookpro flet-simple-app-test % ls /var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T | grep serious              
serious_python_tempkchiNV
serious_python_tempxRxXWd
(venv) n@macbookpro flet-simple-app-test % du -csh /var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempxRxXWd
 10G    /var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempxRxXWd
 10G    total
(venv) n@macbookpro flet-simple-app-test% du -csh /var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV 
 10G    /var/folders/q1/dcc1rnq13f9fhs4hxd03jqy80000gn/T/serious_python_tempkchiNV
 10G    total

Additional details

No response