|
5 | 5 | import re |
6 | 6 | import shutil |
7 | 7 | import sys |
| 8 | +import time |
8 | 9 | from pathlib import Path |
9 | 10 | from typing import Optional, cast |
10 | 11 |
|
|
23 | 24 | ) |
24 | 25 | from flet_cli.utils.pyproject_toml import load_pyproject_toml |
25 | 26 | from packaging import version |
| 27 | +from packaging.requirements import Requirement |
26 | 28 | from rich.console import Console, Group |
27 | 29 | from rich.live import Live |
28 | 30 | from rich.panel import Panel |
@@ -1581,7 +1583,27 @@ def package_python_app(self): |
1581 | 1583 | toml_dependencies.extend(platform_dependencies) |
1582 | 1584 |
|
1583 | 1585 | if len(toml_dependencies) > 0: |
| 1586 | + dev_packages = ( |
| 1587 | + self.get_pyproject(f"tool.flet.{self.config_platform}.dev_packages") |
| 1588 | + or self.get_pyproject(f"tool.flet.dev_packages") |
| 1589 | + or [] |
| 1590 | + ) |
| 1591 | + if len(dev_packages) > 0: |
| 1592 | + no_cache = False |
| 1593 | + for i in range(0, len(toml_dependencies)): |
| 1594 | + package_name = Requirement(toml_dependencies[i]).name |
| 1595 | + if package_name in dev_packages: |
| 1596 | + dev_path = Path(dev_packages[package_name]) |
| 1597 | + if not dev_path.is_absolute(): |
| 1598 | + dev_path = (self.python_app_path / dev_path).resolve() |
| 1599 | + toml_dependencies[i] = f"{package_name} @ file://{dev_path}" |
| 1600 | + no_cache = True |
| 1601 | + if no_cache: |
| 1602 | + toml_dependencies.append("--no-cache-dir") |
| 1603 | + hash.update(time.time()) |
| 1604 | + |
1584 | 1605 | package_args.append(",".join(toml_dependencies)) |
| 1606 | + |
1585 | 1607 | elif requirements_txt.exists(): |
1586 | 1608 | if self.verbose > 1: |
1587 | 1609 | with open(requirements_txt, "r", encoding="utf-8") as f: |
|
0 commit comments