Skip to content

Commit

Permalink
Merge pull request #4 from lbl-camera/mac
Browse files Browse the repository at this point in the history
Mac builds
  • Loading branch information
ronpandolfi authored Mar 14, 2023
2 parents 09774d4 + 35e6fc1 commit 986c888
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 19 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,36 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
files: Tsuchinoko*.exe
macbuild:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: macos-latest
strategy:
matrix:
python-version: [ '3.9' ]
steps:
- uses: actions/checkout@v2

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

- name: Install dependencies
run: |
pip install -e .[dev]
- name: pyinstaller
run: |
pyinstaller --noconfirm --clean tsuchinoko.spec
- name: rename to .app
run: |
mv dist/Tsuchinoko dist/Tsuchinoko.app
- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
files: dist/Tsuchinoko.app
2 changes: 1 addition & 1 deletion install.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
!include "x64.nsh"
!define MUI_BRANDINGTEXT "Tsuchinoko ${VERSION}"
!define MUI_PRODUCT "Tsuchinoko"
!define MUI_FILE "Tsuchinoko"
!define MUI_FILE "tsuchinoko_client"
CRCCheck On

;---------------------------------
Expand Down
53 changes: 36 additions & 17 deletions tsuchinoko.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# -*- mode: python ; coding: utf-8 -*-
import os
import glob
import sys

import dask
import distributed
import event_model
import torch

from tsuchinoko import assets, examples
import tsuchinoko
Expand Down Expand Up @@ -36,11 +38,17 @@ datas_dst.append('tsuchinoko/examples')
datas_src.append(os.path.join(examples.__path__[0], 'peak2.png'))
datas_dst.append('tsuchinoko/examples')

# functorch (mac only)
if sys.platform == 'darwin':
datas_src.append(os.path.join(torch.__path__[0],'lib','libiomp5.dylib'))
datas_dst.append('functools/.dylibs')


print('extras:')
print(list(zip(datas_src, datas_dst)))

a = Analysis(
['tsuchinoko\\examples\\client_demo.py'],
[os.path.join('tsuchinoko','examples','client_demo.py')],
pathex=[],
binaries=[],
datas=zip(datas_src, datas_dst),
Expand All @@ -52,7 +60,7 @@ a = Analysis(
'tsuchinoko.examples.quadtree_demo',
'tsuchinoko.examples.server_demo',
'tsuchinoko.examples.server_demo_bluesky',
'tsuchinoko.examples.vector_metric_demo'],
'tsuchinoko.examples.vector_metric_demo',],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
Expand All @@ -64,7 +72,7 @@ a = Analysis(
)

a2 = Analysis(
['tsuchinoko\\examples\\_launch_demo.py'],
[os.path.join('tsuchinoko','examples','_launch_demo.py')],
pathex=[],
binaries=[],
datas=zip(datas_src, datas_dst),
Expand All @@ -76,7 +84,7 @@ a2 = Analysis(
'tsuchinoko.examples.quadtree_demo',
'tsuchinoko.examples.server_demo',
'tsuchinoko.examples.server_demo_bluesky',
'tsuchinoko.examples.vector_metric_demo'],
'tsuchinoko.examples.vector_metric_demo',],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
Expand All @@ -96,12 +104,12 @@ exe = EXE(
a.scripts,
[],
exclude_binaries=True,
name='Tsuchinoko',
name='tsuchinoko_client',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
Expand All @@ -120,7 +128,7 @@ exe2 = EXE(
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
Expand All @@ -129,13 +137,24 @@ exe2 = EXE(
icon=assets.path('tsuchinoko.png')
)

coll = COLLECT(
exe, exe2,
a.binaries, a2.binaries,
a.zipfiles, a2.zipfiles,
a.datas, a2.datas,
strip=False,
upx=True,
upx_exclude=[],
name='Tsuchinoko',
)
print(f'platform: {sys.platform}')
if sys.platform == 'win32':
coll = COLLECT(
exe, exe2,
a.binaries, a2.binaries,
a.zipfiles, a2.zipfiles,
a.datas, a2.datas,
strip=False,
upx=True,
upx_exclude=[],
name='Tsuchinoko',
)
elif sys.platform == 'darwin':
app = BUNDLE(
exe, exe2, a.binaries, a2.binaries, a.zipfiles, a2.zipfiles, a.datas, a2.datas,
name='Tsuchinoko',
icon=assets.path('tsuchinoko.png'),
bundle_identifier=None,
)


3 changes: 2 additions & 1 deletion tsuchinoko/widgets/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ def start_demo(self, demo_key):
if result == QMessageBox.Cancel:
return

demo_exe = (Path(sys.executable).parent/'tsuchinoko_demo').with_suffix(Path(sys.executable).suffix)
suffix = Path(sys.executable).suffix
demo_exe = (Path(sys.executable).parent/'tsuchinoko_demo').with_suffix(suffix if suffix=='.exe' else '')
print(demo_exe)
self._server = subprocess.Popen([demo_exe, demo_key])

0 comments on commit 986c888

Please sign in to comment.