ksp-bootstraps 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ksp_bootstraps/__init__.py +0 -0
- ksp_bootstraps/bootstrap.py +89 -0
- ksp_bootstraps/bootstraps/__init__.py +27 -0
- ksp_bootstraps/bootstraps/kivy/__init__.py +43 -0
- ksp_bootstraps/bootstraps/kivy/gradle_build_files.py +2278 -0
- ksp_bootstraps/bootstraps/kivy/kivy_gradle.py +480 -0
- ksp_bootstraps/bootstraps/kivy/kivy_xcode.py +246 -0
- ksp_bootstraps/bootstraps/kivy/templates/KivyLauncher.swift +385 -0
- ksp_bootstraps/bootstraps/kivy/templates/__init__.py +0 -0
- ksp_bootstraps/bootstraps/kivy/templates/base_app/__init__.py +2 -0
- ksp_bootstraps/bootstraps/kivy/templates/base_app/app_kv.py +93 -0
- ksp_bootstraps/bootstraps/kivy/templates/base_app/app_py.py +24 -0
- ksp_bootstraps/bootstraps/kivy/templates/icon.png +0 -0
- ksp_bootstraps/bootstraps/kivy/templates/ios.file +361 -0
- ksp_bootstraps/bootstraps/kivy/templates/presplash.png +0 -0
- ksp_bootstraps/gradle/__init__.py +0 -0
- ksp_bootstraps/gradle/android_manifest_template.py +32 -0
- ksp_bootstraps/gradle/build_gradle_template.py +87 -0
- ksp_bootstraps/platforms.py +97 -0
- ksp_bootstraps/pyproject_models/kivy_school/__init__.py +0 -0
- ksp_bootstraps/pyproject_models/kivy_school/apple.py +67 -0
- ksp_bootstraps/pyproject_models/kivy_school/gradle.py +122 -0
- ksp_bootstraps/pyproject_models/pyproject_toml.py +44 -0
- ksp_bootstraps/tools.py +65 -0
- ksp_bootstraps/xcode/__init__.py +0 -0
- ksp_bootstraps/xcode/main_files.py +67 -0
- ksp_bootstraps/xcode/plist_templates.py +51 -0
- ksp_bootstraps/xcode/project_spec.py +84 -0
- ksp_bootstraps/xcode/project_target.py +385 -0
- ksp_bootstraps/xcode/setting_presets.py +197 -0
- ksp_bootstraps/xcode/spec_merge.py +73 -0
- ksp_bootstraps/xcode/static_templates.py +89 -0
- ksp_bootstraps/xcode/xcodegen_runner.py +26 -0
- ksp_bootstraps-0.0.1.dist-info/METADATA +12 -0
- ksp_bootstraps-0.0.1.dist-info/RECORD +36 -0
- ksp_bootstraps-0.0.1.dist-info/WHEEL +4 -0
|
File without changes
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
from typing import Generic, Protocol, runtime_checkable
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from .platforms import Platform
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ProjectDelegate(Protocol):
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
def py_version(self) -> str: ...
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
def working_dir(self) -> Path: ...
|
|
16
|
+
|
|
17
|
+
def install_cpython(self): ...
|
|
18
|
+
|
|
19
|
+
@runtime_checkable
|
|
20
|
+
class GradleProjectDelegate(Protocol):
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def py_version(self) -> str: ...
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def working_dir(self) -> Path: ...
|
|
27
|
+
|
|
28
|
+
def install_cpython(self): ...
|
|
29
|
+
|
|
30
|
+
def android_prefix(self, ks_root: Path, arch: str, android_version: str) -> Path: ...
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def default_api_version(self) -> int: ...
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def sdk_path(self) -> str: ...
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def ndk_version(self) -> str: ...
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def ndk_path(self) -> str: ...
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def java_path(self) -> str: ...
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def android_py_version(self) -> str: ...
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def uv_py_version(self) -> str: ...
|
|
52
|
+
|
|
53
|
+
@runtime_checkable
|
|
54
|
+
class XcodeProjectDelegate(Protocol):
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def py_version(self) -> str: ...
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def uv_py_version(self) -> str: ...
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def working_dir(self) -> Path: ...
|
|
64
|
+
|
|
65
|
+
def install_cpython(self): ...
|
|
66
|
+
|
|
67
|
+
def xcode_generate(self, **kw): ...
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class BootstrapProtocol(Protocol):
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
#delegate: ProjectDelegate
|
|
80
|
+
@property
|
|
81
|
+
def delegate(self) -> ProjectDelegate:
|
|
82
|
+
...
|
|
83
|
+
|
|
84
|
+
def generate(self, **kw: object) -> Path | None: ...
|
|
85
|
+
|
|
86
|
+
def sync_site_xcframeworks(self) -> None: ...
|
|
87
|
+
|
|
88
|
+
def install_frameworks(self) -> None: ...
|
|
89
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from .kivy import KivyBootstrap
|
|
4
|
+
from ..bootstrap import BootstrapProtocol, ProjectDelegate
|
|
5
|
+
from ..pyproject_models.pyproject_toml import PyProjectTomlProtocol
|
|
6
|
+
|
|
7
|
+
class BootstrapError(Exception):
|
|
8
|
+
|
|
9
|
+
def __init__(self, message: str) -> None:
|
|
10
|
+
self.message = message
|
|
11
|
+
super().__init__(self.message)
|
|
12
|
+
|
|
13
|
+
registered_bootstraps: dict[str, BootstrapProtocol] = {}
|
|
14
|
+
|
|
15
|
+
def register_bootstrap(name: str, cls: BootstrapProtocol):
|
|
16
|
+
registered_bootstraps[name] = cls
|
|
17
|
+
|
|
18
|
+
def get_bootstrap(name: str, pyproject: PyProjectTomlProtocol, delegate: ProjectDelegate) -> BootstrapProtocol:
|
|
19
|
+
|
|
20
|
+
match name:
|
|
21
|
+
case "kivy":
|
|
22
|
+
return KivyBootstrap(pyproject, delegate)
|
|
23
|
+
case _ if name in registered_bootstraps:
|
|
24
|
+
return registered_bootstraps[name]
|
|
25
|
+
case _:
|
|
26
|
+
raise BootstrapError(f"<{name}> is not a bootstrap")
|
|
27
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from ksp_bootstraps.bootstrap import BootstrapProtocol, ProjectDelegate, XcodeProjectDelegate, GradleProjectDelegate
|
|
2
|
+
from .kivy_gradle import KivyGradleBuilder
|
|
3
|
+
from .kivy_xcode import KivyXcodeBuilder
|
|
4
|
+
from ...platforms import Platform
|
|
5
|
+
from ...pyproject_models.pyproject_toml import PyProjectTomlProtocol
|
|
6
|
+
from ...pyproject_models.kivy_school.apple import MacOSProtocol, IosProtocol
|
|
7
|
+
from ...pyproject_models.kivy_school.gradle import AndroidProtocol
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class KivyBootstrap:
|
|
13
|
+
|
|
14
|
+
delegate: ProjectDelegate
|
|
15
|
+
py_project: PyProjectTomlProtocol
|
|
16
|
+
|
|
17
|
+
def __init__(self, py_project: PyProjectTomlProtocol, delegate: ProjectDelegate):
|
|
18
|
+
self.delegate = delegate
|
|
19
|
+
self.py_project = py_project
|
|
20
|
+
|
|
21
|
+
def generate(self, **kw) -> Path | None:
|
|
22
|
+
platform: str = kw.pop("platform")
|
|
23
|
+
delegate = self.delegate
|
|
24
|
+
if platform:
|
|
25
|
+
match platform:
|
|
26
|
+
case "android":
|
|
27
|
+
if isinstance(delegate, GradleProjectDelegate):
|
|
28
|
+
KivyGradleBuilder(self.py_project, delegate).generate(**kw)
|
|
29
|
+
case "apple":
|
|
30
|
+
if isinstance(delegate, XcodeProjectDelegate):
|
|
31
|
+
return KivyXcodeBuilder(self.py_project, delegate).generate(**kw)
|
|
32
|
+
case _:
|
|
33
|
+
raise NotImplementedError(platform)
|
|
34
|
+
|
|
35
|
+
def sync_site_xcframeworks(self) -> None:
|
|
36
|
+
if isinstance(self.delegate, XcodeProjectDelegate):
|
|
37
|
+
KivyXcodeBuilder(self.py_project, self.delegate).sync_site_xcframeworks()
|
|
38
|
+
|
|
39
|
+
def install_frameworks(self) -> None:
|
|
40
|
+
if isinstance(self.delegate, XcodeProjectDelegate):
|
|
41
|
+
KivyXcodeBuilder(self.py_project, self.delegate)._install_frameworks()
|
|
42
|
+
|
|
43
|
+
|