Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

gst-python: link against brew python if available #46097

Closed
wants to merge 1 commit into from

Conversation

cbenhagen
Copy link
Contributor

No description provided.

@DomT4
Copy link
Member

DomT4 commented Nov 17, 2015

Not going to do this by default; It'll force everyone to install Homebrew's Python to use this formula from the bottles. You could make it :optional, if you really want to and @tdsmith doesn't feel upset by it.

@@ -3,6 +3,7 @@ class GstPython < Formula
homepage "http://gstreamer.freedesktop.org/modules/gst-python.html"
url "http://gstreamer.freedesktop.org/src/gst-python/gst-python-1.6.1.tar.xz"
sha256 "3cbe332e18fd2eaf23ddeee96c414f79ac1edc2f7d990582fa0ec5f977bd04f1"
revision 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the change below is optional, you don't need the revision bump.

@cbenhagen
Copy link
Contributor Author

Oh sorry that was not the intended behaviour. Fixed and rebased it.

@cbenhagen
Copy link
Contributor Author

https://travis-ci.org/Homebrew/homebrew/jobs/91688277#L1178 does not seem related to this PR. But anyway. Does someone have an idea why this happens on travis but not on my systems running 10.10 and 10.11?

@tdsmith Can you live with that optional dependency? Or is there a better way for a user to build gst-python against Homebrew's Python?

@bfontaine
Copy link
Contributor

@cbenhagen Install with the --sandbox option to reproduce the error.

@cbenhagen
Copy link
Contributor Author

I am not sure how to fix this sandbox issue but i will add an issue to track that.

What do you think about disabling the bottle and dropping the :optional? This way it always gets built for the first python in PATH.

@cbenhagen
Copy link
Contributor Author

@DomT4 i rebased this your recent commit 199f34b. So as expected it does build again.

Any thoughts about how we could manage this to work for Homebrew and System Python out of the box? Are there alternatives to disabling the bottle? Otherwise it would just silently build against system Python if the user does not pass the --with-python option. Which is not expected and will eventually break in strange ways.

@tdsmith
Copy link
Contributor

tdsmith commented Nov 24, 2015

Dumb question, since I don't understand this stack very well: what is gst-python and what does it do? Does it let you call python from gstreamer or does it let you control gstreamer from external Python code or both or neither?

@cbenhagen
Copy link
Contributor Author

It's complementing the GStreamer Python bindings provided by python-gi. So it lets you control GStreamer from Python.

@DomT4
Copy link
Member

DomT4 commented Nov 26, 2015

What do you think about disabling the bottle and dropping the :optional?

This isn't going to happen I'm afraid. Our aim is to bottle everything in Homebrew that requires compile, and that includes this. The solution in this PR would seem to be the best one for the use case you're requesting.

@cbenhagen
Copy link
Contributor Author

But how can we prevent that the user gets a corrupt system by accident then?

Maybe we should have two bottles then? One for system and one for Homebrew Python?

@MikeMcQuaid
Copy link
Member

Maybe we should have two bottles then? One for system and one for Homebrew Python?

We're not doing that, unfortunately, bottles are only built against the default options.

@cbenhagen
Copy link
Contributor Author

So what can we do? If dropping the bottle is no option.. what about a way to force a build --with-python when a homebrewed Python is installed? I feel bad for other users who run into issues because of this.

@MikeMcQuaid
Copy link
Member

Can you elaborate on your issues?

@tdsmith
Copy link
Contributor

tdsmith commented Dec 4, 2015

Yeah, it'd be interesting to see an example of something that fails.

@cbenhagen
Copy link
Contributor Author

This might not be the best example. I will try to come up with a simpler one later.

In my case i was using PyInstaller to package a simple demo app which is using GStreamer and gst-python. So when gst-python is linked against system python the resulting app crashes. While it works as expected when gst-python was linked against the homebrewed python.

@cbenhagen
Copy link
Contributor Author

Somehow i am having a hard time to trigger this issue without PyInstaller now. But using python modules which are built against system python together with ones that are not just screams for issues no?

@tdsmith
Copy link
Contributor

tdsmith commented Dec 4, 2015 via email

@cbenhagen
Copy link
Contributor Author

@tdsmith https://www.dropbox.com/s/i7elddpyx4rlcxb/testapp.zip?dl=1

This is not cleaned up and does include a Kivy gui as the simpler GStreamer only example does not work anymore for some other reason. The only difference between the two app bundles is that for one i had gst-python installed --with-python

This is the traceback from the one linked against the wrong Python version:

Traceback (most recent call last):
  File "/usr/local/bin/../Cellar/python/2.7.10_2/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 548, in <module>
    main()
  File "/usr/local/bin/../Cellar/python/2.7.10_2/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 530, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/local/bin/../Cellar/python/2.7.10_2/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/local/bin/../Cellar/python/2.7.10_2/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/bin/../Cellar/python/2.7.10_2/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 231, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 520, in get_config_var
    return get_config_vars().get(name)
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 453, in get_config_vars
    import re
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 108, in <module>
    import _locale
SystemError: dynamic module not initialized properly

The packaged app looks like this:

#!/usr/bin/env python
from kivy.app import App
from kivy.core.audio import SoundLoader
from kivy.uix.button import Button

def play(*args):
    sound = SoundLoader.load('http://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg')
    if sound:
        print("Sound found at %s" % sound.source)
        print("Sound is %.3f seconds" % sound.length)
        sound.play()

class TestApp(App):
    def build(self):
        return Button(text='Hello OGG World', on_release=play)

TestApp().run()

@tdsmith tdsmith self-assigned this Dec 27, 2015
@tdsmith
Copy link
Contributor

tdsmith commented Jan 24, 2016

Here's the different binding:

 app_name.app/Contents/MacOS/gst_plugins/libgstpythonplugin.so:
    @loader_path/../libgstpythonplugin.so (compatibility version 0.0.0, current version 0.0.0)
-   @loader_path/../Python (compatibility version 2.7.0, current version 2.7.0)
+   /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1255.1.0)
    @loader_path/../libgstreamer-1.0.0.dylib (compatibility version 602.0.0, current version 602.0.0)

@apjanke apjanke modified the milestone: Clear out Legacy May 3, 2016
@MikeMcQuaid
Copy link
Member

Passing on this as-is but @tdsmith will address this in some form.

@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants