fix: whisper binary missing in package

https://github.com/chidiwilliams/buzz/issues/630#issuecomment-1882934761
This commit is contained in:
Chidi Williams 2024-01-10 09:27:33 +00:00
commit 5cda68a598
3 changed files with 65 additions and 32 deletions

30
.run/pytest.run.xml Normal file
View file

@ -0,0 +1,30 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="pytest" type="tests" factoryName="py.test" nameIsGenerated="true">
<module name="buzz" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="$PROJECT_DIR$/.venv/bin/python" />
<option name="SDK_NAME" value="Poetry (buzz) (2)" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="net.ashald.envfile">
<option name="IS_ENABLED" value="false" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
</ENTRIES>
</EXTENSION>
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;-s&quot;" />
<option name="_new_target" value="&quot;&quot;" />
<option name="_new_targetType" value="&quot;CUSTOM&quot;" />
<method v="2" />
</configuration>
</component>

View file

@ -5,32 +5,35 @@ import shutil
from PyInstaller.utils.hooks import collect_data_files, copy_metadata
from buzz.__version__ import VERSION
datas = []
datas += collect_data_files('torch')
datas += copy_metadata('tqdm')
datas += copy_metadata('torch')
datas += copy_metadata('regex')
datas += copy_metadata('requests')
datas += copy_metadata('packaging')
datas += copy_metadata('filelock')
datas += copy_metadata('numpy')
datas += copy_metadata('tokenizers')
datas += collect_data_files("torch")
datas += copy_metadata("tqdm")
datas += copy_metadata("torch")
datas += copy_metadata("regex")
datas += copy_metadata("requests")
datas += copy_metadata("packaging")
datas += copy_metadata("filelock")
datas += copy_metadata("numpy")
datas += copy_metadata("tokenizers")
# Allow transformers package to load __init__.py file dynamically:
# https://github.com/chidiwilliams/buzz/issues/272
datas += collect_data_files('transformers', include_py_files=True)
datas += collect_data_files("transformers", include_py_files=True)
datas += collect_data_files('whisper')
datas += [(file[1], os.path.dirname(file[1])) for file in
Tree('./locale', prefix='locale', excludes=['*.po'])]
datas += [(shutil.which('ffmpeg'), '.')]
datas += collect_data_files("whisper")
datas += [
("buzz/whisper.dll" if platform.system() == "Windows" else "buzz/libwhisper.*", ".")
]
datas += [
(file[1], os.path.dirname(file[1]))
for file in Tree("./locale", prefix="locale", excludes=["*.po"])
]
datas += [(shutil.which("ffmpeg"), ".")]
block_cipher = None
a = Analysis(
['main.py'],
["main.py"],
pathex=[],
binaries=[],
datas=datas,
@ -50,9 +53,9 @@ exe = EXE(
pyz,
a.scripts,
[],
icon='./assets/buzz.ico',
icon="./assets/buzz.ico",
exclude_binaries=True,
name='Buzz',
name="Buzz",
debug=True,
bootloader_ignore_signals=False,
strip=False,
@ -72,17 +75,17 @@ coll = COLLECT(
strip=False,
upx=False,
upx_exclude=[],
name='Buzz',
name="Buzz",
)
app = BUNDLE(
coll,
name='Buzz.app',
icon='./assets/buzz.icns',
bundle_identifier='com.chidiwilliams.buzz',
version='0.8.4',
name="Buzz.app",
icon="./assets/buzz.icns",
bundle_identifier="com.chidiwilliams.buzz",
version="0.8.4",
info_plist={
'NSPrincipalClass': 'NSApplication',
'NSHighResolutionCapable': 'True',
'NSMicrophoneUsageDescription': 'Allow Buzz to record audio from your microphone.'
}
"NSPrincipalClass": "NSApplication",
"NSHighResolutionCapable": "True",
"NSMicrophoneUsageDescription": "Allow Buzz to record audio from your microphone.",
},
)

View file

@ -1,7 +1,7 @@
from typing import Optional
from PyQt6.QtCore import Qt, QRegularExpression
from PyQt6.QtWidgets import QDialog, QWidget, QDialogButtonBox, QVBoxLayout, QMessageBox
from PyQt6.QtWidgets import QDialog, QWidget, QDialogButtonBox, QMessageBox, QFormLayout
from buzz.locale import _
from buzz.widgets.line_edit import LineEdit
@ -19,7 +19,7 @@ class ImportURLDialog(QDialog):
self.setWindowTitle(_("Import URL"))
self.line_edit = LineEdit()
self.line_edit.setPlaceholderText(_("URL"))
self.line_edit.setPlaceholderText(_("https://example.com/audio.mp3"))
self.line_edit.setMinimumWidth(350)
self.button_box = QDialogButtonBox(
@ -28,8 +28,8 @@ class ImportURLDialog(QDialog):
self.button_box.accepted.connect(self.accept)
self.button_box.rejected.connect(self.reject)
self.layout = QVBoxLayout()
self.layout.addWidget(self.line_edit)
self.layout = QFormLayout()
self.layout.addRow(_("URL:"), self.line_edit)
self.layout.addWidget(self.button_box)
self.setLayout(self.layout)