Skip to content
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 OSX support #29

Open
tildebyte opened this issue Feb 21, 2018 · 20 comments
Open

add OSX support #29

tildebyte opened this issue Feb 21, 2018 · 20 comments

Comments

@tildebyte
Copy link

I know, I know, OSX isn't supported. Guess what; with all of the prereqs installed (and the fix for High Sierra's idiotically broken hostname handling[1]), it starts and runs just fine!

EXCEPT

Traceback (most recent call last):
  File "gnomecast.py", line 775, in <module>
    main()
  File "gnomecast.py", line 772, in main
    caster.run()
  File "gnomecast.py", line 181, in run
    self.build_gui()
  File "gnomecast.py", line 333, in build_gui
    win.set_icon(self.get_logo_pixbuf(color='#000000'))
  File "gnomecast.py", line 451, in get_logo_pixbuf
    pixbuf = GdkPixbuf.Pixbuf.new_from_stream(f, None)
GLib.Error: gdk-pixbuf-error-quark: Unrecognized image file format (3)

Cool thing: comment out all calls to get_logo_pixbuf (simplest workaround), and it works like a charm.

[1] Pro tip: put your hostname in /etc/hosts at the end of the localhost line, e.g.

127.0.0.1   localhost    Fubar    Fubar.local
@fiendish
Copy link
Contributor

What happens if you install librsvg with homebrew: brew install librsvg

@tildebyte
Copy link
Author

Beauty! brew librsvg as well as the adwaita theme, for icons, and it's good!

@fiendish
Copy link
Contributor

fiendish commented Feb 23, 2018 via email

@tildebyte
Copy link
Author

tildebyte commented Feb 23, 2018

I was afraid that you might say that >_>
I tend to do a lot of goofing around with this and that, so I don't know exactly what the prereqs are.

However, these:

  • The localhost fix for Sierra and later
  • Py 3K!
  • homebrew
    • ffmpeg, obviously (which was already present)
    • librsvg (obviously)
    • gtk+3 (I believe that this was already present)
    • pygobject3 (brew install pygobject3 --with-python3 gtk+3: this should also install gtk+3 if not present)
    • adwaita-icon-theme
  • pip3
    • pychromecast
    • pycaption
    • html5lib (and the update)

It's messy, but since homebrew doesn't provide pychromecast/pycaption/html5lib, it's not possible to brew everything.

@keredson
Copy link
Owner

does homebrew provide pip? or can pip be run?

awesome to hear that it does work on mac.

@keredson
Copy link
Owner

found this: https://py2app.readthedocs.io/en/latest/ maybe we could create a standalone build.

@pchaganti
Copy link

👍

@pchaganti
Copy link

pchaganti commented Feb 24, 2018

To run on OSX

brew update
brew install ffmpeg python3 pygobject3 --with-python3 gtk+3 librsvg adwaita-icon-theme 
sudo pip3 install gnomecast
sudo pip3 install --upgrade html5lib==1.0b8

@tildebyte
Copy link
Author

tildebyte commented Feb 24, 2018

@keredson Homebrew's Python install(s) provide pip (as @pchaganti pointed out). I don't have much experience app-ifying Python code, but I understand that it works pretty well.

@pchaganti LOL, I forgot about pip-install taking care of dependencies - I ran it straight from the repo, so I did everything manually.

As an added data point; Homebrew compiles Py3k, but it's very fast (single digit minutes) on my MBP, which ain't even the greatest, so the total install time isn't horrible

@tildebyte
Copy link
Author

Not to overload this thread too much (maybe a new issue just for OSX support?), but it looks like pyinstaller is a better option.

Right now I'm stuck trying to figure out how to include librsvg as a dependency; otherwise it seems to work without much configuration at all.

@keredson keredson changed the title GdkPixbuf error on OSX add OSX support Feb 24, 2018
@keredson
Copy link
Owner

pyinstaller looks promising too. if someone wants to test it and post the build instructions they used i'll be happy to incorporate.

@kim0
Copy link

kim0 commented Mar 23, 2018

FYI, just tried pip3 install gnomecast on OSX, and immediately hit the below error

 pip3 install gnomecast
Collecting gnomecast
  Downloading gnomecast-0.2.16.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/n8/nx7swkf57nl7v8xkk47t_mv80000gq/T/pip-build-5epzy6bd/gnomecast/setup.py", line 16, in <module>
        version=__import__('gnomecast').__version__,
      File "/private/var/folders/n8/nx7swkf57nl7v8xkk47t_mv80000gq/T/pip-build-5epzy6bd/gnomecast/gnomecast.py", line 4, in <module>
        import dbus
    ModuleNotFoundError: No module named 'dbus'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/n8/nx7swkf57nl7v8xkk47t_mv80000gq/T/pip-build-5epzy6bd/gnomecast/

@tildebyte
Copy link
Author

'dbus' is a gnome desktop thing. You'll need to check in homebrew for that, iirc.

@keredson
Copy link
Owner

made a change so if dbus isn't around (like on osx) gnomecast will still run. (it just won't stop the screensaver from engaging.) released gnomecast-0.2.17. @kim0 @tildebyte

@keredson
Copy link
Owner

OMG i'm almost 3 hours now waiting for brew install ffmpeg python3 pygobject3 --with-python3 gtk+3 librsvg adwaita-icon-theme to finish. i feel like i'm back in gentoo!

@keredson
Copy link
Owner

well i'm at a loss as to how to bundle gnomecast into an osx binary. i've tried py2app, which errors. seems to be coded against a really old version of plistlib, and the API has changed. i also tried pyinstaller. this command:

pyinstaller gnomecast.py --windowed --clean --onefile

actually built an gnomecast.app. but it crashes when you try to run it.

anyone have an suggestions?

@keredson
Copy link
Owner

pyinstaller output:

dereks-mac-mini:gnomecast derek$ pyinstaller gnomecast.py --windowed --clean --onefile
71 INFO: PyInstaller: 3.3.1
71 INFO: Python: 3.7.0
80 INFO: Platform: Darwin-17.7.0-x86_64-i386-64bit
81 INFO: wrote /Users/derek/Desktop/gnomecast/gnomecast.spec
85 INFO: UPX is not available.
86 INFO: Removing temporary files and cleaning cache in /Users/derek/Library/Application Support/pyinstaller
107 INFO: Extending PYTHONPATH with paths
['/Users/derek/Desktop/gnomecast', '/Users/derek/Desktop/gnomecast']
107 INFO: checking Analysis
107 INFO: Building Analysis because out00-Analysis.toc is non existent
108 INFO: Initializing module dependency graph...
111 INFO: Initializing module graph hooks...
114 INFO: Analyzing base_library.zip ...
4915 INFO: running Analysis out00-Analysis.toc
4929 INFO: Caching module hooks...
4935 INFO: Analyzing /Users/derek/Desktop/gnomecast/gnomecast.py
5342 INFO: Processing pre-safe import module hook   urllib3.packages.six.moves
8465 INFO: Processing pre-safe import module hook   six.moves
9303 INFO: Processing pre-find module path hook   distutils
13848 INFO: Processing pre-safe import module hook   gi.repository.Gtk
13849 INFO: Processing pre-safe import module hook   gi.repository.Gdk
13850 INFO: Processing pre-safe import module hook   gi.repository.GLib
13851 INFO: Processing pre-safe import module hook   gi.repository.GdkPixbuf
13851 INFO: Processing pre-safe import module hook   gi.repository.Gio
13857 INFO: Loading module hooks...
13857 INFO: Loading module hook "hook-gi.repository.GdkPixbuf.py"...
14923 INFO: Processing pre-safe import module hook   gi.repository.GModule
14925 INFO: Loading module hook "hook-pkg_resources.py"...
15562 INFO: Processing pre-safe import module hook   win32com
15565 INFO: Loading module hook "hook-requests.py"...
15566 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
15566 INFO: Loading module hook "hook-lib2to3.py"...
15570 INFO: Loading module hook "hook-encodings.py"...
15661 INFO: Loading module hook "hook-gi.repository.Gtk.py"...
19030 INFO: Processing pre-safe import module hook   gi.repository.GObject
19042 INFO: Processing pre-safe import module hook   gi.repository.Atk
19043 INFO: Loading module hook "hook-gi.repository.Gdk.py"...
19957 INFO: Processing pre-safe import module hook   gi.repository.cairo
19959 INFO: Processing pre-safe import module hook   gi.repository.Pango
19961 INFO: Loading module hook "hook-gi.repository.Gio.py"...
21281 INFO: Loading module hook "hook-xml.dom.domreg.py"...
21282 INFO: Loading module hook "hook-gi.py"...
21305 INFO: Loading module hook "hook-certifi.py"...
21306 INFO: Loading module hook "hook-paste.exceptions.reporter.py"...
21307 INFO: Loading module hook "hook-gi.repository.GModule.py"...
21645 INFO: Loading module hook "hook-lxml.etree.py"...
21646 INFO: Loading module hook "hook-sysconfig.py"...
21660 INFO: Loading module hook "hook-xml.py"...
21661 INFO: Loading module hook "hook-pydoc.py"...
21661 INFO: Loading module hook "hook-gi.repository.GLib.py"...
22364 INFO: Loading module hook "hook-distutils.py"...
22366 INFO: Loading module hook "hook-gi.repository.Pango.py"...
22870 INFO: Loading module hook "hook-gi.repository.Atk.py"...
23406 INFO: Loading module hook "hook-gi.repository.GObject.py"...
23913 WARNING: Hidden import "gi._gobject" not found!
23914 INFO: Loading module hook "hook-gi.repository.cairo.py"...
24282 INFO: Looking for ctypes DLLs
24314 WARNING: library PyOS_getsig.dll required via ctypes not found
24314 INFO: Analyzing run-time hooks ...
24327 INFO: Including run-time hook 'pyi_rth_pkgres.py'
24330 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
24335 INFO: Including run-time hook 'pyi_rth_gio.py'
24336 INFO: Including run-time hook 'pyi_rth_gdkpixbuf.py'
24339 INFO: Including run-time hook 'pyi_rth_glib.py'
24340 INFO: Including run-time hook 'pyi_rth_gtk.py'
24341 INFO: Including run-time hook 'pyi_rth_gi.py'
24367 INFO: Looking for dynamic libraries
24803 INFO: Looking for eggs
24803 INFO: Using Python library /Library/Frameworks/Python.framework/Versions/3.7/Python
24816 INFO: Warnings written to /Users/derek/Desktop/gnomecast/build/gnomecast/warngnomecast.txt
24935 INFO: Graph cross-reference written to /Users/derek/Desktop/gnomecast/build/gnomecast/xref-gnomecast.html
25345 INFO: checking PYZ
25345 INFO: Building PYZ because out00-PYZ.toc is non existent
25345 INFO: Building PYZ (ZlibArchive) /Users/derek/Desktop/gnomecast/build/gnomecast/out00-PYZ.pyz
26666 INFO: Building PYZ (ZlibArchive) /Users/derek/Desktop/gnomecast/build/gnomecast/out00-PYZ.pyz completed successfully.
26727 INFO: checking PKG
26727 INFO: Building PKG because out00-PKG.toc is non existent
26727 INFO: Building PKG (CArchive) out00-PKG.pkg
48281 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
48641 INFO: Bootloader /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/bootloader/Darwin-64bit/runw
48641 INFO: checking EXE
48641 INFO: Building EXE because out00-EXE.toc is non existent
48641 INFO: Building EXE from out00-EXE.toc
48642 INFO: Appending archive to EXE /Users/derek/Desktop/gnomecast/dist/gnomecast
48945 INFO: Fixing EXE for code signing /Users/derek/Desktop/gnomecast/dist/gnomecast
48955 INFO: Building EXE from out00-EXE.toc completed successfully.
49316 INFO: checking BUNDLE
49316 INFO: Building BUNDLE because out00-BUNDLE.toc is non existent
49317 INFO: Building BUNDLE out00-BUNDLE.toc
49683 INFO: moving BUNDLE data files to Resource directory

@keredson
Copy link
Owner

this is the resultant file: https://github.com/keredson/gnomecast/releases/tag/OSXv1.4.1

it crashes w/ a bunch of junk i don't understand. anyone who knows osx better than i do who wants to pitch in i'm all ears. :)

@lsferreira42
Copy link

Is this something that we can continue to work?
I'm interested in fixing these bugs and get it running on osx

@tildebyte
Copy link
Author

Sorry, in the interim I got re-interested in gaming, so had to trade (notice that I don't necessarily say "up" ;p ) to a Windows laptop.

@keredson That pyinstaller log looks weirdly like it's trying to build a Windows app (mentions both 'exe' and 'dll')...

pyinstaller claims that it's only even possible to build for the platform/Python version it's run under 🤔

Some of the output from the crashy app might be helpful? If it's too big to post here, maybe Google Docs/Dropbox/et al.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants