Skip to content

Commit 536cf85

Browse files
committed
Add debug logs; deduplicate ffi import
Move and remove duplicate ffi import, format python invalidate key assignment, and add spDebug logging for Python version and app version. These changes improve readability and add runtime debug output to help diagnose bundle extraction and versioning without altering core behavior.
1 parent 0cf831c commit 536cf85

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/serious_python_android/lib/serious_python_android.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import 'dart:async';
22
import 'dart:io';
33

4+
import 'package:ffi/ffi.dart';
45
import 'package:flutter/foundation.dart';
56
import 'package:flutter/material.dart';
67
import 'package:flutter/services.dart';
7-
import 'package:ffi/ffi.dart';
88
import 'package:path/path.dart' as p;
99
import 'package:serious_python_platform_interface/serious_python_platform_interface.dart';
1010

@@ -82,8 +82,10 @@ class SeriousPythonAndroid extends SeriousPythonPlatform {
8282
throw Exception("Python bundle not found: $bundlePath");
8383
}
8484
final pythonVersion = getPythonFullVersion();
85-
final pythonInvalidateKey =
86-
pythonVersion != null ? "python:$pythonVersion" : "python:$pythonSharedLib";
85+
spDebug("Python version: $pythonVersion");
86+
final pythonInvalidateKey = pythonVersion != null
87+
? "python:$pythonVersion"
88+
: "python:$pythonSharedLib";
8789
var pythonLibPath = await extractFileZip(bundlePath,
8890
targetPath: "python_bundle", invalidateKey: pythonInvalidateKey);
8991
spDebug("pythonLibPath: $pythonLibPath");
@@ -99,6 +101,7 @@ class SeriousPythonAndroid extends SeriousPythonPlatform {
99101

100102
if (await File(sitePackagesZipPath).exists()) {
101103
final appVersion = await getAppVersion();
104+
spDebug("App version: $appVersion");
102105
final sitePackagesInvalidateKey =
103106
appVersion != null ? "app:$appVersion" : null;
104107
var sitePackagesPath = await extractFileZip(sitePackagesZipPath,

0 commit comments

Comments
 (0)