From 9b13efacba292828f8c69b2d8ca1e0504ea92125 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:28:34 +0100 Subject: [PATCH 1/7] fixed macOS build folder path --- .github/workflows/build_multiplatform.yml | 24 ++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_multiplatform.yml b/.github/workflows/build_multiplatform.yml index ff00e89a..75bd8387 100644 --- a/.github/workflows/build_multiplatform.yml +++ b/.github/workflows/build_multiplatform.yml @@ -294,8 +294,8 @@ jobs: # now build tnc binaries pyinstaller -y freedata.spec # and to some final cleanup - cp -r -f dist/tnc/* dist/ - rm -r dist/tnc + # cp -r -f dist/tnc/* dist/ + # rm -r dist/tnc - name: Build binaries Linux and Windows if: ${{!startsWith(matrix.os, 'macos')}} @@ -338,10 +338,23 @@ jobs: - name: LIST ALL FILES run: ls -R - - name: Download Portaudio binaries + - name: Download Portaudio binaries Linux macOS + if: ${{!startsWith(matrix.os, 'windows')}} working-directory: tnc run: | - git clone https://github.com/spatialaudio/portaudio-binaries dist/tnc/_sounddevice_data/portaudio-binaries + if ! test -d "dist/_sounddevice_data"; then + git clone https://github.com/spatialaudio/portaudio-binaries dist/_sounddevice_data/portaudio-binaries + fi + + - name: Download Portaudio binaries Windows + if: ${{startsWith(matrix.os, 'windows')}} + working-directory: tnc + run: | + if(Test-Path -Path "dist/_sounddevice_data"){ + echo "sounddevice folder already exists" + } else { + git clone https://github.com/spatialaudio/portaudio-binaries dist/_sounddevice_data/portaudio-binaries + } - name: LIST ALL FILES run: ls -R @@ -355,9 +368,6 @@ jobs: - name: Build/release Electron app uses: samuelmeuli/action-electron-builder@v1 - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} with: package_root: "./gui/" github_token: ${{ secrets.github_token }} From caaf61344664276a00698e7a69ff55f86b4ed380 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:58:07 +0100 Subject: [PATCH 2/7] version update --- gui/package.json | 2 +- tnc/static.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/package.json b/gui/package.json index 5733e0a8..23d48169 100644 --- a/gui/package.json +++ b/gui/package.json @@ -1,6 +1,6 @@ { "name": "FreeDATA", - "version": "0.6.12-alpha.1", + "version": "0.6.12-alpha.2", "description": "FreeDATA ", "main": "main.js", "scripts": { diff --git a/tnc/static.py b/tnc/static.py index 78174ffd..45d4e166 100644 --- a/tnc/static.py +++ b/tnc/static.py @@ -11,7 +11,7 @@ Not nice, suggestions are appreciated :-) import subprocess from enum import Enum -VERSION = "0.6.12-alpha.1" +VERSION = "0.6.12-alpha.2" ENABLE_EXPLORER = False From f18604a38b3d806fd19dede01c2f8886ce2d20cf Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sun, 22 Jan 2023 21:47:14 +0100 Subject: [PATCH 3/7] possible hotfix for missing portaudio --- .github/workflows/build_multiplatform.yml | 6 +++--- gui/package.json | 2 +- tnc/daemon.py | 25 +++++++++++++++++++---- tnc/static.py | 2 +- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_multiplatform.yml b/.github/workflows/build_multiplatform.yml index 75bd8387..1a418526 100644 --- a/.github/workflows/build_multiplatform.yml +++ b/.github/workflows/build_multiplatform.yml @@ -342,8 +342,8 @@ jobs: if: ${{!startsWith(matrix.os, 'windows')}} working-directory: tnc run: | - if ! test -d "dist/_sounddevice_data"; then - git clone https://github.com/spatialaudio/portaudio-binaries dist/_sounddevice_data/portaudio-binaries + if ! test -d "dist/tnc/_sounddevice_data"; then + git clone https://github.com/spatialaudio/portaudio-binaries dist/tnc/_sounddevice_data/portaudio-binaries fi - name: Download Portaudio binaries Windows @@ -353,7 +353,7 @@ jobs: if(Test-Path -Path "dist/_sounddevice_data"){ echo "sounddevice folder already exists" } else { - git clone https://github.com/spatialaudio/portaudio-binaries dist/_sounddevice_data/portaudio-binaries + git clone https://github.com/spatialaudio/portaudio-binaries dist/tnc/_sounddevice_data/portaudio-binaries } - name: LIST ALL FILES diff --git a/gui/package.json b/gui/package.json index 23d48169..6c489339 100644 --- a/gui/package.json +++ b/gui/package.json @@ -1,6 +1,6 @@ { "name": "FreeDATA", - "version": "0.6.12-alpha.2", + "version": "0.6.12-alpha.3", "description": "FreeDATA ", "main": "main.js", "scripts": { diff --git a/tnc/daemon.py b/tnc/daemon.py index 7a013b4f..0b9ced02 100755 --- a/tnc/daemon.py +++ b/tnc/daemon.py @@ -262,15 +262,30 @@ class DAEMON: # safe data to config file config.write_entire_config(data) + import os, sys + import sys + + + # Try running tnc from binary, else run from source # This helps running the tnc in a developer environment try: command = [] - if sys.platform in ["linux", "darwin"]: - command.append("./freedata-tnc") - elif sys.platform in ["win32", "win64"]: - command.append("freedata-tnc.exe") + + if getattr(sys, 'frozen', False): + # If the application is run as a bundle, the PyInstaller bootloader + # extends the sys module by a flag frozen=True and sets the app + # path into variable _MEIPASS'. + application_path = sys._MEIPASS + command.append(application_path + '/freedata-tnc') + + else: + + if sys.platform in ["linux", "darwin"]: + command.append("./freedata-tnc") + elif sys.platform in ["win32", "win64"]: + command.append("freedata-tnc.exe") command += options proc = subprocess.Popen(command) @@ -281,6 +296,7 @@ class DAEMON: except FileNotFoundError as err1: self.log.info("[DMN] worker: ", e=err1) command = [] + if sys.platform in ["linux", "darwin"]: command.append("python3") elif sys.platform in ["win32", "win64"]: @@ -288,6 +304,7 @@ class DAEMON: command.append("main.py") command += options + print(command) proc = subprocess.Popen(command) atexit.register(proc.kill) diff --git a/tnc/static.py b/tnc/static.py index 45d4e166..6cc7b20e 100644 --- a/tnc/static.py +++ b/tnc/static.py @@ -11,7 +11,7 @@ Not nice, suggestions are appreciated :-) import subprocess from enum import Enum -VERSION = "0.6.12-alpha.2" +VERSION = "0.6.12-alpha.3" ENABLE_EXPLORER = False From 6ae542230f5d24ac372192d71e9194250a52c5f4 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sun, 22 Jan 2023 22:05:07 +0100 Subject: [PATCH 4/7] fixed path env --- .github/workflows/build_multiplatform.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_multiplatform.yml b/.github/workflows/build_multiplatform.yml index 1a418526..a289da6c 100644 --- a/.github/workflows/build_multiplatform.yml +++ b/.github/workflows/build_multiplatform.yml @@ -368,6 +368,9 @@ jobs: - name: Build/release Electron app uses: samuelmeuli/action-electron-builder@v1 + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} with: package_root: "./gui/" github_token: ${{ secrets.github_token }} From 5a3f367a33f16f10c07c1455afd813160f2b8526 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sun, 22 Jan 2023 22:05:29 +0100 Subject: [PATCH 5/7] version update --- gui/package.json | 2 +- tnc/static.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/package.json b/gui/package.json index 6c489339..91e6bf00 100644 --- a/gui/package.json +++ b/gui/package.json @@ -1,6 +1,6 @@ { "name": "FreeDATA", - "version": "0.6.12-alpha.3", + "version": "0.6.12-alpha.4", "description": "FreeDATA ", "main": "main.js", "scripts": { diff --git a/tnc/static.py b/tnc/static.py index 6cc7b20e..f46f5959 100644 --- a/tnc/static.py +++ b/tnc/static.py @@ -11,7 +11,7 @@ Not nice, suggestions are appreciated :-) import subprocess from enum import Enum -VERSION = "0.6.12-alpha.3" +VERSION = "0.6.12-alpha.4" ENABLE_EXPLORER = False From 1b90d38ebffc1f049aecd3794dab3ca525712885 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sun, 22 Jan 2023 22:39:23 +0100 Subject: [PATCH 6/7] fixed wrong pyinstaller env detection for windows --- gui/package.json | 2 +- tnc/daemon.py | 2 +- tnc/static.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/package.json b/gui/package.json index 91e6bf00..b82ff9f9 100644 --- a/gui/package.json +++ b/gui/package.json @@ -1,6 +1,6 @@ { "name": "FreeDATA", - "version": "0.6.12-alpha.4", + "version": "0.6.12-alpha.5", "description": "FreeDATA ", "main": "main.js", "scripts": { diff --git a/tnc/daemon.py b/tnc/daemon.py index 0b9ced02..c7b5b5bc 100755 --- a/tnc/daemon.py +++ b/tnc/daemon.py @@ -273,7 +273,7 @@ class DAEMON: try: command = [] - if getattr(sys, 'frozen', False): + if (getattr(sys, 'frozen', False) or hasattr(sys, "_MEIPASS")) and sys.platform in ["darwin"]: # If the application is run as a bundle, the PyInstaller bootloader # extends the sys module by a flag frozen=True and sets the app # path into variable _MEIPASS'. diff --git a/tnc/static.py b/tnc/static.py index f46f5959..2b3e7f25 100644 --- a/tnc/static.py +++ b/tnc/static.py @@ -11,7 +11,7 @@ Not nice, suggestions are appreciated :-) import subprocess from enum import Enum -VERSION = "0.6.12-alpha.4" +VERSION = "0.6.12-alpha.5" ENABLE_EXPLORER = False From f7bcdad47f9a1cefe03400c6f2ac962a63bf362d Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sun, 22 Jan 2023 23:35:52 +0100 Subject: [PATCH 7/7] finally working macOS build --- gui/package.json | 2 +- tnc/codec2.py | 13 ++++++++----- tnc/static.py | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gui/package.json b/gui/package.json index b82ff9f9..d7a80412 100644 --- a/gui/package.json +++ b/gui/package.json @@ -1,6 +1,6 @@ { "name": "FreeDATA", - "version": "0.6.12-alpha.5", + "version": "0.6.12-alpha.6", "description": "FreeDATA ", "main": "main.js", "scripts": { diff --git a/tnc/codec2.py b/tnc/codec2.py index f9219c2f..903dd04a 100644 --- a/tnc/codec2.py +++ b/tnc/codec2.py @@ -60,17 +60,20 @@ def freedv_get_mode_name_by_value(mode: int) -> str: # Check if we are running in a pyinstaller environment -if hasattr(sys, "_MEIPASS"): - sys.path.append(getattr(sys, "_MEIPASS")) -else: - sys.path.append(os.path.abspath(".")) +#if hasattr(sys, "_MEIPASS"): +# sys.path.append(getattr(sys, "_MEIPASS")) +#else: +sys.path.append(os.path.abspath(".")) log.info("[C2 ] Searching for libcodec2...") if sys.platform == "linux": files = glob.glob(r"**/*libcodec2*", recursive=True) files.append("libcodec2.so") elif sys.platform == "darwin": - files = glob.glob(r"**/*libcodec2*.dylib", recursive=True) + if hasattr(sys, "_MEIPASS"): + files = glob.glob(getattr(sys, "_MEIPASS") + '/**/*libcodec2*', recursive=True) + else: + files = glob.glob(r"**/*libcodec2*.dylib", recursive=True) elif sys.platform in ["win32", "win64"]: files = glob.glob(r"**\*libcodec2*.dll", recursive=True) else: diff --git a/tnc/static.py b/tnc/static.py index 2b3e7f25..af52a46b 100644 --- a/tnc/static.py +++ b/tnc/static.py @@ -11,7 +11,7 @@ Not nice, suggestions are appreciated :-) import subprocess from enum import Enum -VERSION = "0.6.12-alpha.5" +VERSION = "0.6.12-alpha.6" ENABLE_EXPLORER = False