Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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