-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a hook for toga
#803
Add a hook for toga
#803
Conversation
Looks like linux runner will require |
@@ -0,0 +1 @@ | |||
Add a hook for ``toga``, which has metadata. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All packages have metadata. It's really about whether a package feels the need to loop it up at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reckon we should add couple of more examples to complement
pyinstaller-hooks-contrib/news/README.txt
Line 38 in d40669c
Add a hook for ``foobar``, which has a hidden import. |
Failing with: Traceback (most recent call last): File "toga/icons.py", line 33, in __get__ AttributeError: type object 'Icon' has no attribute '__APP_ICON'. Did you mean: 'APP_ICON'? During handling of the above exception, another exception occurred: Traceback (most recent call last): File "toga/icons.py", line 126, in __init__ File "toga/icons.py", line 183, in _full_path FileNotFoundError: Can't find icon resources/gotcha During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test_source.py", line 8, in <module> File "toga/app.py", line 314, in __init__ File "toga/icons.py", line 35, in __get__ File "toga/icons.py", line 68, in APP_ICON File "toga/icons.py", line 141, in __init__ File "toga_cocoa/icons.py", line 21, in __init__ File "pathlib.py", line 1162, in __init__ File "pathlib.py", line 373, in __init__ TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'
@rokm @bwoodsend getting to the limit of my knowledge of PyInstaller with this one :| Couple notes:
I've got Failing with:
Probably because we get in to Objective C bindings pretty quick (via this package). Question: Do you think this will be implementable without a huge amount of effort? |
toga
, which has metadatatoga
BeeWare maintainer here! You're correct in guessing that working on PyInstaller support isn't high on our list of priorities. However, that doesn't mean we're hostile to PyInstaller. Having more options for installing Toga apps is a good thing, as far as I'm concerned. To that end - if there's something Toga could do that is preventing it from working with PyInstaller, or there's a change we can make that will make PyInstaller packaging easier, we're not fundamentally opposed to making those changes - especially if that change is based around compliance with existing PEPs. However, it's up to someone else to propose what those changes would be. |
I've opened a new PR (#804) with additional commits on top of yours, because I do not seem to have permissions to push into this one. Will first try to sort out linux and Windows, though, because they seem more straightforward, and then move on to macOS. |
And the problem on macOS is that So it tries to retrieve the .app bundles icon by querying I think changing these lines from bundle_icon = Path(
NSBundle.mainBundle.objectForInfoDictionaryKey("CFBundleIconFile")
)
path = NSBundle.mainBundle.pathForResource(
bundle_icon.stem,
ofType=".icns",
) to bundle_icon = NSBundle.mainBundle.objectForInfoDictionaryKey("CFBundleIconFile")
if bundle_icon is None:
# Not an .app bundle (e.g., POSIX build made with PyInstaller)
raise FileNotFoundError()
path = NSBundle.mainBundle.pathForResource(
Path(bundle_icon).stem,
ofType=".icns",
) should fix it. cc @freakboy3742 |
That's correct - and icon handling is one of many reasons for this.
Makes sense. PRs welcome :-) |
Superseded by #804. |
https://github.com/beeware/toga