Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/serious_python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.8.4

* Copy `site-packages/flutter` contents to `SERIOUS_PYTHON_FLUTTER_PACKAGES`.
* Added `SERIOUS_PYTHON_ALLOW_SOURCE_DISTRIBUTIONS` variable to allow pip installing from source distributions.

## 0.8.3

* Remove `PYTHONOPTIMIZE=2` to make CFFI work.
Expand Down
42 changes: 36 additions & 6 deletions src/serious_python/bin/package_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ const pyodideLockFile = "pyodide-lock.json";
const buildPythonVersion = "3.12.6";
const buildPythonReleaseDate = "20240909";
const defaultSitePackagesDir = "__pypackages__";
const sitePackageEnvironmentVariable = "SERIOUS_PYTHON_SITE_PACKAGES";
const sitePackagesEnvironmentVariable = "SERIOUS_PYTHON_SITE_PACKAGES";
const flutterPackagesFlutterEnvironmentVariable =
"SERIOUS_PYTHON_FLUTTER_PACKAGES";
const allowSourceDistrosEnvironmentVariable =
"SERIOUS_PYTHON_ALLOW_SOURCE_DISTRIBUTIONS";

const platforms = {
"iOS": {
Expand Down Expand Up @@ -227,6 +231,7 @@ class PackageCommand extends Command {
if (requirements.isNotEmpty) {
String? sitePackagesRoot;
bool sitePackagesRootDeleted = false;
bool flutterPackagesCopied = false;
// invoke pip for every platform arch
for (var arch in platforms[platform]!.entries) {
if (archArg != null && arch.key != archArg) {
Expand Down Expand Up @@ -266,13 +271,13 @@ class PackageCommand extends Command {

if (isMobile) {
if (!Platform.environment
.containsKey(sitePackageEnvironmentVariable)) {
throw "Environment variable is not set: $sitePackageEnvironmentVariable";
.containsKey(sitePackagesEnvironmentVariable)) {
throw "Environment variable is not set: $sitePackagesEnvironmentVariable";
}
sitePackagesRoot =
Platform.environment[sitePackageEnvironmentVariable];
Platform.environment[sitePackagesEnvironmentVariable];
if (sitePackagesRoot!.isEmpty) {
throw "Environment variable cannot be empty: $sitePackageEnvironmentVariable";
throw "Environment variable cannot be empty: $sitePackagesEnvironmentVariable";
}
} else {
sitePackagesRoot =
Expand All @@ -298,7 +303,9 @@ class PackageCommand extends Command {

List<String> pipArgs = ["--disable-pip-version-check"];

if (isMobile || isWeb) {
if ((isMobile || isWeb) &&
!Platform.environment
.containsKey(allowSourceDistrosEnvironmentVariable)) {
pipArgs.addAll(["--only-binary", ":all:"]);
}

Expand All @@ -317,6 +324,29 @@ class PackageCommand extends Command {
...requirements
], environment: pipEnv);

// move $sitePackagesDir/flutter if env var is defined
if (Platform.environment
.containsKey(flutterPackagesFlutterEnvironmentVariable)) {
var flutterPackagesRoot = Platform
.environment[flutterPackagesFlutterEnvironmentVariable];
var flutterPackagesRootDir = Directory(flutterPackagesRoot!);
var sitePackagesFlutterDir =
Directory(path.join(sitePackagesDir, "flutter"));
if (await sitePackagesFlutterDir.exists()) {
if (!flutterPackagesCopied) {
stdout.writeln(
"Copying Flutter packages to $flutterPackagesRoot");
if (!await flutterPackagesRootDir.exists()) {
await flutterPackagesRootDir.create(recursive: true);
}
await copyDirectory(sitePackagesFlutterDir,
flutterPackagesRootDir, sitePackagesFlutterDir.path, []);
flutterPackagesCopied = true;
}
await sitePackagesFlutterDir.delete(recursive: true);
}
}

// compile packages
if (compilePackages) {
stdout.writeln("Compiling app packages at $sitePackagesDir");
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: serious_python
description: A cross-platform plugin for adding embedded Python runtime to your Flutter apps.
homepage: https://flet.dev
repository: https://github.com/flet-dev/serious-python
version: 0.8.3
version: 0.8.4

platforms:
ios:
Expand Down
5 changes: 5 additions & 0 deletions src/serious_python_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.8.4

* Copy `site-packages/flutter` contents to `SERIOUS_PYTHON_FLUTTER_PACKAGES`.
* Added `SERIOUS_PYTHON_ALLOW_SOURCE_DISTRIBUTIONS` variable to allow pip installing from source distributions.

## 0.8.3

* Remove `PYTHONOPTIMIZE=2` to make CFFI work.
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_android/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.flet.serious_python_android'
version '0.8.3'
version '0.8.4'

def python_version = '3.12'

Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: serious_python_android
description: Android implementation of the serious_python plugin
homepage: https://flet.dev
repository: https://github.com/flet-dev/serious-python
version: 0.8.3
version: 0.8.4

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down
5 changes: 5 additions & 0 deletions src/serious_python_darwin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.8.4

* Copy `site-packages/flutter` contents to `SERIOUS_PYTHON_FLUTTER_PACKAGES`.
* Added `SERIOUS_PYTHON_ALLOW_SOURCE_DISTRIBUTIONS` variable to allow pip installing from source distributions.

## 0.8.3

* Remove `PYTHONOPTIMIZE=2` to make CFFI work.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'serious_python_darwin'
s.version = '0.8.3'
s.version = '0.8.4'
s.summary = 'A cross-platform plugin for adding embedded Python runtime to your Flutter apps.'
s.description = <<-DESC
A cross-platform plugin for adding embedded Python runtime to your Flutter apps.
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_darwin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: serious_python_darwin
description: iOS and macOS implementations of the serious_python plugin
homepage: https://flet.dev
repository: https://github.com/flet-dev/serious-python
version: 0.8.3
version: 0.8.4

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down
5 changes: 5 additions & 0 deletions src/serious_python_linux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.8.4

* Copy `site-packages/flutter` contents to `SERIOUS_PYTHON_FLUTTER_PACKAGES`.
* Added `SERIOUS_PYTHON_ALLOW_SOURCE_DISTRIBUTIONS` variable to allow pip installing from source distributions.

## 0.8.3

* Remove `PYTHONOPTIMIZE=2` to make CFFI work.
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_linux/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: serious_python_linux
description: Linux implementations of the serious_python plugin
homepage: https://flet.dev
repository: https://github.com/flet-dev/serious-python
version: 0.8.3
version: 0.8.4

environment:
sdk: '>=3.1.3 <4.0.0'
Expand Down
5 changes: 5 additions & 0 deletions src/serious_python_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.8.4

* Copy `site-packages/flutter` contents to `SERIOUS_PYTHON_FLUTTER_PACKAGES`.
* Added `SERIOUS_PYTHON_ALLOW_SOURCE_DISTRIBUTIONS` variable to allow pip installing from source distributions.

## 0.8.3

* Remove `PYTHONOPTIMIZE=2` to make CFFI work.
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: serious_python_platform_interface
description: A common platform interface for the serious_python plugin.
homepage: https://flet.dev
repository: https://github.com/flet-dev/serious-python
version: 0.8.3
version: 0.8.4

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down
5 changes: 5 additions & 0 deletions src/serious_python_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.8.4

* Copy `site-packages/flutter` contents to `SERIOUS_PYTHON_FLUTTER_PACKAGES`.
* Added `SERIOUS_PYTHON_ALLOW_SOURCE_DISTRIBUTIONS` variable to allow pip installing from source distributions.

## 0.8.3

* Remove `PYTHONOPTIMIZE=2` to make CFFI work.
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_windows/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: serious_python_windows
description: Windows implementations of the serious_python plugin
homepage: https://flet.dev
repository: https://github.com/flet-dev/serious-python
version: 0.8.3
version: 0.8.4

environment:
sdk: '>=3.1.3 <4.0.0'
Expand Down