Skip to content

Commit

Permalink
Add support for Python 3.11.
Browse files Browse the repository at this point in the history
  • Loading branch information
culler committed Oct 29, 2023
1 parent b8d9bdc commit 05b407f
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 11 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/python311.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: macOS

on: [push]

jobs:
build_app:
name: Build macOS application bundle
runs-on: macos-13

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Use Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
DEV_ID: ${{ secrets.DEV_ID }}
DEV_USERNAME: ${{ secrets.NOTARIZE_USERNAME }}
DEV_PASSWORD: ${{ secrets.NOTARIZE_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
touch $CERTIFICATE_PATH
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 -d -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# Create config file needed by release.py
echo "IDENTITY=$DEV_ID" >> macOS/IDs.sh
echo "USERNAME=$DEV_USERNAME" >> macOS/IDs.sh
echo "PASSWORD=$DEV_PASSWORD" >> macOS/IDs.sh
- name: install bundle-app
run: |
python3.11 -m pip install bundle-app
- name: assemble bundle
run: |
python3.11 build-mac-app.py
- uses: actions/upload-artifact@v3
with:
name: SnapPy.dmg
path: ./macOS/dmg-maker/SnapPy.dmg
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ jobs:
- name: install bundle-app
run: |
python3 -m pip install bundle-app
python3.12 -m pip install bundle-app
- name: assemble bundle
run: |
bash build-mac-app.sh
python3.12 build-mac-app.py
- uses: actions/upload-artifact@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.pyc
__pycache__
*.tgz
*.dmg
dist
IDs.sh
16 changes: 16 additions & 0 deletions build-mac-app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import sys
import os
from shutil import rmtree
from subprocess import check_call

os.chdir('macOS')
app = os.path.join('snappy', 'SnapPy.app')
if os.path.exists(app):
rmtree(app)
check_call([sys.executable, 'bin/make-bundle.py'])
check_call(['/bin/bash', 'bin/sign-bundle.sh'])
if os.path.exists('dist'):
rmtree('dist')
os.renames('snappy/SnapPy.app', 'dist/SnapPy.app')
check_call(['/bin/bash', 'bin/notarize.sh'])

9 changes: 9 additions & 0 deletions macOS/bin/make-bundle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import sys
import os
import subprocess

os.chdir('snappy')
subprocess.check_call([sys.executable, '-m', 'bundle_app.build'])
subprocess.check_call([sys.executable, '-m', 'bundle_app.add_packages'])
subprocess.check_call([sys.executable, '-m', 'bundle_app.streamline'])

5 changes: 0 additions & 5 deletions macOS/bin/make-bundle.sh

This file was deleted.

14 changes: 11 additions & 3 deletions macOS/snappy/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,16 @@ OSAScriptingDefinition = "SnapPy.sdef"
CFBundleTypeExtensions = [ "py", ]
CFBundleTypeMIMETypes = [ "application/x-python", ]
CFBundleTypeOSTypes = [ "TEXT", "****", ]
CFBundleTypeRole = "Viewer"
[[CFBundleDocumentTypes]]
CFBundleTypeName = "Plain text file"
CFBundleTypeExtensions = [ "txt", ]
CFBundleTypeName = "Triangulation"
CFBundleTypeExtensions = [ "tri", ]
CFBundleTypeMIMETypes = [ "application/text", ]
CFBundleTypeOSTypes = [ "TEXT", "****", ]
CFBundleTypeOSTypes = [ "TEXT", "****", ]
CFBundleTypeRole = "Viewer"
[[CFBundleDocumentTypes]]
CFBundleTypeName = "Link projection"
CFBundleTypeExtensions = [ "tri", ]
CFBundleTypeMIMETypes = [ "application/text", ]
CFBundleTypeOSTypes = [ "TEXT", "****", ]
CFBundleTypeRole = "Viewer"
2 changes: 1 addition & 1 deletion macOS/snappy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
snappy
snappy >=3.1.1
snappy-15-knots

0 comments on commit 05b407f

Please sign in to comment.