flet-desktop 1.1.0.dev1__tar.gz → 1.1.0.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-desktop
3
- Version: 1.1.0.dev1
3
+ Version: 1.1.0.dev2
4
4
  Summary: Flet Desktop client in Flutter
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/flet-dev/flet
9
9
  Project-URL: Documentation, https://flet.dev/docs
10
10
  Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: flet==1.1.0.dev1
12
+ Requires-Dist: flet==1.1.0.dev2
13
13
  Requires-Dist: rich>=13.0.0
14
14
 
15
15
  # Flet Desktop client in Flutter
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "flet-desktop"
3
- version = "1.1.0.dev1"
3
+ version = "1.1.0.dev2"
4
4
  description = "Flet Desktop client in Flutter"
5
5
  authors = [{ name = "Appveyor Systems Inc.", email = "hello@flet.dev" }]
6
6
  license = "Apache-2.0"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.10"
9
9
  dependencies = [
10
- "flet==1.1.0.dev1",
10
+ "flet==1.1.0.dev2",
11
11
  "rich >=13.0.0"
12
12
  ]
13
13
 
@@ -35,13 +35,13 @@ logger = logging.getLogger(flet_desktop.__name__)
35
35
 
36
36
  # Supported Linux build targets ordered by glibc version.
37
37
  # Each entry maps a minimum glibc (major, minor) to a distro_id used in
38
- # release artifact filenames.
38
+ # release artifact filenames, and the architectures it is built for.
39
39
  _GLIBC_DISTRO_TABLE = [
40
- ((2, 28), "debian10"),
41
- ((2, 31), "ubuntu20.04"),
42
- ((2, 35), "ubuntu22.04"),
43
- ((2, 36), "debian12"),
44
- ((2, 39), "ubuntu24.04"),
40
+ ((2, 28), "debian10", ("amd64",)),
41
+ ((2, 31), "ubuntu20.04", ("amd64", "arm64")),
42
+ ((2, 35), "ubuntu22.04", ("amd64", "arm64")),
43
+ ((2, 36), "debian12", ("amd64", "arm64")),
44
+ ((2, 39), "ubuntu24.04", ("amd64", "arm64")),
45
45
  ]
46
46
 
47
47
 
@@ -117,29 +117,46 @@ def __get_system_glibc_version():
117
117
  return (0, 0)
118
118
 
119
119
 
120
- def __get_linux_distro_id():
120
+ def __get_linux_distro_id(arch: str):
121
121
  """
122
122
  Return the distro id to use for downloading the Linux binary archive.
123
123
 
124
124
  Uses glibc version detection to pick the best matching build target
125
- (highest glibc requirement that is <= system glibc). Can be
125
+ for `arch` (highest glibc requirement that is <= system glibc). Can be
126
126
  overridden via the `FLET_LINUX_DISTRO` environment variable.
127
+
128
+ Raises:
129
+ RuntimeError: If the system glibc is older than every build for `arch`.
127
130
  """
128
131
 
129
132
  override = os.environ.get("FLET_LINUX_DISTRO", "").strip()
130
133
  if override:
131
134
  return override
132
135
 
136
+ targets = [
137
+ (required_glibc, distro_id)
138
+ for required_glibc, distro_id, arches in _GLIBC_DISTRO_TABLE
139
+ if arch in arches
140
+ ]
141
+ if not targets:
142
+ raise RuntimeError(f"Flet desktop client is not available for Linux {arch}.")
133
143
  sys_glibc = __get_system_glibc_version()
134
144
  best = None
135
- for required_glibc, distro_id in _GLIBC_DISTRO_TABLE:
145
+ for required_glibc, distro_id in targets:
136
146
  if sys_glibc >= required_glibc:
137
147
  best = distro_id
138
148
  if best is None:
139
- best = _GLIBC_DISTRO_TABLE[0][1] # oldest as last resort
140
- logger.warning(
141
- f"Could not detect glibc version (got {sys_glibc}), "
142
- f"falling back to {best}. Set FLET_LINUX_DISTRO to override."
149
+ oldest_glibc, oldest = targets[0]
150
+ if sys_glibc == (0, 0):
151
+ logger.warning(
152
+ "Could not detect glibc version, "
153
+ f"falling back to {oldest}. Set FLET_LINUX_DISTRO to override."
154
+ )
155
+ return oldest
156
+ raise RuntimeError(
157
+ f"Flet desktop client for Linux {arch} requires glibc "
158
+ f"{oldest_glibc[0]}.{oldest_glibc[1]} or newer, "
159
+ f"but this system has glibc {sys_glibc[0]}.{sys_glibc[1]}."
143
160
  )
144
161
  return best
145
162
 
@@ -158,8 +175,8 @@ def get_artifact_filename():
158
175
  if is_macos():
159
176
  return "flet-macos.tar.gz"
160
177
  # Linux
161
- distro = __get_linux_distro_id()
162
178
  arch = get_arch()
179
+ distro = __get_linux_distro_id(arch)
163
180
  flavor = __get_desktop_flavor()
164
181
  if flavor == "light":
165
182
  return f"flet-linux-{distro}-light-{arch}.tar.gz"
@@ -0,0 +1 @@
1
+ version = "1.1.0.dev2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-desktop
3
- Version: 1.1.0.dev1
3
+ Version: 1.1.0.dev2
4
4
  Summary: Flet Desktop client in Flutter
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/flet-dev/flet
9
9
  Project-URL: Documentation, https://flet.dev/docs
10
10
  Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: flet==1.1.0.dev1
12
+ Requires-Dist: flet==1.1.0.dev2
13
13
  Requires-Dist: rich>=13.0.0
14
14
 
15
15
  # Flet Desktop client in Flutter
@@ -7,4 +7,5 @@ src/flet_desktop.egg-info/PKG-INFO
7
7
  src/flet_desktop.egg-info/SOURCES.txt
8
8
  src/flet_desktop.egg-info/dependency_links.txt
9
9
  src/flet_desktop.egg-info/requires.txt
10
- src/flet_desktop.egg-info/top_level.txt
10
+ src/flet_desktop.egg-info/top_level.txt
11
+ tests/test_linux_client_artifact.py
@@ -0,0 +1,2 @@
1
+ flet==1.1.0.dev2
2
+ rich>=13.0.0
@@ -0,0 +1,62 @@
1
+ """Choosing the Linux desktop client to download.
2
+
3
+ The client is built against several glibc versions, but not every one of
4
+ them for every architecture: there is no Debian 10 (glibc 2.28) build for
5
+ arm64, so an arm64 system with an older glibc has no client to run.
6
+ """
7
+
8
+ import pytest
9
+
10
+ import flet_desktop
11
+
12
+
13
+ @pytest.fixture
14
+ def linux(monkeypatch):
15
+ monkeypatch.delenv("FLET_LINUX_DISTRO", raising=False)
16
+ monkeypatch.setattr(flet_desktop, "is_windows", lambda: False)
17
+ monkeypatch.setattr(flet_desktop, "is_macos", lambda: False)
18
+ monkeypatch.setattr(flet_desktop, "__get_desktop_flavor", lambda: "full")
19
+
20
+ def configure(arch, glibc):
21
+ monkeypatch.setattr(flet_desktop, "get_arch", lambda: arch)
22
+ monkeypatch.setattr(flet_desktop, "__get_system_glibc_version", lambda: glibc)
23
+
24
+ return configure
25
+
26
+
27
+ @pytest.mark.parametrize(
28
+ "arch, glibc, filename",
29
+ [
30
+ ("amd64", (2, 28), "flet-linux-debian10-amd64.tar.gz"),
31
+ ("amd64", (2, 31), "flet-linux-ubuntu20.04-amd64.tar.gz"),
32
+ ("arm64", (2, 31), "flet-linux-ubuntu20.04-arm64.tar.gz"),
33
+ ("arm64", (2, 36), "flet-linux-debian12-arm64.tar.gz"),
34
+ ("arm64", (2, 41), "flet-linux-ubuntu24.04-arm64.tar.gz"),
35
+ ],
36
+ )
37
+ def test_picks_newest_build_the_system_can_run(linux, arch, glibc, filename):
38
+ linux(arch, glibc)
39
+ assert flet_desktop.get_artifact_filename() == filename
40
+
41
+
42
+ def test_arm64_with_glibc_older_than_any_arm64_build_fails(linux):
43
+ linux("arm64", (2, 28))
44
+ with pytest.raises(RuntimeError, match=r"Linux arm64 requires glibc 2\.31"):
45
+ flet_desktop.get_artifact_filename()
46
+
47
+
48
+ def test_undetected_glibc_falls_back_to_oldest_build_for_arch(linux):
49
+ linux("arm64", (0, 0))
50
+ assert flet_desktop.get_artifact_filename() == "flet-linux-ubuntu20.04-arm64.tar.gz"
51
+
52
+
53
+ def test_architecture_without_builds_fails(linux):
54
+ linux("arm_7", (2, 36))
55
+ with pytest.raises(RuntimeError, match="not available for Linux arm_7"):
56
+ flet_desktop.get_artifact_filename()
57
+
58
+
59
+ def test_flet_linux_distro_overrides_detection(linux, monkeypatch):
60
+ linux("arm64", (2, 28))
61
+ monkeypatch.setenv("FLET_LINUX_DISTRO", "debian10")
62
+ assert flet_desktop.get_artifact_filename() == "flet-linux-debian10-arm64.tar.gz"
@@ -1 +0,0 @@
1
- version = "1.1.0.dev1"
@@ -1,2 +0,0 @@
1
- flet==1.1.0.dev1
2
- rich>=13.0.0