]> git.sesse.net Git - vlc/blobdiff - bindings/python/setup.py
bindings/python: moved vlc.Object (access to internal framework of VLC objects) to...
[vlc] / bindings / python / setup.py
index 66bdf3107f0fbc79bcf4b86e761635840a377a34..60f541f9946e8be99bb46c9d379289197c81b2ab 100644 (file)
@@ -1,10 +1,30 @@
 from distutils.core import setup, Extension
 import os
 
+# Get build variables (buildir, srcdir)
+try:
+    top_builddir=os.environ['top_builddir']
+except KeyError:
+    # Note: do not initialize here, so that we get
+    # a correct default value if the env. var is
+    # defined but empty
+    top_builddir=None
+if not top_builddir:
+    top_builddir = os.path.join( '..', '..' )
+    os.environ['top_builddir'] = top_builddir
+
+try:
+    srcdir=os.environ['srcdir']
+except KeyError:
+    # Note: same as above
+    srcdir=None
+if not srcdir:
+    srcdir = '.'
+
 def get_vlcconfig():
     vlcconfig=None
     for n in ( 'vlc-config',
-               os.path.sep.join( ('..', '..', 'vlc-config' ))):
+               os.path.join( top_builddir, 'vlc-config' )):
         if os.path.exists(n):
             vlcconfig=n
             break
@@ -15,12 +35,20 @@ def get_vlcconfig():
         vlcconfig="sh %s" % vlcconfig
     return vlcconfig
 
+def get_vlc_version():
+    vlcconfig=get_vlcconfig()
+    if vlcconfig is None:
+        return ""
+    else:
+        version=os.popen('%s --version' % vlcconfig, 'r').readline().strip()
+        return version
+    
 def get_cflags():
     vlcconfig=get_vlcconfig()
     if vlcconfig is None:
         return []
     else:
-        cflags=os.popen('%s --cflags' % vlcconfig, 'r').readline().rstrip().split()
+        cflags=os.popen('%s --cflags vlc' % vlcconfig, 'r').readline().rstrip().split()
         return cflags
 
 def get_ldflags():
@@ -28,28 +56,49 @@ def get_ldflags():
     if vlcconfig is None:
         return []
     else:
-       os.environ['top_builddir'] = '../..'
-        ldflags=os.popen('%s --libs vlc builtin' % vlcconfig, 'r').readline().rstrip().split()
+       ldflags = []
+       if os.sys.platform == 'darwin':
+           ldflags = "-read_only_relocs warning".split()
+        ldflags.extend(os.popen('%s --libs vlc external' % vlcconfig,
+                               'r').readline().rstrip().split())
+       if os.sys.platform == 'darwin':
+           ldflags.append('-lstdc++')
         return ldflags
 
+#source_files = [ 'vlc_module.c', 'vlc_object.c', 'vlc_mediacontrol.c',
+#                 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
+source_files = [ 'vlc_module.c' ]
+
 # To compile in a local vlc tree
 vlclocal = Extension('vlc',
-                sources = ['vlcglue.c', '../../src/control/init.c'],
-                include_dirs = ['../../include', '../../', '/usr/win32/include' ],
-                extra_objects = [ '../../lib/libvlc.a' ],
+                     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 = [ '-L../..' ]  + get_ldflags(),
+               extra_link_args = [ '-L' + os.path.join(top_builddir, 'src', '.libs') ]  + get_ldflags(),
                 )
 
-setup (name = 'MediaControl',
-       version = '0.8.2-1',
-       scripts = [ 'vlcdebug.py' ],
+setup (name = 'VLC Bindings',
+       version = get_vlc_version(),
+       #scripts = [ os.path.join( srcdir, 'vlcwrapper.py') ],
+       keywords = [ 'vlc', 'video' ],
+       license = "GPL", 
        description = """VLC bindings for python.
 
-This module provides a MediaControl object, which implements an API
-inspired from the OMG Audio/Video Stream 1.0 specification. Moreover,
-the module provides a Object type, which gives a low-level access to
-the vlc objects and their variables.
+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
+
+The module also provides a Object type, which gives a low-level access
+to the vlc objects and their variables.
+
+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
 
 Example session:
 
@@ -82,5 +131,6 @@ o.info()
 i=o.find_object('input')
 i.list()
 i.get('time')
+
        """,
        ext_modules = [ vlclocal ])