Skip to content

Commit 7cca1ab

Browse files
committed
Fix some issues in the new optional code signing config.
* Reinstate separate signing identities for the app and installer. * Fix so that productbuild command actually works when DO_CODE_SIGNING=1. * Update README. * Remove vim-related junk added to the end of files.
1 parent c96776e commit 7cca1ab

File tree

4 files changed

+28
-25
lines changed

4 files changed

+28
-25
lines changed

README.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,21 @@ It displays a simple dialog and exits.
2323
1. Clone this repository or download a ZIP file of it:
2424
* `git clone https://github.com/davidfstr/Python-in-Mac-App-Store.git`
2525
* `cd Python-in-Mac-App-Store`
26-
2. Configure code signing:
27-
* **(Option 1)** If you have Mac App Store signing certificates, update the `SIGNING_IDENTITY` line in `./build-app.sh` and `./build-pkg.sh` to refer to them:
28-
* You will need an [Apple Developer account](https://developer.apple.com/devcenter/mac/) and a subscription to the Mac Developer Program ($99/year) to get signing certificates.
29-
* Create the appropriate Mac App Store certificates in the [Mac Dev Center](https://developer.apple.com/account/mac/certificate/) and download them to your dev machine.
30-
* **(Option 2)** If you do not have a Mac App Store signing certificate:
31-
1. Comment out all `codesign` commands in `./build-app.sh`.
32-
2. Remove the `--sign "$SIGNING_IDENTITY"` option from `./build-pkg.sh`
33-
3. With these modifications you will be able to build the app and the installer package, but you will not be able to submit them to the store.
34-
4. Build the app package `dist/HelloAppStore.app`:
26+
2. Build the app package `dist/HelloAppStore.app`:
3527
* `./build-app.sh`
36-
5. Build the installer package `dist/HelloAppStore.pkg`:
28+
3. Build the installer package `dist/HelloAppStore.pkg`:
3729
* `./build-pkg.sh`
3830

31+
For submission to the App Store you will also need to enable code signing:
32+
33+
1. Configure code signing:
34+
* Update the `SIGNING_IDENTITY` line in `code-signing-config.sh` to refer to your Mac App Store signing certificates:
35+
* You will need an [Apple Developer account](https://developer.apple.com/devcenter/mac/) and a subscription to the Mac Developer Program ($99/year) to get signing certificates.
36+
* Create the appropriate Mac App Store certificates in the [Mac Dev Center](https://developer.apple.com/account/mac/certificate/) and download them to your dev machine.
37+
* Change the `DO_CODE_SIGNING` line in `code-signing-config.sh` to assign
38+
`1` instead of `0`.
39+
2. Rebuild the app package and installer package using the same steps as above.
40+
3941
### How to Submit
4042

4143
1. Create a record for your app inside [iTunes Connect](https://itunesconnect.apple.com/).
@@ -50,7 +52,6 @@ It displays a simple dialog and exits.
5052

5153
## Writing your Own App?
5254

53-
5455
### Choosing a GUI Library
5556

5657
Any app you submit to the Mac App Store must have a GUI. In Python there are a few libraries available to create a GUI:

build-app.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ python setup.py py2app
2222

2323
# Limit Universal Binaries to only contain the architechures {i386, x86_64},
2424
# since these are the only architechures permitted on the Mac App Store.
25+
#
2526
# In addition, remove all i386 items since all Macs models from early 2007 and
2627
# newer have x86_64 support (aka Core 2 Duo or newer). This will save 1.1MB
2728
# of space in Python's libraries alone, more from other frameworks..
@@ -33,24 +34,23 @@ for i in ${APP_PATH}/Contents/Resources/lib/python2.7/lib-dynload/* ; do
3334
remove_arch i386 ${i}
3435
done
3536

37+
# Import configuration related to code signing
3638
source code-signing-config.sh
3739

3840
# Sign the app, frameworks, and all helper tools as required by the Mac App Store.
3941
# (This example app has no helper tools.)
4042
#
4143
# NOTE: Inner frameworks and tools must be signed before the outer app package.
4244
# NOTE: codesign with the -f option can incorrectly return exit status of 1
43-
4445
if [ ${DO_CODE_SIGNING} -eq 1 ] ; then
45-
codesign -s "$SIGNING_IDENTITY" -f \
46+
codesign -s "$SIGNING_IDENTITY_APP" -f \
4647
"$APP_PATH/Contents/Frameworks/Python.framework/Versions/2.7"
47-
codesign -s "$SIGNING_IDENTITY" -f \
48+
codesign -s "$SIGNING_IDENTITY_APP" -f \
4849
--entitlements src/app.entitlements \
4950
"$APP_PATH/Contents/MacOS/HelloAppStore"
50-
codesign -s "$SIGNING_IDENTITY" -f \
51+
codesign -s "$SIGNING_IDENTITY_APP" -f \
5152
--entitlements src/app.entitlements \
5253
"$APP_PATH/Contents/MacOS/python"
5354
fi
5455

5556
exit 0
56-
# vim:ts=4:sts=4:sw=4:et

build-pkg.sh

+7-8
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@ if [ ! -d dist/HelloAppStore.app ]; then
1010
exit 1
1111
fi
1212

13+
# Import configuration related to code signing
1314
source code-signing-config.sh
1415

15-
dash_dash_sign=''
1616
if [ ${DO_CODE_SIGNING} -eq 1 ] ; then
17-
dash_dash_sign="--sign ${SIGNING_IDENTITY}"
17+
# NOTE: If having trouble with signing, debug by removing the --sign flag and
18+
# trying to sign manually with the productsign command
19+
productbuild --component dist/HelloAppStore.app /Applications dist/HelloAppStore.pkg \
20+
--sign "${SIGNING_IDENTITY_INSTALLER}"
21+
else
22+
productbuild --component dist/HelloAppStore.app /Applications dist/HelloAppStore.pkg
1823
fi
1924

20-
# NOTE: If having trouble with signing, debug by removing the --sign flag and
21-
# trying to sign manually with the productsign command
22-
productbuild --component dist/HelloAppStore.app /Applications dist/HelloAppStore.pkg \
23-
$dash_dash_sign
24-
25-
# vim:ts=4:sts=4:sw=4:et

code-signing-config.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ DO_CODE_SIGNING=0
66

77
# The package signing identity corresponds to a "3rd Party Mac Developer Application"
88
# certificate that resides within the Keychain Access application.
9-
SIGNING_IDENTITY="3rd Party Mac Developer Application: David Foster"
9+
SIGNING_IDENTITY_APP="3rd Party Mac Developer Application: David Foster"
1010

11+
# The package signing identity corresponds to a "3rd Party Mac Developer Installer"
12+
# certificate that resides within the Keychain Access application.
13+
SIGNING_IDENTITY_INSTALLER="3rd Party Mac Developer Installer: David Foster"

0 commit comments

Comments
 (0)