mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-30 05:28:50 +00:00
Improve codesign_xpc script by taking files instead of a directory
This commit is contained in:
1 parent
cd135d9b10
commit
c9cb670761
2 files changed
+9
-17
No files matched your search
@@ -17,7 +17,7 @@ Sparkle has a few components that can optionally be handed off to XPC services.
|
||||
If you code sign your application, these XPC services will also need to be signed by you with the attached entitlements. Included is a script to automate this.
|
||||
|
||||
Here is an example of invoking the script with my Developer ID:
|
||||
> ./bin/codesign_xpc_services "Developer ID Application" XPCServices/
|
||||
> ./bin/codesign_xpc "Developer ID Application" XPCServices/*.xpc
|
||||
|
||||
After signing the services, copy them into your project and set up a build phase to embed the XPC Services into your application.
|
||||
|
||||
|
||||
@@ -20,23 +20,15 @@ def codesign_service(identity, path, entitlements_path=None):
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 3:
|
||||
log_message("Usage:\n\t%s <code-signing-identity> <xpc-services-directory>" % (sys.argv[0]))
|
||||
log_message("Example:\n\t%s \"Developer ID Application\" ./XPCServices" % (sys.argv[0]))
|
||||
log_message("Usage:\n\t%s code-signing-identity xpc-service xpc-service2 ..." % (sys.argv[0]))
|
||||
log_message("Example:\n\t%s \"Developer ID Application\" ./XPCServices/*.xpc" % (sys.argv[0]))
|
||||
sys.exit(1)
|
||||
|
||||
signing_identity = sys.argv[1]
|
||||
xpc_services = sys.argv[2]
|
||||
xpc_services = sys.argv[2:]
|
||||
|
||||
if os.path.islink(xpc_services) or not os.path.isdir(xpc_services):
|
||||
log_message("Error: %s is not a directory" % (xpc_services))
|
||||
sys.exit(1)
|
||||
|
||||
for filename in os.listdir(xpc_services):
|
||||
if filename.startswith(".") or not os.path.splitext(filename)[1] == ".xpc":
|
||||
continue
|
||||
|
||||
service_path = os.path.join(xpc_services, filename)
|
||||
service_name = os.path.splitext(filename)[0]
|
||||
entitlements_path = os.path.join(xpc_services, service_name + ".entitlements")
|
||||
|
||||
codesign_service(signing_identity, service_path, None if not os.path.exists(entitlements_path) else entitlements_path)
|
||||
for xpc_service in xpc_services:
|
||||
parent, child = os.path.split(xpc_service)
|
||||
service_name = os.path.splitext(child)[0]
|
||||
entitlements_path = os.path.join(parent, service_name + ".entitlements")
|
||||
codesign_service(signing_identity, xpc_service, None if not os.path.exists(entitlements_path) else entitlements_path)
|
||||
Reference in new issue
Block a user