pygame-ios 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.
pygame_ios/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """Run pygame-ce games on iPhones and iPads easily."""
2
+
3
+ __version__ = "0.0.1"
pygame_ios/__main__.py ADDED
@@ -0,0 +1,103 @@
1
+ import io
2
+ import json
3
+ import os
4
+ import shutil
5
+ import sys
6
+ import zipfile
7
+
8
+ import requests
9
+
10
+ BASE_API_PATH = "https://api.github.com/repos/seekerluke/pygame-ios-templates/releases/"
11
+ BASE_DOWNLOAD_PATH = (
12
+ "https://github.com/seekerluke/pygame-ios-templates/releases/download/"
13
+ )
14
+ FOLDER_NAME = "pygame-ios-template"
15
+
16
+
17
+ def check_args():
18
+ result = len(sys.argv) >= 3
19
+ if not result:
20
+ print("Usage: pygame-ios project_folder main_python_script [pygame_ce_version]")
21
+ return result
22
+
23
+
24
+ def get_latest_version():
25
+ response = requests.get(os.path.join(BASE_API_PATH, "latest"))
26
+ response.raise_for_status()
27
+ json_data = json.loads(response.content)
28
+ return json_data["tag_name"]
29
+
30
+
31
+ def download_template(main_script_path: str):
32
+ current_dir = os.path.dirname(main_script_path)
33
+ template_dir = os.path.join(current_dir, FOLDER_NAME)
34
+ if os.path.isdir(template_dir):
35
+ print("pygame-ios template already exists. Skipping.")
36
+ return
37
+
38
+ version_number = f"v{sys.argv[3]}" if len(sys.argv) >= 4 else get_latest_version()
39
+ version_stripped = version_number.removeprefix("v")
40
+ download_path = os.path.join(
41
+ BASE_DOWNLOAD_PATH,
42
+ version_number,
43
+ f"pygame-ios-template-{version_stripped}.zip",
44
+ )
45
+
46
+ try:
47
+ print(f"Downloading Xcode template for pygame-ce {version_number}...")
48
+ response = requests.get(download_path)
49
+ response.raise_for_status()
50
+ except requests.exceptions.HTTPError:
51
+ print(
52
+ f"Xcode template for pygame-ce version {version_number} does not exist. It might not be supported yet."
53
+ )
54
+ print(
55
+ "Supported versions are listed here: https://github.com/seekerluke/pygame-ios-templates/releases"
56
+ )
57
+ sys.exit(0)
58
+
59
+ print("Extracting...")
60
+ with zipfile.ZipFile(io.BytesIO(response.content)) as zf:
61
+ zf.extractall(template_dir)
62
+
63
+ print("Xcode template downloaded successfully.")
64
+
65
+
66
+ def copy_project_files(project_folder_path: str):
67
+ dest_dir = os.path.join(
68
+ project_folder_path, FOLDER_NAME, "pygame-ios", "app", "pygame-ios"
69
+ )
70
+ shutil.copytree(
71
+ project_folder_path,
72
+ dest_dir,
73
+ dirs_exist_ok=True,
74
+ # don't copy the Xcode template into the Xcode template
75
+ ignore=lambda src, names: [FOLDER_NAME],
76
+ )
77
+
78
+ new_main_path = os.path.join(dest_dir, sys.argv[2])
79
+ new_main_path_name = os.path.join(dest_dir, "__main__.py")
80
+ os.rename(new_main_path, new_main_path_name)
81
+
82
+ print("Copied project files to Xcode template.")
83
+
84
+
85
+ def finalise():
86
+ print(
87
+ f'Done! Open the Xcode project under "{FOLDER_NAME}" and run the project on your chosen device or simulator.'
88
+ )
89
+
90
+
91
+ def cli():
92
+ if not check_args():
93
+ return # early exit
94
+
95
+ project_folder_path = os.path.abspath(sys.argv[1])
96
+ main_script_path = os.path.abspath(sys.argv[2])
97
+ download_template(main_script_path)
98
+ copy_project_files(project_folder_path)
99
+ finalise()
100
+
101
+
102
+ if __name__ == "__main__":
103
+ cli()
@@ -0,0 +1,56 @@
1
+ Metadata-Version: 2.4
2
+ Name: pygame-ios
3
+ Version: 0.0.1
4
+ Summary: Run pygame-ce games on iPhones and iPads easily.
5
+ Author-email: Luke Lazzaro <lazzdev@proton.me>
6
+ Requires-Python: >=3.13
7
+ Description-Content-Type: text/markdown
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Requires-Dist: requests
11
+ Project-URL: Homepage, https://github.com/seekerluke/pygame-ios
12
+ Project-URL: Issues, https://github.com/seekerluke/pygame-ios/issues
13
+
14
+ # pygame-ios
15
+
16
+ Run pygame-ce games on iPhones and iPads easily.
17
+
18
+ This package contains a simple CLI tool that downloads a template from [pygame-ios-templates](https://github.com/seekerluke/pygame-ios-templates) and adds your game files to it. After that you can run the Xcode project and see your pygame-ce game on your device or simulator of choice.
19
+
20
+ ## Usage
21
+
22
+ Assuming you have Python 3, run this to install the package:
23
+
24
+ ```bash
25
+ pip install pygame-ios
26
+ ```
27
+
28
+ This gives you a command you can run with one of the following:
29
+
30
+ ```bash
31
+ pygame-ios
32
+ python -m pygame-ios
33
+ ```
34
+
35
+ This command needs arguments. You need to provide a location for your project folder where your files will be copied from, as well as an entry point script which will be renamed to `__main__.py` and used as the entry point in Xcode.
36
+
37
+ Example usage:
38
+
39
+ ```bash
40
+ pygame-ios . game.py # copies files from current folder, uses game.py as the entry point script
41
+ ```
42
+
43
+ After running this command, an Xcode project will be downloaded. You can open this project in Xcode and run it on a device or simulator.
44
+
45
+ To update your Xcode project with new files or changes, just run the command again. The download step is skipped and your files are copied, overwriting previous files.
46
+
47
+ ### Other Arguments
48
+
49
+ You can also specify a pygame-ce version:
50
+
51
+ ```bash
52
+ pygame-ios . game.py 2.5.5 # fetches the v2.5.5 version of the template
53
+ ```
54
+
55
+ Without this argument, the command will download the latest template available. But you can specify a pygame-ce version in case you need something different from the latest stable. Not all pygame-ce versions are supported, see [here](https://github.com/seekerluke/pygame-ios-templates/releases) for supported versions, and see the [repository README](https://github.com/seekerluke/pygame-ios-templates?tab=readme-ov-file#making-new-templates) for details on how to make your own.
56
+
@@ -0,0 +1,7 @@
1
+ pygame_ios/__init__.py,sha256=oPc8U56_7oxs5gjQajeZJnQNyYGKNd1itbsK3Ii7TMI,78
2
+ pygame_ios/__main__.py,sha256=kUq4_X3kARYHh4MJvmRFUumvzYJlXdebR_Ql6DLxmqY,3019
3
+ pygame_ios-0.0.1.dist-info/entry_points.txt,sha256=BnRDosT76LSDdf--48k8nLVXJzrPLYZEiwQelkzJhXs,54
4
+ pygame_ios-0.0.1.dist-info/licenses/LICENSE,sha256=FvAEKujtBHpWo_TES7pySGdWpkJUgf0DrObw-5GN-5c,1079
5
+ pygame_ios-0.0.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
6
+ pygame_ios-0.0.1.dist-info/METADATA,sha256=ldGEg4Q-1hMNbNVYHeRVIR3QLRQpWSxb798W22pdOFo,2292
7
+ pygame_ios-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: flit 3.12.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ pygame-ios=pygame_ios.__main__:cli
3
+
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Luke Lazzaro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.