1 from distutils
.core
import setup
, Extension
5 # Get build variables (buildir, srcdir)
6 top_builddir
= os
.path
.join( '..', '..' )
7 os
.environ
['top_builddir'] = top_builddir
9 # Determine the extra link args. Normally, vlc-config should take care
10 # of this and return the right path values, from a development tree or
11 # an installed version.
14 d
=os
.path
.join(top_builddir
, 'src', '.libs')
16 # We are in a development tree, which was compiled with libtool
20 d
=os
.path
.join(top_builddir
, 'src')
21 # We are in a development tree, which was compiled without libtool
25 # For out-of-tree compilations
30 for n
in ( 'vlc-config',
31 os
.path
.join( top_builddir
, 'vlc-config' )):
35 status
, output
= commands
.getstatusoutput('pkg-config libvlc --exists')
37 vlcconfig
="pkg-config libvlc"
39 print "*** Warning *** Cannot find vlc-config. Will try sane defaults."
40 elif os
.sys
.platform
== 'win32':
41 # Win32 does not know how to invoke the shell itself.
42 vlcconfig
="sh %s" % vlcconfig
45 def get_vlc_version():
46 vlcconfig
=get_vlcconfig()
50 version
=os
.popen('%s --modversion' % vlcconfig
, 'r').readline().strip()
54 vlcconfig
=get_vlcconfig()
58 cflags
=os
.popen('%s --cflags ' % vlcconfig
, 'r').readline().strip()
62 vlcconfig
=get_vlcconfig()
67 if os
.sys
.platform
== 'darwin':
68 ldflags
= "-read_only_relocs warning".split()
69 ldflags
.extend(os
.popen('%s --libs ' % vlcconfig
,
70 'r').readline().rstrip().split())
71 if os
.sys
.platform
== 'darwin':
72 ldflags
.append('-lstdc++')
73 if not '-lvlc' in ldflags
:
74 # Some broken vlc-config can exist (esp. on win32). Try to
75 # workaround the problem.
76 ldflags
.append('-lvlc')
79 #source_files = [ 'vlc_module.c', 'vlc_mediacontrol.c',
80 # 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
81 source_files
= [ 'vlc_module.c' ]
83 # To compile in a local vlc tree
84 vlclocal
= Extension('vlc',
85 sources
= [ os
.path
.join( srcdir
, f
) for f
in source_files
],
86 include_dirs
= [ top_builddir
,
89 extra_compile_args
= get_cflags(),
90 extra_link_args
= linkargs
+ get_ldflags(),
93 setup (name
= 'python-vlc',
95 author
='Olivier Aubert',
96 author_email
='olivier.aubert@liris.cnrs.fr',
97 url
='http://wiki.videolan.org/PythonBinding',
98 py_modules
=['vlcwidget'],
99 keywords
= [ 'vlc', 'video' ],
101 description
= "VLC bindings for python.",
102 long_description
= """VLC bindings for python.
104 This module provides bindings for the native libvlc API of the VLC
105 video player. Documentation can be found on the VLC wiki :
106 http://wiki.videolan.org/ExternalAPI
108 This module also provides a MediaControl object, which implements an
109 API inspired from the OMG Audio/Video Stream 1.0 specification.
110 Documentation can be found on the VLC wiki :
111 http://wiki.videolan.org/PythonBinding
113 Example session (for the MediaControl API):
116 mc=vlc.MediaControl(['--verbose', '1'])
117 mc.playlist_add_item('movie.mpg')
119 # Start the movie at 2000ms
121 p.origin=vlc.RelativePosition
125 # which could be abbreviated as
127 # for the default conversion from int is to make a RelativePosition in MediaTime
129 # Display some text during 2000ms
130 mc.display_text('Some useless information', 0, 2000)
135 # Get status information
136 mc.get_stream_information()
138 ext_modules
= [ vlclocal
])