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 9, 2022
1 parent e50927f commit bef4129
Show file tree
Hide file tree
Showing 2 changed files with 294 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/cd-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CD-Mac

on:
push:
branches:
- dev-mac

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

jobs:
Build-Mac:
runs-on: macos-10.15
strategy:
matrix:
include:
- arch: x64
pythonVersion: 3.7
libtorrent: 2.0.5

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.pythonVersion}}
architecture: ${{ matrix.arch }}

#- name: Cache pip
# uses: actions/cache@v2
# with:
# path: '%LOCALAPPDATA%\pip\Cache'
# # 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
env:
PYTHONVERSION: ${{ matrix.pythonVersion}}
ARCH: ${{ matrix.arch }}
LIBTORRENT: ${{ matrix.libtorrent }}
run: |
brew install gtk+3 adwaita-icon-theme
python -m pip install --upgrade pip wheel
python -m pip install libtorrent==2.0.5
python -m pip install PyGObject
pip install -r requirements.txt
pip install pyinstaller
- name: Install Deluge
run: |
python setup.py clean
python setup.py build
python setup.py install
- name: Freeze Deluge
run: |
pyinstaller --clean $GITHUB_WORKSPACE/packaging/osx/delugemac.spec --distpath $GITHUB_WORKSPACE/packaging/osx/freeze
find $GITHUB_WORKSPACE/packaging/osx/freeze -name 'requires.txt' | xargs rm
- uses: actions/upload-artifact@v2
with:
name: deluge-py${{matrix.pythonVersion}}-lt${{matrix.libtorrent}}
path: packaging/osx/freeze/Deluge.app
224 changes: 224 additions & 0 deletions packaging/osx/delugemac.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@

# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.compat import is_win
from PyInstaller.utils.hooks import collect_all, copy_metadata

datas = []
binaries = []
if is_win:
if "GITHUB_ACTIONS" in os.environ:
binaries += [('C:\\Program Files\\OpenSSL\\bin\\libcrypto-1_1-x64.dll', '.'),
('C:\\Program Files\\OpenSSL\\bin\\libssl-1_1-x64.dll', '.')]
hiddenimports = ['deluge', 'gi']
tmp_ret = collect_all('deluge')
datas += copy_metadata('service-identity', recursive=True)
datas += tmp_ret[0]
binaries += tmp_ret[1]
hiddenimports += tmp_ret[2]
# Get build_version from installed deluge.
import sys
import deluge.common
build_version = deluge.common.get_version()
datas += [ ('../../deluge/ui', 'deluge-' + build_version + '-py' + str(sys.version_info.major) + '.' + str(sys.version_info.minor) + '.egg/deluge/ui'),
('../../deluge/plugins', 'deluge-' + build_version + '-py' + str(sys.version_info.major) + '.' + str(sys.version_info.minor) + '.egg/deluge/plugins') ]
excludes = ['share\\icons\\Adwaita\\8',
'share\\icons\\Adwaita\\16',
'share\\icons\\Adwaita\\22',
'share\\icons\\Adwaita\\24',
'share\\icons\\Adwaita\\32',
'share\\icons\\Adwaita\\48',
'share\\icons\\Adwaita\\64',
'share\\icons\\Adwaita\\96',
'share\\icons\\Adwaita\\256',
'share\\icons\\Adwaita\\512',
'share\\icons\\Adwaita\\cursors',
'share\\icons\\Adwaita\\scalable-up']

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=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=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=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=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=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)

0 comments on commit bef4129

Please sign in to comment.