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

The code architecture require improve #529

Closed
lin-calvin opened this issue Oct 28, 2022 · 10 comments
Closed

The code architecture require improve #529

lin-calvin opened this issue Oct 28, 2022 · 10 comments

Comments

@lin-calvin
Copy link
Contributor

lin-calvin commented Oct 28, 2022

Rencently, i road the code of this project, but I found there are several things can be done in a more beautiful way
Firstly, fletd will be download by the code when the first time run. however,pipy can distribute the packages for each system and architecture, so the you needn't download it by your self, just bundle them into the package, (see flet.py,line 284)
Secondly, the flet client has the same problem to the fletd and it will be decompression everytime that system boot on linux, because /tmp is a "ramdisk" on most linux. so, just put the uncompression client files into the package this will make it start faster
In addition could you add a full api reference?
(Sorry for my English)

@liudonghua123
Copy link

fletd or flet is already bundled with the packaged flet*.whl file.

p = Path(__file__).parent.joinpath("bin", fletd_exe)
if p.exists():
fletd_path = str(p)
logging.info(f"Flet Server found in: {fletd_path}")
else:
# check if flet.exe is in PATH (flet developer mode)
fletd_path = which(fletd_exe)
if not fletd_path:
# download flet from GitHub (python module developer mode)
fletd_path = _download_fletd()
else:
logging.info(f"Flet Server found in PATH")

flet_exe = "flet.exe"
temp_flet_dir = Path(tempfile.gettempdir()).joinpath(f"flet-{version.version}")
# check if flet_view.exe exists in "bin" directory (user mode)
p = Path(__file__).parent.joinpath("bin", "flet", flet_exe)
if p.exists():
flet_path = str(p)
logging.info(f"Flet View found in: {flet_path}")

image

@lin-calvin
Copy link
Contributor Author

fletd or flet is already bundled with the packaged flet*.whl file.

p = Path(__file__).parent.joinpath("bin", fletd_exe)
if p.exists():
fletd_path = str(p)
logging.info(f"Flet Server found in: {fletd_path}")
else:
# check if flet.exe is in PATH (flet developer mode)
fletd_path = which(fletd_exe)
if not fletd_path:
# download flet from GitHub (python module developer mode)
fletd_path = _download_fletd()
else:
logging.info(f"Flet Server found in PATH")

flet_exe = "flet.exe"
temp_flet_dir = Path(tempfile.gettempdir()).joinpath(f"flet-{version.version}")
# check if flet_view.exe exists in "bin" directory (user mode)
p = Path(__file__).parent.joinpath("bin", "flet", flet_exe)
if p.exists():
flet_path = str(p)
logging.info(f"Flet View found in: {flet_path}")

image

oh,I forgot to check this, i will make a strikethrough for it, however,the second still require a fix.

@FeodorFitsner
Copy link
Contributor

FeodorFitsner commented Oct 28, 2022

That's all related to #161

First, it's not a good solution to unpack Flet client to a temp folder. Will be fixed in the next release.
Second, the decision to keep Flet client's .tar.gz inside .zip was made because ZIP archives (and .whl is a regular ZIP) do not preserve original file attributes such as "executable". However, I'll explore if it's feasible to do chmod instead of unpacking.

@FeodorFitsner
Copy link
Contributor

Maybe I'm not right regarding attributes inside zip. I'm verifying that.

@FeodorFitsner
Copy link
Contributor

Anyway, let's close this issue in favour of #161

@FeodorFitsner
Copy link
Contributor

No, I was wrong! The problem is not permissions, but symlinks. macOS application bundle (Flet.app) has symlinked directories/files inside and .zip does not support symlinks, but .tar.gz does.

@lin-calvin
Copy link
Contributor Author

lin-calvin commented Oct 29, 2022

No, I was wrong! The problem is not permissions, but symlinks. macOS application bundle (Flet.app) has symlinked directories/files inside and .zip does not support symlinks, but .tar.gz does.

but why but a bundle inside package?i think put the file directly will be better

@FeodorFitsner
Copy link
Contributor

What do you mean by "file"?

@lin-calvin
Copy link
Contributor Author

lin-calvin commented Oct 29, 2022

What do you mean by "file"?

the flet client(for example flet-linux-arm64.tar.gz on a arm system)

@FeodorFitsner
Copy link
Contributor

On macOS Flutter produces a bundle, not a single executable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants