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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13-dev" ]
framework: [ "toga" ]
14 changes: 7 additions & 7 deletions {{ cookiecutter.format }}/briefcase.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Generated using Python {{ cookiecutter.python_version }}
[briefcase]
# This is the start of the new-style dylib era.
target_version = "0.3.16"
# This is the start of the PEP 730 framework era.
target_version = "0.3.20"

[paths]
app_path = "{{ cookiecutter.class_name }}/app"
app_packages_path = "{{ cookiecutter.class_name }}/app_packages"
info_plist_path = "{{ cookiecutter.class_name }}/{{ cookiecutter.class_name }}-Info.plist"
support_path = "Support"
{{ {
"3.8": "support_revision = 14",
"3.9": "support_revision = 12",
"3.10": "support_revision = 8",
"3.11": "support_revision = 3",
"3.12": "support_revision = 2",
"3.9": "support_revision = 13",
"3.10": "support_revision = 9",
"3.11": "support_revision = 4",
"3.12": "support_revision = 3",
"3.13": "support_revision = 0",
}.get(cookiecutter.python_version|py_tag, "") }}

icon.20 = "{{ cookiecutter.class_name }}/Images.xcassets/AppIcon.appiconset/icon-20.png"
Expand Down
34 changes: 18 additions & 16 deletions {{ cookiecutter.format }}/{{ cookiecutter.class_name }}/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#include <Python.h>
#include <Python/Python.h>
#include <dlfcn.h>


Expand All @@ -17,6 +17,7 @@ int main(int argc, char *argv[]) {
PyStatus status;
PyPreConfig preconfig;
PyConfig config;
NSString *python_tag;
NSString *python_home;
NSString *app_module_name;
NSString *path;
Expand All @@ -35,7 +36,7 @@ int main(int argc, char *argv[]) {
PyObject *systemExit_code;

@autoreleasepool {
NSString * resourcePath = [[NSBundle mainBundle] resourcePath];
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];

// Generate an isolated Python configuration.
NSLog(@"Configuring isolated Python...");
Expand Down Expand Up @@ -65,7 +66,8 @@ int main(int argc, char *argv[]) {
}

// Set the home for the Python interpreter
python_home = [NSString stringWithFormat:@"%@/python-stdlib", resourcePath, nil];
python_tag = @"{{ cookiecutter.python_version|py_tag }}";
python_home = [NSString stringWithFormat:@"%@/python", resourcePath, nil];
NSLog(@"PythonHome: %@", python_home);
wtmp_str = Py_DecodeLocale([python_home UTF8String], NULL);
status = PyConfig_SetString(&config, &config.home, wtmp_str);
Expand Down Expand Up @@ -99,20 +101,20 @@ int main(int argc, char *argv[]) {

// Set the full module path. This includes the stdlib, site-packages, and app code.
NSLog(@"PYTHONPATH:");
// // The .zip form of the stdlib
// path = [NSString stringWithFormat:@"%@/python{{ cookiecutter.python_version|py_libtag }}.zip", resourcePath, nil];
// NSLog(@"- %@", path);
// wtmp_str = Py_DecodeLocale([path UTF8String], NULL);
// status = PyWideStringList_Append(&config.module_search_paths, wtmp_str);
// if (PyStatus_Exception(status)) {
// crash_dialog([NSString stringWithFormat:@"Unable to set .zip form of stdlib path: %s", status.err_msg, nil]);
// PyConfig_Clear(&config);
// Py_ExitStatusException(status);
// }
// PyMem_RawFree(wtmp_str);

// The unpacked form of the stdlib
path = [NSString stringWithFormat:@"%@/python-stdlib", resourcePath, nil];
path = [NSString stringWithFormat:@"%@/lib/python%@", python_home, python_tag, nil];
NSLog(@"- %@", path);
wtmp_str = Py_DecodeLocale([path UTF8String], NULL);
status = PyWideStringList_Append(&config.module_search_paths, wtmp_str);
if (PyStatus_Exception(status)) {
crash_dialog([NSString stringWithFormat:@"Unable to set unpacked form of stdlib path: %s", status.err_msg, nil]);
PyConfig_Clear(&config);
Py_ExitStatusException(status);
}
PyMem_RawFree(wtmp_str);

// The binary modules in the stdlib
path = [NSString stringWithFormat:@"%@/lib/python%@/lib-dynload", python_home, python_tag, nil];
NSLog(@"- %@", path);
wtmp_str = Py_DecodeLocale([path UTF8String], NULL);
status = PyWideStringList_Append(&config.module_search_paths, wtmp_str);
Expand Down
Loading