From 16f48d040005274900c44bb4dc7df60ea1dba4b9 Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Mon, 4 Jul 2016 15:18:08 -0500 Subject: [PATCH] Add lbrycrd to app bundle on macos --- lbrynet/lbrynet_daemon/LBRYDaemon.py | 9 ++++++++- packaging/osx/lbry-osx-app/setup_app.sh | 11 +++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lbrynet/lbrynet_daemon/LBRYDaemon.py b/lbrynet/lbrynet_daemon/LBRYDaemon.py index 7549863ce..c67db906c 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemon.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemon.py @@ -291,7 +291,14 @@ class LBRYDaemon(jsonrpc.JSONRPC): else: self.wallet_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), "lbryum") elif sys.platform == "darwin": - self.lbrycrdd_path = "./lbrycrdd" + # use the path from the bundle if its available. + try: + import Foundation + bundle = Foundation.NSBundle.mainBundle() + self.lbrycrdd_path = bundle.pathForResource_ofType_('lbrycrdd', None) + except Exception: + log.exception('Failed to get path from bundle, falling back to default') + self.lbrycrdd_path = "./lbrycrdd" if self.wallet_type == "lbrycrd": self.wallet_dir = user_data_dir("lbrycrd") else: diff --git a/packaging/osx/lbry-osx-app/setup_app.sh b/packaging/osx/lbry-osx-app/setup_app.sh index 8be935514..5630a1e3f 100755 --- a/packaging/osx/lbry-osx-app/setup_app.sh +++ b/packaging/osx/lbry-osx-app/setup_app.sh @@ -46,7 +46,13 @@ codesign --deep -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRYURIHandler.app/Co codesign -vvvv "${DEST}/dist/LBRYURIHandler.app" pip install certifi pyobjc-core pyobjc-framework-Cocoa pyobjc-framework-CFNetwork -python setup_app.py py2app + +# add lbrycrdd as a resource. Following +# http://stackoverflow.com/questions/11370012/can-executables-made-with-py2app-include-other-terminal-scripts-and-run-them +wget https://github.com/lbryio/lbrycrd/releases/download/v0.3-osx/lbrycrdd +python setup_app.py py2app --resources lbrycrdd + +chmod +x "${DEST}/dist/LBRY.app/Contents/Resources/lbrycrdd" echo "Removing i386 libraries" @@ -74,5 +80,6 @@ codesign -vvvv "${DEST}/dist/LBRY.app" rm -rf $tmp mv dist/LBRY.app LBRY.app -rm -rf dist +rm -rf dist "${NAME}.${VERSION}.dmg" +# TODO: make this pretty! hdiutil create "${NAME}.${VERSION}.dmg" -volname lbry -srcfolder LBRY.app