From c9cb6707616aa1ce48cca0960e662c84656f27d7 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 21 May 2016 19:55:37 -0400 Subject: [PATCH] Improve codesign_xpc script by taking files instead of a directory --- INSTALL | 2 +- bin/{codesign_xpc_services => codesign_xpc} | 24 +++++++-------------- 2 files changed, 9 insertions(+), 17 deletions(-) rename bin/{codesign_xpc_services => codesign_xpc} (50%) diff --git a/INSTALL b/INSTALL index 5a955958..c3bbfec6 100644 --- a/INSTALL +++ b/INSTALL @@ -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. diff --git a/bin/codesign_xpc_services b/bin/codesign_xpc similarity index 50% rename from bin/codesign_xpc_services rename to bin/codesign_xpc index 2b65f791..a9088462 100755 --- a/bin/codesign_xpc_services +++ b/bin/codesign_xpc @@ -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 " % (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)