1 from distutils.core import setup, Extension
4 # Get build variables (buildir, srcdir)
6 top_builddir=os.environ['top_builddir']
8 # Note: do not initialize here, so that we get
9 # a correct default value if the env. var is
13 top_builddir = os.path.join( '..', '..' )
14 os.environ['top_builddir'] = top_builddir
16 # Determine the extra link args. Normally, vlc-config should take care
17 # of this and return the right path values, from a development tree or
18 # an installed version.
21 d=os.path.join(top_builddir, 'src', '.libs')
23 # We are in a development tree, which was compiled with libtool
27 d=os.path.join(top_builddir, 'src')
28 # We are in a development tree, which was compiled without libtool
32 # For out-of-tree compilations
34 srcdir=os.environ['srcdir']
43 for n in ( 'vlc-config',
44 os.path.join( top_builddir, 'vlc-config' )):
49 print "*** Warning *** Cannot find vlc-config"
50 elif os.sys.platform == 'win32':
51 # Win32 does not know how to invoke the shell itself.
52 vlcconfig="sh %s" % vlcconfig
55 def get_vlc_version():
56 vlcconfig=get_vlcconfig()
60 version=os.popen('%s --version' % vlcconfig, 'r').readline().strip()
64 vlcconfig=get_vlcconfig()
68 cflags=os.popen('%s --cflags vlc' % vlcconfig, 'r').readline().rstrip().split()
72 vlcconfig=get_vlcconfig()
77 if os.sys.platform == 'darwin':
78 ldflags = "-read_only_relocs warning".split()
79 ldflags.extend(os.popen('%s --libs external' % vlcconfig,
80 'r').readline().rstrip().split())
81 if os.sys.platform == 'darwin':
82 ldflags.append('-lstdc++')
84 # vlc-config is broken and gives a -lvlc-control which
85 # does not exist if libtool is disabled.
86 ldflags.remove('-lvlc-control')
89 #source_files = [ 'vlc_module.c', 'vlc_mediacontrol.c',
90 # 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
91 source_files = [ 'vlc_module.c' ]
93 # To compile in a local vlc tree
94 vlclocal = Extension('vlc',
95 sources = [ os.path.join( srcdir, f ) for f in source_files ],
96 include_dirs = [ top_builddir,
97 os.path.join( srcdir, '..', '..', 'include' ),
99 '/usr/win32/include' ],
101 extra_compile_args = get_cflags(),
102 extra_link_args = linkargs + get_ldflags(),
105 setup (name = 'VLC Bindings',
106 version = get_vlc_version(),
107 #scripts = [ os.path.join( srcdir, 'vlcwrapper.py') ],
108 keywords = [ 'vlc', 'video' ],
110 description = """VLC bindings for python.
112 This module provides bindings for the native libvlc API of the VLC
113 video player. Documentation can be found on the VLC wiki :
114 http://wiki.videolan.org/index.php/ExternalAPI
116 This module also provides a MediaControl object, which implements an
117 API inspired from the OMG Audio/Video Stream 1.0 specification.
118 Documentation can be found on the VLC wiki :
119 http://wiki.videolan.org/index.php/PythonBinding
124 mc=vlc.MediaControl(['--verbose', '1'])
125 mc.playlist_add_item('movie.mpg')
127 # Start the movie at 2000ms
129 p.origin=vlc.RelativePosition
133 # which could be abbreviated as
135 # for the default conversion from int is to make a RelativePosition in MediaTime
137 # Display some text during 2000ms
138 mc.display_text('Some useless information', 0, 2000)
143 # Get status information
144 mc.get_stream_information()
146 ext_modules = [ vlclocal ])