Skip to content

Commit 927624c

Browse files
Creeper19472FeodorFitsnerndonkoHenri
authored
Merge Android crash fix into the main branch (#7)
* Fixed iOS framework identifier generation and bump `archive` dependency (flet-dev#185) * Fix leading dash in framework identifier generation Ensures that any leading dashes are removed from the generated framework identifier in xcframework_utils.sh. Defaults to 'framework' if the identifier is empty after processing. * Update CFBundlePackageType to FMWK in plist generation Changed the CFBundlePackageType from 'APPL' to 'FMWK' in the create_plist function to correctly identify the bundle as a framework. Also made a minor whitespace adjustment in create_xcframework_from_dylibs. * Bump `archive` dependency to `^4.0.7` (flet-dev#184) * update `archive` dependency to ``^4.0.7` and bump serious_python version to `0.9.5` * revert flutter_lints dependency to version 2.0.0 * Bump version to 0.9.5 for Android and Darwin Updated the version number to 0.9.5 in both the Android build.gradle and Darwin podspec files to prepare for a new release. --------- Co-authored-by: Feodor Fitsner <feodor@appveyor.com> * Update changelogs for iOS framework identifier fix Added notes to all package changelogs for version 0.9.5 about the fix for iOS framework identifier generation. --------- Co-authored-by: TheEthicalBoy <98978078+ndonkoHenri@users.noreply.github.com> * Fix zip directory (flet-dev#186) * Make zipDirectory call asynchronous Added 'await' to the zipDirectory method to ensure the archive creation completes before proceeding. This change improves reliability when creating app archives. * Bump to 0.9.6 and make zipDirectory asynchronous Updated all platform packages to version 0.9.6. The zipDirectory call is now asynchronous across all implementations for improved performance and consistency. * Make setenv calls awaitable in Python init Refactored the setenv function to return a Future<void> and updated all calls to setenv to use await. This ensures environment variables are set in the correct order before proceeding. * Ensure single CPython interpreter per process Introduces a guard to prevent repeated initialization and finalization of the CPython interpreter, addressing crashes on second launch with CPython 3.12. Also ensures the current native thread is registered with the GIL when running Python code, improving stability when re-entering Python from new Dart isolates or threads. * Remove 'Warning:' prefix from debug message Updated the debugPrint statement to remove the 'Warning:' prefix when unable to load libpyjni.so. This change streamlines log output for consistency. * Revert "Ensure single CPython interpreter per process" This reverts commit 3f4adc0. * chore: bump python version to 3.14.2 * fix python-windows-dart package name --------- Co-authored-by: Feodor Fitsner <feodor@appveyor.com> Co-authored-by: TheEthicalBoy <98978078+ndonkoHenri@users.noreply.github.com>
1 parent 0ba0c5e commit 927624c

File tree

6 files changed

+25
-26
lines changed

6 files changed

+25
-26
lines changed

src/serious_python/bin/package_command.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const mobilePyPiUrl = "https://pypi.flet.dev";
1818
const pyodideRootUrl = "https://cdn.jsdelivr.net/pyodide/v0.27.7/full";
1919
const pyodideLockFile = "pyodide-lock.json";
2020

21-
const buildPythonVersion = "3.14.0";
22-
const buildPythonReleaseDate = "20251007";
21+
const buildPythonVersion = "3.14.2";
22+
const buildPythonReleaseDate = "20251209";
2323
const defaultSitePackagesDir = "__pypackages__";
2424
const sitePackagesEnvironmentVariable = "SERIOUS_PYTHON_SITE_PACKAGES";
2525
const flutterPackagesFlutterEnvironmentVariable =

src/serious_python_android/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
group 'com.flet.serious_python_android'
22
version '0.9.6'
33

4-
def python_version = '3.14'
4+
def python_version = '3.14.2'
55

66
buildscript {
77
repositories {

src/serious_python_android/lib/serious_python_android.dart

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,17 @@ class SeriousPythonAndroid extends SeriousPythonPlatform {
3333
List<String>? modulePaths,
3434
Map<String, String>? environmentVariables,
3535
bool? sync}) async {
36-
Future setenv(String key, String value) async {
37-
await methodChannel.invokeMethod<String>(
38-
'setEnvironmentVariable', {'name': key, 'value': value});
39-
}
36+
Future<void> setenv(String key, String value) =>
37+
methodChannel.invokeMethod<String>(
38+
'setEnvironmentVariable', {'name': key, 'value': value});
4039

4140
// load libpyjni.so to get JNI reference
4241
try {
4342
await methodChannel
4443
.invokeMethod<String>('loadLibrary', {'libname': 'pyjni'});
4544
await setenv("FLET_JNI_READY", "1");
4645
} catch (e) {
47-
debugPrint("Warning: Unable to load libpyjni.so library: $e");
46+
debugPrint("Unable to load libpyjni.so library: $e");
4847
}
4948

5049
// unpack python bundle
@@ -78,18 +77,18 @@ class SeriousPythonAndroid extends SeriousPythonPlatform {
7877
moduleSearchPaths.add(sitePackagesPath);
7978
}
8079

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(":"));
80+
await setenv("PYTHONINSPECT", "1");
81+
await setenv("PYTHONDONTWRITEBYTECODE", "1");
82+
await setenv("PYTHONNOUSERSITE", "1");
83+
await setenv("PYTHONUNBUFFERED", "1");
84+
await setenv("LC_CTYPE", "UTF-8");
85+
await setenv("PYTHONHOME", pythonLibPath);
86+
await setenv("PYTHONPATH", moduleSearchPaths.join(":"));
8887

8988
// set environment variables
9089
if (environmentVariables != null) {
9190
for (var v in environmentVariables.entries) {
92-
setenv(v.key, v.value);
91+
await setenv(v.key, v.value);
9392
}
9493
}
9594

src/serious_python_android/lib/src/gen.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25758,25 +25758,25 @@ const int PY_RELEASE_LEVEL_FINAL = 15;
2575825758

2575925759
const int PY_MAJOR_VERSION = 3;
2576025760

25761-
const int PY_MINOR_VERSION = 12;
25761+
const int PY_MINOR_VERSION = 14;
2576225762

25763-
const int PY_MICRO_VERSION = 3;
25763+
const int PY_MICRO_VERSION = 2;
2576425764

2576525765
const int PY_RELEASE_LEVEL = 15;
2576625766

2576725767
const int PY_RELEASE_SERIAL = 0;
2576825768

25769-
const String PY_VERSION = '3.14.0';
25769+
const String PY_VERSION = '3.14.2';
2577025770

25771-
const int PY_VERSION_HEX = 51249392;
25771+
const int PY_VERSION_HEX = 51249904;
2577225772

2577325773
const int ALIGNOF_LONG = 8;
2577425774

2577525775
const int ALIGNOF_MAX_ALIGN_T = 8;
2577625776

2577725777
const int ALIGNOF_SIZE_T = 8;
2577825778

25779-
const int ANDROID_API_LEVEL = 21;
25779+
const int ANDROID_API_LEVEL = 24;
2578025780

2578125781
const int ENABLE_IPV6 = 1;
2578225782

src/serious_python_android/python_ffigen.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ globals:
1414
"^class (\\w+) extends ffi.Union": "final class $1 extends ffi.Union"
1515
headers:
1616
entry-points:
17-
- "/Users/feodor/projects/flet-dev/python-mobile/install/android/arm64-v8a/python-3.12/include/python3.12/Python.h"
17+
- "/Users/feodor/projects/flet-dev/python-mobile/install/android/arm64-v8a/python-3.14/include/python3.14/Python.h"
1818
include-directives:
19-
- "/Users/feodor/projects/flet-dev/python-mobile/install/android/arm64-v8a/python-3.12/include/python3.12/*"
20-
- "/Users/feodor/projects/flet-dev/python-mobile/install/android/arm64-v8a/python-3.12/include/python3.12/internal/*"
21-
- "/Users/feodor/projects/flet-dev/python-mobile/install/android/arm64-v8a/python-3.12/include/python3.12/cpython/*"
19+
- "/Users/feodor/projects/flet-dev/python-mobile/install/android/arm64-v8a/python-3.14/include/python3.14/*"
20+
- "/Users/feodor/projects/flet-dev/python-mobile/install/android/arm64-v8a/python-3.14/include/python3.14/internal/*"
21+
- "/Users/feodor/projects/flet-dev/python-mobile/install/android/arm64-v8a/python-3.14/include/python3.14/cpython/*"
2222
name: "CPython"
2323
llvm-path:
2424
- /opt/homebrew/opt/llvm

src/serious_python_windows/windows/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cmake_policy(SET CMP0063 NEW)
1818
set(PLUGIN_NAME "serious_python_windows_plugin")
1919

2020
set(PYTHON_PACKAGE ${CMAKE_BINARY_DIR}/python)
21-
set(PYTHON_URL "https://github.com/cfms-dev/python-build/releases/download/v3.14/python-windows-for-dart-3.14.zip")
21+
set(PYTHON_URL "https://github.com/cfms-dev/python-build/releases/download/v3.14.2/python-windows-for-dart-3.14.2.zip")
2222
set(PYTHON_FILE ${CMAKE_BINARY_DIR}/python-windows-for-dart.zip)
2323
if (NOT EXISTS ${PYTHON_FILE})
2424
file(DOWNLOAD ${PYTHON_URL} ${PYTHON_FILE})

0 commit comments

Comments
 (0)