2 from distutils.core import setup, Extension
6 # Get build variables (buildir, srcdir)
7 top_builddir = os.path.join( '..', '..' )
8 os.environ['top_builddir'] = top_builddir
10 # Determine the extra link args. Normally, vlc-config should take care
11 # of this and return the right path values, from a development tree or
12 # an installed version.
15 d=os.path.join(top_builddir, 'src', '.libs')
17 # We are in a development tree, which was compiled with libtool
21 d=os.path.join(top_builddir, 'src')
22 # We are in a development tree, which was compiled without libtool
26 # For out-of-tree compilations
31 for n in ( 'vlc-config',
32 os.path.join( top_builddir, 'vlc-config' )):
36 status, output = commands.getstatusoutput('pkg-config libvlc --exists')
38 vlcconfig="pkg-config libvlc"
40 print "*** Warning *** Cannot find vlc-config. Will try sane defaults."
41 elif os.sys.platform == 'win32':
42 # Win32 does not know how to invoke the shell itself.
43 vlcconfig="sh %s" % vlcconfig
46 def get_vlc_version():
47 vlcconfig=get_vlcconfig()
51 version=os.popen('%s --modversion' % vlcconfig, 'r').readline().strip()
55 vlcconfig=get_vlcconfig()
59 cflags=os.popen('%s --cflags ' % vlcconfig, 'r').readline().strip()
63 vlcconfig=get_vlcconfig()
68 if os.sys.platform == 'darwin':
69 ldflags = "-read_only_relocs warning".split()
70 ldflags.extend(os.popen('%s --libs ' % vlcconfig,
71 'r').readline().rstrip().split())
72 if os.sys.platform == 'darwin':
73 ldflags.append('-lstdc++')
74 if not '-lvlc' in ldflags:
75 # Some broken vlc-config can exist (esp. on win32). Try to
76 # workaround the problem.
77 ldflags.append('-lvlc')
81 if '--force-deprecated' in sys.argv:
82 sys.argv.remove('--force-deprecated')
84 print """This native version of VLC bindings is now deprecated.
86 Please use the new ctypes-based bindings, which can be built from the
87 bindings/python-ctypes directory of the VLC source tree, or directly
88 get the generated python module from
89 http://www.advene.org/download/python-ctypes
91 However, if you insist on building this deprecated version, you should
92 pass the --force-deprecated option on the setup.py command line.
96 #source_files = [ 'vlc_module.c', 'vlc_mediacontrol.c',
97 # 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
98 source_files = [ 'vlc_module.c' ]
100 # To compile in a local vlc tree
101 vlclocal = Extension('vlc',
102 sources = [ os.path.join( srcdir, f ) for f in source_files ],
103 include_dirs = [ top_builddir,
106 extra_compile_args = get_cflags(),
107 extra_link_args = linkargs + get_ldflags(),
110 setup (name = 'python-vlc',
111 version = '1.0.0.90',
112 author='Olivier Aubert',
113 author_email='olivier.aubert@liris.cnrs.fr',
114 url='http://wiki.videolan.org/PythonBinding',
115 py_modules=['vlcwidget'],
116 keywords = [ 'vlc', 'video' ],
118 description = "VLC bindings for python.",
119 long_description = """VLC bindings for python.
121 This module provides bindings for the native libvlc API of the VLC
122 video player. Documentation can be found on the VLC wiki :
123 http://wiki.videolan.org/ExternalAPI
125 This module also provides a MediaControl object, which implements an
126 API inspired from the OMG Audio/Video Stream 1.0 specification.
127 Documentation can be found on the VLC wiki :
128 http://wiki.videolan.org/PythonBinding
130 Example session (for the MediaControl API):
133 mc=vlc.MediaControl(['--verbose', '1'])
134 mc.playlist_add_item('movie.mpg')
136 # Start the movie at 2000ms
138 p.origin=vlc.RelativePosition
142 # which could be abbreviated as
144 # for the default conversion from int is to make a RelativePosition in MediaTime
146 # Display some text during 2000ms
147 mc.display_text('Some useless information', 0, 2000)
152 # Get status information
153 mc.get_stream_information()
155 ext_modules = [ vlclocal ])