Skip to content

Commit

Permalink
Fix PyInstaller hook to avoid download Flet app bundle on first run (#…
Browse files Browse the repository at this point in the history
…4552)

* Fix PyInstaller hook to avoid download Flet app bundle on first run

Fix #4549

* Fix web job
  • Loading branch information
FeodorFitsner authored Dec 12, 2024
1 parent 12f2490 commit be58db6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ for:

install:
- . ci/common.sh
- flutter upgrade --force
- source ci/install_flutter.sh

build_script:
# Flutter Web client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@
bin_path = get_flet_bin_path()

if bin_path:
# package "bin/fletd" only
if os.getenv("PACKAGE_FLETD_ONLY"):
bin_path = os.path.join(bin_path, "fletd*")

datas = [(bin_path, "flet/bin")]
datas = [(bin_path, "flet_desktop/app")]
8 changes: 5 additions & 3 deletions sdk/python/packages/flet-desktop/src/flet_desktop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import zipfile
from pathlib import Path

import flet_desktop
import flet_desktop.version
from flet.utils import (
get_arch,
is_linux,
Expand All @@ -18,9 +20,6 @@
safe_tar_extractall,
)

import flet_desktop
import flet_desktop.version

logger = logging.getLogger(flet_desktop.__name__)


Expand Down Expand Up @@ -74,6 +73,7 @@ def __locate_and_unpack_flet_view(page_url, assets_dir, hidden):

# check if flet_view.exe exists in "bin" directory (user mode)
flet_path = os.path.join(get_package_bin_dir(), "flet", flet_exe)
logger.info(f"Looking for Flet executable at: {flet_path}")
if os.path.exists(flet_path):
logger.info(f"Flet View found in: {flet_path}")
else:
Expand Down Expand Up @@ -109,6 +109,7 @@ def __locate_and_unpack_flet_view(page_url, assets_dir, hidden):
# check if flet.tar.gz exists
gz_filename = "flet-macos.tar.gz"
tar_file = os.path.join(get_package_bin_dir(), gz_filename)
logger.info(f"Looking for Flet.app archive at: {tar_file}")
if not os.path.exists(tar_file):
tar_file = __download_flet_client(gz_filename)

Expand Down Expand Up @@ -145,6 +146,7 @@ def __locate_and_unpack_flet_view(page_url, assets_dir, hidden):
# check if flet.tar.gz exists
gz_filename = f"flet-linux-{get_arch()}.tar.gz"
tar_file = os.path.join(get_package_bin_dir(), gz_filename)
logger.info(f"Looking for Flet bundle archive at: {tar_file}")
if not os.path.exists(tar_file):
tar_file = __download_flet_client(gz_filename)

Expand Down

0 comments on commit be58db6

Please sign in to comment.