1 from distutils.core import setup, Extension
4 # Get build variables (buildir, srcdir)
5 top_builddir = os.path.join( '..', '..' )
6 os.environ['top_builddir'] = top_builddir
8 # Determine the extra link args. Normally, vlc-config should take care
9 # of this and return the right path values, from a development tree or
10 # an installed version.
13 d=os.path.join(top_builddir, 'src', '.libs')
15 # We are in a development tree, which was compiled with libtool
19 d=os.path.join(top_builddir, 'src')
20 # We are in a development tree, which was compiled without libtool
24 # For out-of-tree compilations
29 for n in ( 'vlc-config',
30 os.path.join( top_builddir, 'vlc-config' )):
35 print "*** Warning *** Cannot find vlc-config"
36 elif os.sys.platform == 'win32':
37 # Win32 does not know how to invoke the shell itself.
38 vlcconfig="sh %s" % vlcconfig
41 def get_vlc_version():
42 vlcconfig=get_vlcconfig()
46 version=os.popen('%s --version' % vlcconfig, 'r').readline().strip()
50 vlcconfig=get_vlcconfig()
54 cflags=os.popen('%s --cflags vlc' % vlcconfig, 'r').readline().rstrip().split()
58 vlcconfig=get_vlcconfig()
63 if os.sys.platform == 'darwin':
64 ldflags = "-read_only_relocs warning".split()
65 ldflags.extend(os.popen('%s --libs external' % vlcconfig,
66 'r').readline().rstrip().split())
67 if os.sys.platform == 'darwin':
68 ldflags.append('-lstdc++')
70 # vlc-config is broken and gives a -lvlc which
71 # does not exist if libtool is disabled.
72 ldflags.remove('-lvlc')
75 #source_files = [ 'vlc_module.c', 'vlc_mediacontrol.c',
76 # 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
77 source_files = [ 'vlc_module.c' ]
79 # To compile in a local vlc tree
80 vlclocal = Extension('vlc',
81 sources = [ os.path.join( srcdir, f ) for f in source_files ],
82 include_dirs = [ top_builddir,
83 os.path.join( srcdir, '..', '..', 'include' ),
85 '/usr/win32/include' ],
87 extra_compile_args = get_cflags(),
88 extra_link_args = linkargs + get_ldflags(),
91 setup (name = 'VLC Bindings',
92 version = get_vlc_version(),
93 #scripts = [ os.path.join( srcdir, 'vlcwrapper.py') ],
94 keywords = [ 'vlc', 'video' ],
96 description = """VLC bindings for python.
98 This module provides bindings for the native libvlc API of the VLC
99 video player. Documentation can be found on the VLC wiki :
100 http://wiki.videolan.org/index.php/ExternalAPI
102 This module also provides a MediaControl object, which implements an
103 API inspired from the OMG Audio/Video Stream 1.0 specification.
104 Documentation can be found on the VLC wiki :
105 http://wiki.videolan.org/index.php/PythonBinding
110 mc=vlc.MediaControl(['--verbose', '1'])
111 mc.playlist_add_item('movie.mpg')
113 # Start the movie at 2000ms
115 p.origin=vlc.RelativePosition
119 # which could be abbreviated as
121 # for the default conversion from int is to make a RelativePosition in MediaTime
123 # Display some text during 2000ms
124 mc.display_text('Some useless information', 0, 2000)
129 # Get status information
130 mc.get_stream_information()
132 ext_modules = [ vlclocal ])