Skip to content

Commit

Permalink
Merge pull request #21766 from mrclary/v5.5.0_1
Browse files Browse the repository at this point in the history
PR: Build arm64 versions of Spyder's standalone macOS application
  • Loading branch information
ccordoba12 authored Feb 6, 2024
2 parents 672d440 + 5501b48 commit 7288eb2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/installer-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ jobs:
echo "build_type=[${build_type}]" >> $GITHUB_OUTPUT
build:
name: macOS App Bundle
runs-on: macos-11
runs-on: ${{ matrix.os }}
needs: matrix_prep
strategy:
matrix:
build_type: ${{fromJson(needs.matrix_prep.outputs.build_type)}}
os: ["macos-11", "macos-14"]
defaults:
run:
shell: bash -l {0}
Expand All @@ -69,10 +70,9 @@ jobs:
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9.14'
architecture: 'x64'
python-version: '3.10.11'
- name: Install pcregrep
run: |
if [[ -z "$(which pcregrep)" ]]; then
Expand All @@ -88,8 +88,8 @@ jobs:
fi
${pythonLocation}/bin/python -m pip install -U pip setuptools wheel
${pythonLocation}/bin/python -m pip install -r req-build.txt -r req-extras.txt -r req-plugins.txt "${INSTALL_FLAGS[@]}" -e ${GITHUB_WORKSPACE}
- name: Add mising file to Black dist-info
run: touch ${pythonLocation}/lib/python3.9/site-packages/black-23.12.0.dist-info/top_level.txt
- name: Add missing file to Black dist-info
run: touch ${pythonLocation}/lib/python3.10/site-packages/black-24.1.1.dist-info/top_level.txt
- name: Install Subrepos
if: ${{github.event_name == 'pull_request'}}
run: ${pythonLocation}/bin/python -bb -X dev -W error ${GITHUB_WORKSPACE}/install_dev_repos.py --not-editable --no-install spyder
Expand All @@ -105,7 +105,7 @@ jobs:
- name: Build Application Bundle
run: ${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR}
- name: Add missing Black module to bundle
run: cp -v ${pythonLocation}/lib/python3.9/site-packages/629853fdff261ed89b74__mypyc* ${DISTDIR}/Spyder.app/Contents/Resources/lib/python3.9/
run: cp -v ${pythonLocation}/lib/python3.10/site-packages/629853fdff261ed89b74__mypyc* ${DISTDIR}/Spyder.app/Contents/Resources/lib/python3.10/
- name: Create Keychain
if: ${{env.IS_RELEASE == 'true' || env.IS_PRE == 'true'}}
run: ./certkeychain.sh "${MACOS_CERTIFICATE}" "${MACOS_CERTIFICATE_PWD}"
Expand All @@ -119,7 +119,10 @@ jobs:
- name: Test Application Bundle
run: ./test_app.sh -t 60 -d 10 ${DISTDIR}
- name: Build Disk Image
run: ${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR} --dmg --no-app
run: |
DMGNAME=$(${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dmg-name)
${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR} --dmg --no-app
echo "DMGNAME=$DMGNAME" >> $GITHUB_ENV
- name: Sign Disk Image
if: ${{env.IS_RELEASE == 'true' || env.IS_PRE == 'true'}}
run: ./codesign.sh "${DISTDIR}/${DMGNAME}"
Expand All @@ -136,7 +139,7 @@ jobs:
id: get_release
env:
GITHUB_TOKEN: ${{ github.token }}
uses: bruceadams/get-release@v1.2.0
uses: bruceadams/get-release@v1.3.2
- name: Upload Release Asset
if: ${{env.IS_RELEASE == 'true'}}
uses: actions/upload-release-asset@v1
Expand Down
2 changes: 1 addition & 1 deletion installers/macOS/req-build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
dmgbuild>=1.4.2
py2app==0.28.4
sphinx==5.1.1 # See spyder-ide/spyder#19618 for details.
black==23.12.0 # Pin it to add missing modules to the bundle. See workflow file for the details.
black==24.1.1 # Pin it to add missing modules to the bundle. See workflow file for the details.
26 changes: 22 additions & 4 deletions installers/macOS/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from logging import getLogger, StreamHandler, Formatter
from pathlib import Path
from setuptools import setup
from platform import machine

from spyder import get_versions

Expand Down Expand Up @@ -98,6 +99,18 @@ def make_app_bundle(dist_dir, make_lite=False):
return


def disk_image_name(make_lite=False):
"""
Return disk image name
"""
dmg_name = f'Spyder-{SPYVER}_{machine()}'
if make_lite:
dmg_name += '-Lite'
dmg_name += '.dmg'

return dmg_name


def make_disk_image(dist_dir, make_lite=False):
"""
Make macOS disk image containing Spyder.app application bundle.
Expand All @@ -117,12 +130,9 @@ def make_disk_image(dist_dir, make_lite=False):
from dmgbuild.core import DMGError

volume_name = '{}-{} Py-{}.{}.{}'.format(APP_BASE_NAME, SPYVER, *PYVER)
dmg_name = 'Spyder'
if make_lite:
volume_name += ' Lite'
dmg_name += '-Lite'
dmg_name += '.dmg'
dmgfile = (dist_dir / dmg_name).as_posix()
dmgfile = (dist_dir / disk_image_name(make_lite)).as_posix()

settings_file = (THISDIR / 'dmg_settings.py').as_posix()
settings = {
Expand Down Expand Up @@ -162,9 +172,17 @@ def make_disk_image(dist_dir, make_lite=False):
parser.add_argument('-b', '--bdist-base', dest='build_dir',
default='build',
help='Build directory; passed to py2app')
parser.add_argument(
'-m', '--dmg-name', dest='dmg_name', action='store_true',
help='Return the DMG name: Spyder-{VER}_{ARCH}-{LITE}.dmg'
)

args, rem = parser.parse_known_args()

if args.dmg_name:
print(disk_image_name(args.make_lite))
sys.exit()

# Groom sys.argv for py2app
sys.argv = sys.argv[:1] + ['py2app'] + rem

Expand Down

0 comments on commit 7288eb2

Please sign in to comment.