From 4d6b089b3e11812e736b0199b0cbf021ea284f74 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 11 Jan 2024 11:19:34 +0800 Subject: [PATCH 1/3] Add extension points for permissions. --- cookiecutter.json | 7 +++++-- {{ cookiecutter.format }}/Entitlements.plist | 10 ++++++---- .../Contents/Info.plist | 6 ++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 53eaf65..0a5f28c 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -3,12 +3,15 @@ "formal_name": "App Name", "app_name": "{{ cookiecutter.formal_name|lower|replace(' ', '-') }}", "module_name": "{{ cookiecutter.app_name|replace('-', '_') }}", + "permissions": "", + "entitlements": "", + "document_types": "", "version": "1.0.0", "build": "1", "bundle": "com.example", - "document_types": {}, "python_version": "3.X.0", "_extensions": [ - "briefcase.integrations.cookiecutter.PythonVersionExtension" + "briefcase.integrations.cookiecutter.PythonVersionExtension", + "briefcase.integrations.cookiecutter.PListExtension" ] } diff --git a/{{ cookiecutter.format }}/Entitlements.plist b/{{ cookiecutter.format }}/Entitlements.plist index 7cd9df0..d7d79ec 100644 --- a/{{ cookiecutter.format }}/Entitlements.plist +++ b/{{ cookiecutter.format }}/Entitlements.plist @@ -2,9 +2,11 @@ - com.apple.security.cs.allow-unsigned-executable-memory - - com.apple.security.cs.disable-library-validation - +{%- if cookiecutter.entitlements -%} + {%- for entitlement, value in cookiecutter.entitlements.items() %} + {{ entitlement }} + {{ value|plist_value }} + {%- endfor -%} +{%- endif %} diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist index 3ba5049..d513664 100644 --- a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist +++ b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist @@ -79,5 +79,11 @@ {% endfor %} {% endif %} +{%- if cookiecutter.permissions -%} + {%- for permission, value in cookiecutter.permissions.items() %} + {{ permission }} + {{ value|plist_value }} + {%- endfor -%} +{%- endif %} From b42110f29c30d6822fa188ac13103f32907851b9 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 12 Jan 2024 11:00:12 +0800 Subject: [PATCH 2/3] Bumped the minimum version enforced. --- .../{{ cookiecutter.formal_name }}.app/Contents/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist index d513664..d944302 100644 --- a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist +++ b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist @@ -21,7 +21,7 @@ CFBundleVersion {{ cookiecutter.build }} LSMinimumSystemVersion - 10.12 + 11.0 NSPrincipalClass NSApplication MainModule From fb640adc48f07483822a29ead4cfc56d81ebd19f Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 12 Jan 2024 13:33:33 +0800 Subject: [PATCH 3/3] Use platform-appropriate keys in template context. --- cookiecutter.json | 2 +- .../{{ cookiecutter.formal_name }}.app/Contents/Info.plist | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 0a5f28c..3defe9e 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -3,7 +3,7 @@ "formal_name": "App Name", "app_name": "{{ cookiecutter.formal_name|lower|replace(' ', '-') }}", "module_name": "{{ cookiecutter.app_name|replace('-', '_') }}", - "permissions": "", + "info": "", "entitlements": "", "document_types": "", "version": "1.0.0", diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist index d944302..acecec5 100644 --- a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist +++ b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/Info.plist @@ -79,8 +79,8 @@ {% endfor %} {% endif %} -{%- if cookiecutter.permissions -%} - {%- for permission, value in cookiecutter.permissions.items() %} +{%- if cookiecutter.info -%} + {%- for permission, value in cookiecutter.info.items() %} {{ permission }} {{ value|plist_value }} {%- endfor -%}