Skip to content

Commit 93d636c

Browse files
Merge branch 'upstream'
2 parents c037e4b + 68b5e84 commit 93d636c

File tree

20 files changed

+342
-117
lines changed

20 files changed

+342
-117
lines changed

src/serious_python/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## 0.9.8
2+
3+
* Fix logging on Android.
4+
5+
## 0.9.7
6+
7+
* Fix app restart on Android 10.
8+
* Redirect Python output to logcat.
9+
10+
## 0.9.6
11+
12+
* Make zipDirectory call asynchronous.
13+
14+
## 0.9.5
15+
16+
* Bump `archive` to `^4.0.7`.
17+
* Fixed iOS framework identifier generation.
18+
119
## 0.9.4
220

321
* 16 KB memory page support for Android 15+ (by [@ReYaNOW](https://github.com/ReYaNOW)).

src/serious_python/bin/package_command.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ class PackageCommand extends Command {
557557
"Creating app archive at ${dest.path} from a temp directory",
558558
);
559559
final encoder = ZipFileEncoder();
560-
encoder.zipDirectory(tempDir, filename: dest.path);
560+
await encoder.zipDirectory(tempDir, filename: dest.path);
561561

562562
// create hash file
563563
stdout.writeln("Writing app archive hash to ${dest.path}.hash");

src/serious_python/pubspec.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: serious_python
22
description: A cross-platform plugin for adding embedded Python runtime to your Flutter apps.
33
homepage: https://flet.dev
44
repository: https://github.com/flet-dev/serious-python
5-
version: 0.9.4+1
5+
version: 0.9.8+1
66

77
platforms:
88
ios:
@@ -11,8 +11,6 @@ platforms:
1111
windows:
1212
linux:
1313

14-
resolution: workspace
15-
1614
environment:
1715
sdk: '>=3.7.0 < 4.0.0'
1816
flutter: '>=3.27.0'
@@ -59,4 +57,4 @@ dev_dependencies:
5957
flutter_test:
6058
sdk: flutter
6159
plugin_platform_interface: ^2.1.8
62-
flutter_lints: ^6.0.0
60+
flutter_lints: ^6.0.0

src/serious_python_android/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## 0.9.8
2+
3+
* Fix logging on Android.
4+
5+
## 0.9.7
6+
7+
* Fix app restart on Android 10.
8+
* Redirect Python output to logcat.
9+
10+
## 0.9.6
11+
12+
* Make zipDirectory call asynchronous.
13+
14+
## 0.9.5
15+
16+
* Bump `archive` to `^4.0.7`.
17+
* Fixed iOS framework identifier generation.
18+
119
## 0.9.4
220

321
* 16 KB memory page support for Android 15+ (by [@ReYaNOW](https://github.com/ReYaNOW)).

src/serious_python_android/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
group 'com.flet.serious_python_android'
2-
version '0.9.4'
3-
2+
version '0.9.8'
3+
44
def python_version = '3.12'
55

66
buildscript {

src/serious_python_android/lib/serious_python_android.dart

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:path/path.dart' as p;
88
import 'package:serious_python_platform_interface/serious_python_platform_interface.dart';
99

1010
import 'src/cpython.dart';
11+
import 'src/log.dart';
1112

1213
/// An implementation of [SeriousPythonPlatform] that uses method channels.
1314
class SeriousPythonAndroid extends SeriousPythonPlatform {
@@ -33,24 +34,23 @@ class SeriousPythonAndroid extends SeriousPythonPlatform {
3334
List<String>? modulePaths,
3435
Map<String, String>? environmentVariables,
3536
bool? sync}) async {
36-
Future setenv(String key, String value) async {
37-
await methodChannel.invokeMethod<String>(
38-
'setEnvironmentVariable', {'name': key, 'value': value});
39-
}
37+
Future<void> setenv(String key, String value) =>
38+
methodChannel.invokeMethod<String>(
39+
'setEnvironmentVariable', {'name': key, 'value': value});
4040

4141
// load libpyjni.so to get JNI reference
4242
try {
4343
await methodChannel
4444
.invokeMethod<String>('loadLibrary', {'libname': 'pyjni'});
4545
await setenv("FLET_JNI_READY", "1");
4646
} catch (e) {
47-
debugPrint("Warning: Unable to load libpyjni.so library: $e");
47+
spDebug("Unable to load libpyjni.so library: $e");
4848
}
4949

5050
// unpack python bundle
5151
final nativeLibraryDir =
5252
await methodChannel.invokeMethod<String>('getNativeLibraryDir');
53-
debugPrint("getNativeLibraryDir: $nativeLibraryDir");
53+
spDebug("getNativeLibraryDir: $nativeLibraryDir");
5454

5555
var bundlePath = "$nativeLibraryDir/libpythonbundle.so";
5656
var sitePackagesZipPath = "$nativeLibraryDir/libpythonsitepackages.so";
@@ -60,7 +60,7 @@ class SeriousPythonAndroid extends SeriousPythonPlatform {
6060
}
6161
var pythonLibPath =
6262
await extractFileZip(bundlePath, targetPath: "python_bundle");
63-
debugPrint("pythonLibPath: $pythonLibPath");
63+
spDebug("pythonLibPath: $pythonLibPath");
6464

6565
var programDirPath = p.dirname(appPath);
6666

@@ -74,22 +74,22 @@ class SeriousPythonAndroid extends SeriousPythonPlatform {
7474
if (await File(sitePackagesZipPath).exists()) {
7575
var sitePackagesPath = await extractFileZip(sitePackagesZipPath,
7676
targetPath: "python_site_packages");
77-
debugPrint("sitePackagesPath: $sitePackagesPath");
77+
spDebug("sitePackagesPath: $sitePackagesPath");
7878
moduleSearchPaths.add(sitePackagesPath);
7979
}
8080

81-
setenv("PYTHONINSPECT", "1");
82-
setenv("PYTHONDONTWRITEBYTECODE", "1");
83-
setenv("PYTHONNOUSERSITE", "1");
84-
setenv("PYTHONUNBUFFERED", "1");
85-
setenv("LC_CTYPE", "UTF-8");
86-
setenv("PYTHONHOME", pythonLibPath);
87-
setenv("PYTHONPATH", moduleSearchPaths.join(":"));
81+
await setenv("PYTHONINSPECT", "1");
82+
await setenv("PYTHONDONTWRITEBYTECODE", "1");
83+
await setenv("PYTHONNOUSERSITE", "1");
84+
await setenv("PYTHONUNBUFFERED", "1");
85+
await setenv("LC_CTYPE", "UTF-8");
86+
await setenv("PYTHONHOME", pythonLibPath);
87+
await setenv("PYTHONPATH", moduleSearchPaths.join(":"));
8888

8989
// set environment variables
9090
if (environmentVariables != null) {
9191
for (var v in environmentVariables.entries) {
92-
setenv(v.key, v.value);
92+
await setenv(v.key, v.value);
9393
}
9494
}
9595

0 commit comments

Comments
 (0)