-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flet new packages structure and
flet build
v2 (#4122)
- Loading branch information
1 parent
fb0d037
commit 6811d6f
Showing
112 changed files
with
2,158 additions
and
1,594 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export root=$APPVEYOR_BUILD_FOLDER | ||
export flet_sdk_root=$root/sdk/python | ||
echo "flet_sdk_root: $flet_sdk_root" | ||
|
||
python --version | ||
pip install --upgrade setuptools wheel twine poetry tomlkit virtualenv | ||
|
||
function patch_python_package_versions() { | ||
PYPI_VER="${APPVEYOR_BUILD_VERSION/+/.dev}" | ||
sed -i -e "s/version = \"\"/version = \"$PYPI_VER\"/g" $flet_sdk_root/packages/flet-core/src/flet_core/version.py | ||
python3 $root/ci/patch_toml_versions.py $flet_sdk_root/packages/flet/pyproject.toml $PYPI_VER | ||
python3 $root/ci/patch_toml_versions.py $flet_sdk_root/packages/flet-cli/pyproject.toml $PYPI_VER | ||
python3 $root/ci/patch_toml_versions.py $flet_sdk_root/packages/flet-core/pyproject.toml $PYPI_VER | ||
python3 $root/ci/patch_toml_versions.py $flet_sdk_root/packages/flet-desktop/pyproject.toml $PYPI_VER | ||
python3 $root/ci/patch_toml_versions.py $flet_sdk_root/packages/flet-web/pyproject.toml $PYPI_VER | ||
} | ||
|
||
function patch_flet_desktop_package_name() { | ||
python3 $root/ci/patch_toml_package_name.py $flet_sdk_root/packages/flet-desktop/pyproject.toml $1 | ||
} | ||
|
||
function publish_to_pypi() { | ||
if [[ ("$APPVEYOR_REPO_BRANCH" == "main" || "$APPVEYOR_REPO_TAG_NAME" != "") && "$APPVEYOR_PULL_REQUEST_NUMBER" == "" ]]; then | ||
twine upload "$@" | ||
elif [[ "$APPVEYOR_PULL_REQUEST_NUMBER" == "" ]]; then | ||
for wheel in "$@"; do | ||
curl -F package=@$wheel https://$GEMFURY_TOKEN@push.fury.io/flet/ | ||
done | ||
fi | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
import pathlib | ||
import sys | ||
|
||
import tomlkit | ||
|
||
if len(sys.argv) < 2: | ||
print("Specify toml file and a new package name") | ||
sys.exit(1) | ||
|
||
current_dir = pathlib.Path(os.getcwd()) | ||
toml_path = current_dir.joinpath(current_dir, sys.argv[1]) | ||
package_name = sys.argv[2] | ||
print(f"Patching TOML file {toml_path} to {package_name}") | ||
|
||
# read | ||
with open(toml_path, "r") as f: | ||
t = tomlkit.parse(f.read()) | ||
|
||
# patch name | ||
t["tool"]["poetry"]["name"] = package_name | ||
|
||
# save | ||
with open(toml_path, "w") as f: | ||
f.write(tomlkit.dumps(t)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
# find wheel | ||
wheel=$(realpath $(find $1 -maxdepth 1 -name "flet-*.whl")) | ||
|
||
# Check if a file was found | ||
if [ -z "$wheel" ]; then | ||
echo "No file found matching the pattern flet-*.whl" | ||
else | ||
echo "Found file: $wheel" | ||
fi | ||
|
||
version=$(echo "$wheel" | sed -E 's/.*-([0-9]+[^-]+)-.*/\1/') | ||
echo "$version" | ||
|
||
# Define temporary directory and file | ||
tmp_dir=$(mktemp -d) | ||
|
||
# Unpack the wheel file | ||
python -m wheel unpack --dest $tmp_dir $wheel | ||
|
||
# get unpacked wheel dir | ||
wheel_dir=$(realpath $(find $tmp_dir -maxdepth 1 -name "flet-*")) | ||
echo "wheel temp dir: $wheel_dir" | ||
|
||
pushd $wheel_dir | ||
|
||
# process metadata | ||
for metadata_file in *.dist-info/METADATA; do | ||
# Replace the condition in METADATA | ||
sed -i "/^Requires-Dist: flet-desktop /a Requires-Dist: flet-desktop-light (==$version) ; platform_system == 'Linux' and 'embedded' not in platform_version" "$metadata_file" | ||
sed -i "s/platform_system != \"desktop-light\"/(platform_system == 'Darwin' or platform_system == 'Windows') and 'embedded' not in platform_version/g" "$metadata_file" | ||
sed -i "s/platform_system != \"embedded\"/(platform_system == 'Darwin' or platform_system == 'Linux' or platform_system == 'Windows') and 'embedded' not in platform_version/g" "$metadata_file" | ||
cat $metadata_file | ||
done | ||
|
||
# Repack the wheel | ||
rm $wheel | ||
python -m wheel pack --dest-dir $(dirname $wheel) . | ||
|
||
# Cleanup temporary directory | ||
popd | ||
rm -rf "$tmp_dir" | ||
|
||
echo "Successfully updated flet-*.whl with platform-specific dependencies." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{flutter_js}} | ||
{{flutter_build_config}} | ||
|
||
var loading = document.querySelector('#loading'); | ||
_flutter.loader.load({ | ||
serviceWorkerSettings: { | ||
serviceWorkerVersion: {{flutter_service_worker_version}}, | ||
}, | ||
onEntrypointLoaded: async function (engineInitializer) { | ||
loading.classList.add('main_done'); | ||
const appRunner = await engineInitializer.initializeEngine({useColorEmoji: useColorEmoji}); | ||
|
||
loading.classList.add('init_done'); | ||
await appRunner.runApp(); | ||
|
||
window.setTimeout(function () { | ||
loading.remove(); | ||
}, 200); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ dependencies: | |
sdk: flutter | ||
|
||
collection: ^1.16.0 | ||
rive: ^0.13.0 | ||
rive: 0.13.1 | ||
|
||
flet: | ||
path: ../flet/ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Flet CLI | ||
|
||
Flet CLI is a command-line interface tool for Flet, a framework for building interactive multi-platform applications using Python. | ||
|
||
## Features | ||
|
||
- Create new Flet projects | ||
- Run Flet applications | ||
- Package and deploy Flet apps | ||
|
||
## Basic Usage | ||
|
||
To create a new Flet project: | ||
|
||
``` | ||
flet create myapp | ||
``` |
Oops, something went wrong.