Fix startup failure in macOS bundle

Closes #2731
This commit is contained in:
Damien Elmes 2023-10-14 13:25:54 +10:00
parent 86f80ef926
commit 9f0dd4a63f
2 changed files with 10 additions and 1 deletions

View file

@ -68,6 +68,10 @@ def _patch_certifi() -> None:
certifi.where = where
def _fix_protobuf_path() -> None:
sys.path.append(str(Path(sys.prefix) / "../Resources"))
def packaged_build_setup() -> None:
if not getattr(sys, "frozen", False):
return
@ -76,6 +80,8 @@ def packaged_build_setup() -> None:
if sys.platform == "win32":
_fix_pywin32()
elif sys.platform == "darwin":
_fix_protobuf_path()
_patch_pkgutil()
_patch_certifi()

View file

@ -135,7 +135,10 @@ fn make_app(kind: DistKind, mut plist: plist::Dictionary, stamp: &Utf8Path) -> R
let path_str = relative_path.to_str().unwrap();
if path_str.contains("libankihelper") {
builder.add_file_macos("libankihelper.dylib", entry)?;
} else if path_str.contains("aqt/data") || path_str.contains("certifi") {
} else if path_str.contains("aqt/data")
|| path_str.contains("certifi")
|| path_str.contains("google/protobuf")
{
builder.add_file_resources(relative_path.strip_prefix("lib").unwrap(), entry)?;
} else {
if path_str.contains("__pycache__") {