X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bindings%2Fpython%2Fsetup.py;h=018e0809e03f72efc10a3cc557da36fb356ebad2;hb=3921a7f87de03160ecd18bcfeb68fbac459f2094;hp=bf27e42548b65e1e6fb5a0b1a0bb8f337c2103a4;hpb=68aa3ca3202b0f2c7e3b10db9dbe46b436b17bbd;p=vlc diff --git a/bindings/python/setup.py b/bindings/python/setup.py index bf27e42548..018e0809e0 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -1,10 +1,33 @@ from distutils.core import setup, Extension import os +# Get build variables (buildir, srcdir) +top_builddir = os.path.join( '..', '..' ) +os.environ['top_builddir'] = top_builddir + +# Determine the extra link args. Normally, vlc-config should take care +# of this and return the right path values, from a development tree or +# an installed version. +libtool=False +linkargs=[] +d=os.path.join(top_builddir, 'src', '.libs') +if os.path.exists(d): + # We are in a development tree, which was compiled with libtool + libtool=True + linkargs=[ '-L' + d ] +else: + d=os.path.join(top_builddir, 'src') + # We are in a development tree, which was compiled without libtool + if os.path.exists(d): + linkargs=[ '-L' + d ] + +# For out-of-tree compilations +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 @@ -28,46 +51,57 @@ def get_cflags(): 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(): vlcconfig=get_vlcconfig() if vlcconfig is None: - return [] + return [ '-lvlc' ] else: - os.environ['top_builddir'] = '../..' ldflags = [] if os.sys.platform == 'darwin': ldflags = "-read_only_relocs warning".split() - ldflags.extend(os.popen('%s --libs vlc pic builtin' % vlcconfig, 'r').readline().rstrip().split()) + ldflags.extend(os.popen('%s --libs external' % 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', +# '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/mediacontrol_init.c'], - include_dirs = ['../../include', '../../', '/usr/win32/include' ], - extra_objects = [ '../../lib/libvlc_pic.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 = linkargs + get_ldflags(), ) -setup (name = 'MediaControl', +setup (name = 'VLC Bindings', version = get_vlc_version(), - scripts = [ 'vlcdebug.py' ], + #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 -Documentation can be found on the VLC wiki : +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: @@ -94,12 +128,5 @@ mc.pause(0) # Get status information mc.get_stream_information() - -# Access lowlevel objets -o=vlc.Object(1) -o.info() -i=o.find_object('input') -i.list() -i.get('time') """, ext_modules = [ vlclocal ])