[vlc-devel] commit: python bindings: fix setup.py to use 'pkg-config libvlc' instead of the old vlc-config (patch by <kwizart at gmail.com>). ( Olivier Aubert )

git version control git at videolan.org
Mon May 25 12:27:29 CEST 2009


vlc | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Mon May 25 12:22:41 2009 +0200| [bd13aca646fba540d0e925a4d1ffeccb4b49359a] | committer: Olivier Aubert 

python bindings: fix setup.py to use 'pkg-config libvlc' instead of the old vlc-config (patch by <kwizart at gmail.com>).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bd13aca646fba540d0e925a4d1ffeccb4b49359a
---

 bindings/python/setup.py |   61 ++++++++++++++++++++++++----------------------
 1 files changed, 32 insertions(+), 29 deletions(-)

diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 018e080..5fe8441 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -1,5 +1,6 @@
 from distutils.core import setup, Extension
 import os
+import commands
 
 # Get build variables (buildir, srcdir)
 top_builddir = os.path.join( '..', '..' )
@@ -31,8 +32,11 @@ def get_vlcconfig():
         if os.path.exists(n):
             vlcconfig=n
             break
+    status, output = commands.getstatusoutput('pkg-config libvlc --exists')
+    if status == 0:
+        vlcconfig="pkg-config libvlc"
     if vlcconfig is None:
-        print "*** Warning *** Cannot find vlc-config"
+        print "*** Warning *** Cannot find vlc-config. Will try sane defaults."
     elif os.sys.platform == 'win32':
         # Win32 does not know how to invoke the shell itself.
         vlcconfig="sh %s" % vlcconfig
@@ -43,15 +47,15 @@ def get_vlc_version():
     if vlcconfig is None:
         return ""
     else:
-        version=os.popen('%s --version' % vlcconfig, 'r').readline().strip()
+        version=os.popen('%s --modversion' % vlcconfig, 'r').readline().strip()
         return version
-    
+
 def get_cflags():
     vlcconfig=get_vlcconfig()
     if vlcconfig is None:
         return []
     else:
-        cflags=os.popen('%s --cflags vlc' % vlcconfig, 'r').readline().rstrip().split()
+        cflags=os.popen('%s --cflags ' % vlcconfig, 'r').readline().strip()
         return cflags
 
 def get_ldflags():
@@ -62,14 +66,10 @@ def get_ldflags():
 	ldflags = []
 	if os.sys.platform == 'darwin':
 	    ldflags = "-read_only_relocs warning".split()
-        ldflags.extend(os.popen('%s --libs external' % vlcconfig,
-				'r').readline().rstrip().split())
+        ldflags.extend(os.popen('%s --libs ' % vlcconfig,
+                                'r').readline().rstrip().split())
 	if os.sys.platform == 'darwin':
 	    ldflags.append('-lstdc++')
-        if not libtool:
-            # vlc-config is broken and gives a -lvlc which
-            # does not exist if libtool is disabled.
-            ldflags.remove('-lvlc')
         return ldflags
 
 #source_files = [ 'vlc_module.c', 'vlc_mediacontrol.c',
@@ -78,33 +78,36 @@ source_files = [ 'vlc_module.c' ]
 
 # To compile in a local vlc tree
 vlclocal = Extension('vlc',
-		sources = [ os.path.join( srcdir, f ) for f in source_files ],
-		include_dirs = [ top_builddir,
-			      os.path.join( srcdir, '..', '..', 'include' ),
-			      srcdir,
-			      '/usr/win32/include' ],
-		extra_objects = [ ],
-                extra_compile_args = get_cflags(),
-		extra_link_args = linkargs + get_ldflags(),
-                )
-
-setup (name = 'VLC Bindings',
-       version = get_vlc_version(),
-       #scripts = [ os.path.join( srcdir, 'vlcwrapper.py') ],
+                     sources = [ os.path.join( srcdir, f ) for f in source_files ],
+                     include_dirs = [ top_builddir,
+                                      srcdir ],
+                     extra_objects = [ ],
+                     extra_compile_args = get_cflags(),
+                     extra_link_args = linkargs + get_ldflags(),
+                     )
+
+setup (name = 'python-vlc',
+       version = '1.0.0.90',
+       author='Olivier Aubert',
+       author_email='olivier.aubert at liris.cnrs.fr',
+       url='http://wiki.videolan.org/PythonBinding',
+       #scripts = [ os.path.join( srcdir, 'vlcwidget.py') ],
+       py_modules=['vlcwrapper'],
        keywords = [ 'vlc', 'video' ],
-       license = "GPL", 
-       description = """VLC bindings for python.
+       license = "GPL",
+       description = "VLC bindings for python.",
+       long_description = """VLC bindings for python.
 
 This module provides bindings for the native libvlc API of the VLC
-video player. Documentation can be found on the VLC wiki : 
-http://wiki.videolan.org/index.php/ExternalAPI
+video player. Documentation can be found on the VLC wiki :
+http://wiki.videolan.org/ExternalAPI
 
 This module also provides a MediaControl object, which implements an
 API inspired from the OMG Audio/Video Stream 1.0 specification.
 Documentation can be found on the VLC wiki :
-http://wiki.videolan.org/index.php/PythonBinding
+http://wiki.videolan.org/PythonBinding
 
-Example session:
+Example session (for the MediaControl API):
 
 import vlc
 mc=vlc.MediaControl(['--verbose', '1'])




More information about the vlc-devel mailing list