Skip to content

Commit

Permalink
Update Mac Packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
doadin committed Jan 14, 2022
1 parent d143100 commit 5e69b18
Show file tree
Hide file tree
Showing 2 changed files with 290 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/cd-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CD-Mac

on:
push:
tags-ignore:
- "*.dev0"
pull_request:
branches:
- develop

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
Build-Mac:
runs-on: macos-10.15
strategy:
matrix:
arch: [x64]
python: [3.9]
libtorrent: [1.2.15]

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python}}
architecture: ${{ matrix.arch }}

- name: Cache pip
uses: actions/cache@v2
with:
path: "~/Library/Caches/pip"
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('tox.ini', 'setup.py', 'requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
brew install gtk+3 adwaita-icon-theme
python -m pip install --upgrade pip
python -m pip install wheel pyinstaller PyGObject libtorrent==${{ matrix.libtorrent }}
pip install -r requirements.txt
- name: Install Deluge
run: |
pip install .
python setup.py install_scripts
- name: Freeze Deluge
run: |
pyinstaller --clean $GITHUB_WORKSPACE/packaging/osx/delugemac.spec --distpath $GITHUB_WORKSPACE/packaging/osx/freeze
hdiutil create -fs APFS -srcfolder $GITHUB_WORKSPACE/packaging/osx/freeze -volname Deluge $GITHUB_WORKSPACE/packaging/osx/freeze/Deluge.dmg
- uses: actions/upload-artifact@v2
with:
name: deluge-py${{matrix.python}}-lt${{matrix.libtorrent}}
path: packaging/osx/freeze/Deluge.dmg
225 changes: 225 additions & 0 deletions packaging/osx/delugemac.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@

# -*- mode: python ; coding: utf-8 -*-
import os
import sys
from PyInstaller.utils.hooks import collect_submodules, copy_metadata

datas = []
binaries = []
hiddenimports = []

# Collect Meta Data
datas += copy_metadata('deluge', recursive=True)
datas += copy_metadata('service-identity', recursive=True)

# Add Deluge Hidden Imports
hiddenimports += collect_submodules('deluge')

# Add Hidden Imports for Plugins
# Add stdlib as Hidden Imports.
# This is filtered list that excludes some common examples or stuff not useful in plugins (such as tty, mailbox, tutledemo etc.).
# It is safe to assume that 90% of that list would already be included anyway.
stdlib = [ 'pickle', 'json', 'email', 'http', 'marshal', 'uuid', 'base64', 'string', 'struct', 'glob', 'ssl', 'urllib', 'html', 'sys',
'crypt', 'datetime', 'hmac', 'locale', 'queue', 're', 'enum', 'collections', 'tokenize', 'hashlib', 'xml', 'csb', 'ipaddress', 'os' ]
for module in stdlib:
hiddenimports += collect_submodules('twisted', filter=lambda name: 'test' not in name)
datas += copy_metadata('twisted', recursive=True)

#Copy UI/Plugin files to where pyinstaller expects
datas += [ ('../../deluge/ui', 'deluge/ui'),
('../../deluge/plugins', 'deluge/plugins') ]

block_cipher = None


a = Analysis([os.path.abspath(os.path.join(HOMEPATH,os.pardir,os.pardir,os.pardir)) + '/bin/deluge-console'],
pathex=[],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='deluge-console',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
icon='../../deluge/ui/data/pixmaps/deluge.ico',
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )

b = Analysis([os.path.abspath(os.path.join(HOMEPATH,os.pardir,os.pardir,os.pardir)) + '/bin/deluge-gtk'],
pathex=[],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyzb = PYZ(b.pure, b.zipped_data,
cipher=block_cipher)
exeb = EXE(pyzb,
b.scripts,
[],
exclude_binaries=True,
name='deluge-gtk',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
icon='../../deluge/ui/data/pixmaps/deluge.ico',
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )

c = Analysis([os.path.abspath(os.path.join(HOMEPATH,os.pardir,os.pardir,os.pardir)) + '/bin/deluged'],
pathex=[],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyzc = PYZ(c.pure, c.zipped_data,
cipher=block_cipher)

exec = EXE(pyzc,
c.scripts,
[],
exclude_binaries=True,
name='deluged',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
icon='../../deluge/ui/data/pixmaps/deluge.ico',
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )

#f = Analysis([os.path.abspath(os.path.join(HOMEPATH,os.pardir,os.pardir,os.pardir)) + '/bin/deluge'],
# pathex=[],
# binaries=binaries,
# datas=datas,
# hiddenimports=hiddenimports,
# hookspath=[],
# hooksconfig={},
# runtime_hooks=[],
# excludes=[],
# win_no_prefer_redirects=False,
# win_private_assemblies=False,
# cipher=block_cipher,
# noarchive=False)
#pyzf = PYZ(f.pure, f.zipped_data,
# cipher=block_cipher)
#exef = EXE(pyzf,
# f.scripts,
# [],
# exclude_binaries=True,
# name='deluge',
# debug=False,
# bootloader_ignore_signals=False,
# strip=False,
# upx=True,
# icon='../../deluge/ui/data/pixmaps/deluge.ico',
# console=False,
# disable_windowed_traceback=False,
# target_arch=None,
# codesign_identity=None,
# entitlements_file=None )

h = Analysis([os.path.abspath(os.path.join(HOMEPATH,os.pardir,os.pardir,os.pardir)) + '/bin/deluge-web'],
pathex=[],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyzh = PYZ(h.pure, h.zipped_data,
cipher=block_cipher)
exeh = EXE(pyzh,
h.scripts,
[],
exclude_binaries=True,
name='deluge-web',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
icon='../../deluge/ui/data/pixmaps/deluge.ico',
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )

coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
exeb,
b.binaries,
b.zipfiles,
b.datas,
exec,
c.binaries,
c.zipfiles,
c.datas,
#exef,
#f.binaries,
#f.zipfiles,
#f.datas,
exeh,
h.binaries,
h.zipfiles,
h.datas,
strip=False,
upx=True,
upx_exclude=[],
name='Deluge')

if sys.platform == 'darwin':
app = BUNDLE(coll,
name='Deluge.app',
bundle_identifier=None,
icon='../../deluge/ui/data/pixmaps/deluge.ico',
version=build_version,
info_plist={
'NSPrincipalClass': 'NSApplication',
'NSAppleScriptEnabled': False,
})

0 comments on commit 5e69b18

Please sign in to comment.