Skip to content

Commit

Permalink
Macos builds: install latest portaudio
Browse files Browse the repository at this point in the history
For Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup.
So we install from latest master instead, and we tell pyinstaller to bundle that version instead of the version provided by python-sounddevice.
See #154

Also remove the vcruntime140.dll workaround that is not needed with latest pyinstaller, and was getting confusing to apply next to the Macos setting.
  • Loading branch information
tlecomte committed Jan 23, 2021
1 parent b53f4d5 commit f6ac5fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/install-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@ pip3 install -r requirements.txt
# pyinstaller needs to have the extensions built explicitely
python3 setup.py build_ext --inplace

# for Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup
# install from latest master instead
# see: https://github.com/tlecomte/friture/issues/154
brew install portaudio --HEAD

pip3 install -U pyinstaller==4.2

pyinstaller friture.spec -y --onedir --windowed

ls -la dist/*

# compare the portaudio libs to make the package contains the one that was installed with brew
ls -la /usr/local/lib/libportaudio.dylib
ls -la /usr/local/Cellar/portaudio/*/lib/libportaudio.dylib
ls -la dist/friture.app/Contents/MacOS/_sounddevice_data/portaudio-binaries

# prepare a dmg out of friture.app
export ARTIFACT_FILENAME=friture-$(python3 -c 'import friture; print(friture.__version__)')-$(date +'%Y%m%d').dmg
echo $ARTIFACT_FILENAME
Expand Down
22 changes: 14 additions & 8 deletions friture.spec
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,26 @@ excluded_binaries = [
'QtWebKitWidgets.framework',
'QtWebSockets.framework']

pathex = []
binaries = []

if platform.system() == "Windows":
# workaround for PyInstaller that does not look where the new PyQt5 official wheels put the Qt dlls
from PyInstaller.compat import getsitepackages
pathex = [os.path.join(x, 'PyQt5', 'Qt', 'bin') for x in getsitepackages()]
pathex += [os.path.join(x, 'PyQt5', 'Qt', 'bin') for x in getsitepackages()]

# add vcruntime140.dll - PyInstaller excludes it by default because it thinks it comes from c:\Windows
binaries = [('vcruntime140.dll', 'C:\\Python39\\vcruntime140.dll', 'BINARY')]
else:
pathex = []
binaries = []
# for Macos Big Sur, the stable portaudio (19.6.0) makes Friture freeze on startup
# install from latest master instead with homebrew
# and include it in the package
if platform.system() == "Darwin":
libportaudio_path = "/usr/local/lib/libportaudio.dylib"
if not os.path.isfile(libportaudio_path):
raise ValueError('libportaudio could not be found')
binaries += [(libportaudio_path, os.path.join("_sounddevice_data", "portaudio-binaries"))]

a = Analysis(['main.py'],
pathex=pathex,
binaries=None,
binaries=binaries,
datas=[],
hiddenimports=[],
hookspath=[],
Expand All @@ -123,7 +129,7 @@ exe = EXE(pyz,
icon="resources/images/friture.ico")

coll = COLLECT(exe,
a.binaries + binaries,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
Expand Down

0 comments on commit f6ac5fa

Please sign in to comment.