ActivityWatch / aw-qt

Tray icon that manages ActivityWatch processes, built with Qt.
Mozilla Public License 2.0
27 stars 29 forks source link

Creating a macOS .app bundle #28

Closed ErikBjare closed 4 years ago

ErikBjare commented 6 years ago

The .app still wont run when double clicked, I wrote about it here: https://github.com/pyinstaller/pyinstaller/issues/1804#issuecomment-331717394

ErikBjare commented 6 years ago

@ryanbaer figured out what that error code meant. Looks like we have to sign the .app bundle somehow, at least we have a lead now.

ryanbaer commented 6 years ago

Glad that was of help. Bearing in mind that I haven't worked with PyQt, I can at least tell you that in making simple menubar apps with Electron (NodeJS), it wasn't necessary to code sign to produce a launchable app bundle on macOS. So it may not actually be necessary?

lzkelley commented 6 years ago

Sorry to hijack, but I'm having the same problem using Electron with a python backend. Did getting the code signed fix the problem? @ryanbaer, were you running python with Electron?

ErikBjare commented 5 years ago

The issue seems to have been figured out in that PyInstaller thread as a consequence of incorrect assumptions about the working directory when launched from Finder. Should take a look at this again as it would seriously improve the installation/usage experience on macOS (which is currently the worst of all platforms).

xylix commented 4 years ago

@ErikBjare

I did some research on this. (https://github.com/xylix/aw-qt applied the relevant .spec changes on the newest version of aw-qt) Tried a lot of code signing hints, including some you've probably tried in the past.

Now I'm thinking it's related to some python dependency / maybe sqlite?

I can open the .app from the command line IF I have the virtualenv activated.

If I don't have the virtualenv activated I get the error LSOpenURLsWithRole() failed with error -10810 for the file /Users/xylix/Code/activitywatch/aw-qt/dist/ActivityWatch.app (related to calling this method https://developer.apple.com/documentation/coreservices/1448184-lsopenurlswithrole ?) And the same stuff in the system console as with trying to open it from Finder GUI.

There's no stacktrace so I'm unsure what dependency / is it aw-qt code itself which is causing this problem. Any guesses would be appreciated.

ErikBjare commented 4 years ago

@xylix My current guess is that it somehow has to do paths being handled incorrectly. See this comment and the following discussion for potential workarounds: https://github.com/pyinstaller/pyinstaller/issues/1804#issuecomment-332778156

Did running the .app from console not work for you? Last I remember it worked fine with open ActivityWatch.app?

I would try to put print statements before the first import of aw-core (and it's dirs module) since it handles paths, sets up logging, etc.

xylix commented 4 years ago

Running the .app from the console works only when I have the virtualenv active I used to make package.

Thanks for the link and tips, I'll try to get deeper into the issue.

ErikBjare commented 4 years ago

Ah, gotcha. Sounds like it might be an issue with PYTHONPATH or PATH or something then. The issue I linked should hopefully be useful in that case.

xylix commented 4 years ago

@ErikBjare We could probably close this since current progress with packaging and code signing happens in the main repo.

(in progress: https://github.com/ActivityWatch/activitywatch/pull/344 , related https://github.com/ActivityWatch/activitywatch/issues/353 )

ErikBjare commented 4 years ago

Good point. Closing.