diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 76178d2..2376b2c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 \ No newline at end of file diff --git a/install.nsi b/install.nsi index 25c8334..c0fd41c 100644 --- a/install.nsi +++ b/install.nsi @@ -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 ;--------------------------------- diff --git a/tsuchinoko.spec b/tsuchinoko.spec index 8eab841..bc72832 100644 --- a/tsuchinoko.spec +++ b/tsuchinoko.spec @@ -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 @@ -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), @@ -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=[], @@ -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), @@ -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=[], @@ -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, @@ -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, @@ -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, + ) + + diff --git a/tsuchinoko/widgets/mainwindow.py b/tsuchinoko/widgets/mainwindow.py index fcebc8e..8e8d11d 100644 --- a/tsuchinoko/widgets/mainwindow.py +++ b/tsuchinoko/widgets/mainwindow.py @@ -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])