From c9045ca44921b90b5fcc492a894171153fc9ecd0 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 11 Jan 2024 11:20:14 +0800 Subject: [PATCH 1/2] Add extension points for permissions. --- cookiecutter.json | 7 +++++-- .../{{ cookiecutter.class_name }}/Info.plist | 6 ++++++ .../{{ cookiecutter.app_name }}.entitlements | 10 ++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 46c6748..6903ea2 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -6,13 +6,16 @@ "module_name": "{{ cookiecutter.app_name|replace('-', '_') }}", "author": "Example Corporation", "bundle": "com.example", + "permissions": "", + "entitlements": "", + "document_types": "", "version": "1.0", "build": "1", - "document_types": {}, "python_version": "3.X.0", "universal_build": true, "host_arch": "arm64", "_extensions": [ - "briefcase.integrations.cookiecutter.PythonVersionExtension" + "briefcase.integrations.cookiecutter.PythonVersionExtension", + "briefcase.integrations.cookiecutter.PListExtension" ] } diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/Info.plist b/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/Info.plist index 64fdc49..4202916 100644 --- a/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/Info.plist +++ b/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/Info.plist @@ -83,5 +83,11 @@ {% endfor %} {% endif %} +{%- if cookiecutter.permissions -%} + {%- for permission, value in cookiecutter.permissions.items() %} + {{ permission }} + {{ value|plist_value }} + {%- endfor -%} +{%- endif %} diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/{{ cookiecutter.app_name }}.entitlements b/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/{{ cookiecutter.app_name }}.entitlements index 6883e4a..d7d79ec 100644 --- a/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/{{ cookiecutter.app_name }}.entitlements +++ b/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/{{ cookiecutter.app_name }}.entitlements @@ -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 %} From 478edd65bcecf439cc87d0fa29bc12de45e59046 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 12 Jan 2024 13:33:45 +0800 Subject: [PATCH 2/2] Use platform-appropriate keys in template context. --- cookiecutter.json | 2 +- .../{{ cookiecutter.class_name }}/Info.plist | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 6903ea2..1891354 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -6,7 +6,7 @@ "module_name": "{{ cookiecutter.app_name|replace('-', '_') }}", "author": "Example Corporation", "bundle": "com.example", - "permissions": "", + "info": "", "entitlements": "", "document_types": "", "version": "1.0", diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/Info.plist b/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/Info.plist index 4202916..7823e53 100644 --- a/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/Info.plist +++ b/{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/Info.plist @@ -83,8 +83,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 -%}