pygame-ios 0.0.1__tar.gz
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-0.0.1/LICENSE
ADDED
|
@@ -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.
|
|
@@ -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,42 @@
|
|
|
1
|
+
# pygame-ios
|
|
2
|
+
|
|
3
|
+
Run pygame-ce games on iPhones and iPads easily.
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Assuming you have Python 3, run this to install the package:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install pygame-ios
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This gives you a command you can run with one of the following:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pygame-ios
|
|
19
|
+
python -m pygame-ios
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
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.
|
|
23
|
+
|
|
24
|
+
Example usage:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pygame-ios . game.py # copies files from current folder, uses game.py as the entry point script
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
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.
|
|
31
|
+
|
|
32
|
+
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.
|
|
33
|
+
|
|
34
|
+
### Other Arguments
|
|
35
|
+
|
|
36
|
+
You can also specify a pygame-ce version:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pygame-ios . game.py 2.5.5 # fetches the v2.5.5 version of the template
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
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.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["flit_core >=3.11,<4"]
|
|
3
|
+
build-backend = "flit_core.buildapi"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pygame-ios"
|
|
7
|
+
authors = [{name = "Luke Lazzaro", email = "lazzdev@proton.me"}]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
license-files = ["LICENSE"]
|
|
11
|
+
dynamic = ["version", "description"]
|
|
12
|
+
requires-python = ">=3.13"
|
|
13
|
+
dependencies = ["requests"]
|
|
14
|
+
|
|
15
|
+
[project.urls]
|
|
16
|
+
Homepage = "https://github.com/seekerluke/pygame-ios"
|
|
17
|
+
Issues = "https://github.com/seekerluke/pygame-ios/issues"
|
|
18
|
+
|
|
19
|
+
[project.scripts]
|
|
20
|
+
pygame-ios = "pygame_ios.__main__:cli"
|
|
@@ -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()
|