-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathserious_python_darwin.podspec
More file actions
89 lines (81 loc) · 3.39 KB
/
Copy pathserious_python_darwin.podspec
File metadata and controls
89 lines (81 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint serious_python_darwin.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'serious_python_darwin'
s.version = '4.3.0'
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.
DESC
s.homepage = 'https://flet.dev'
s.license = { :file => '../LICENSE' }
s.author = { 'Appveyor Systems Inc.' => 'hello@flet.dev' }
s.source = { :path => '.' }
# dart_bridge.xcframework (vendored below) contains static .a archives.
# CocoaPods 1.16+ refuses to install vendored xcframeworks with static
# libraries unless the consuming pod is itself declared as a static
# framework. Python.xcframework is also static, so this was always
# implicitly the case — just being explicit now.
s.static_framework = true
s.source_files = ['serious_python_darwin/Sources/serious_python_darwin/**/*.swift']
s.ios.dependency 'Flutter'
s.osx.dependency 'FlutterMacOS'
s.ios.deployment_target = '13.0'
s.osx.deployment_target = '11.0'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
'OTHER_LDFLAGS' => '-ObjC -all_load -lc++'
}
s.swift_version = '5.0'
# Python runtime versions come from the generated python_versions.properties
# (a snapshot of python-build's manifest.json — see serious_python's
# `gen_version_tables`). SERIOUS_PYTHON_VERSION selects the version; the rest
# derive from the table. The per-field env vars are escape hatches.
pv = {}
File.foreach(File.join(__dir__, 'python_versions.properties')) do |line|
line = line.strip
next if line.empty? || line.start_with?('#')
k, v = line.split('=', 2)
pv[k] = v
end
python_version = ENV['SERIOUS_PYTHON_VERSION'] || pv['default_python_version']
python_full_version = ENV['SERIOUS_PYTHON_FULL_VERSION'] || pv["#{python_version}.full_version"]
python_build_date = ENV['SERIOUS_PYTHON_BUILD_DATE'] || pv['python_build_release_date']
dart_bridge_version = ENV['DART_BRIDGE_VERSION'] || pv['dart_bridge_version']
raise "serious_python: unknown SERIOUS_PYTHON_VERSION '#{python_version}'" if python_full_version.nil?
dist_ios = "dist_ios"
dist_macos = "dist_macos"
prepare_command = <<-CMD
./symlink_pod.sh
./prepare_ios.sh #{python_version} #{python_full_version} #{python_build_date} #{dart_bridge_version}
./prepare_macos.sh #{python_version} #{python_full_version} #{python_build_date} #{dart_bridge_version}
./sync_site_packages.sh
CMD
puts `#{prepare_command}`
# iOS frameworks
s.ios.script_phase = {
:name => 'Add Python frameworks into iOS app bundle',
:script => "$PODS_TARGET_SRCROOT/bundle-python-frameworks-ios.sh",
:execution_position => :before_compile
}
s.ios.vendored_frameworks = "dist_ios/xcframeworks/*"
s.ios.resource_bundles = {
'python' => [
"dist_ios/stdlib",
"dist_ios/site-packages",
"dist_ios/app"
]
}
# macOS frameworks
s.osx.vendored_frameworks = "dist_macos/xcframeworks/*"
s.osx.resource_bundles = {
'python' => [
"dist_macos/stdlib",
"dist_macos/site-packages",
"dist_macos/app"
]
}
end