]> git.sesse.net Git - vlc/blob - bindings/python/setup.py
66bdf3107f0fbc79bcf4b86e761635840a377a34
[vlc] / bindings / python / setup.py
1 from distutils.core import setup, Extension
2 import os
3
4 def get_vlcconfig():
5     vlcconfig=None
6     for n in ( 'vlc-config',
7                os.path.sep.join( ('..', '..', 'vlc-config' ))):
8         if os.path.exists(n):
9             vlcconfig=n
10             break
11     if vlcconfig is None:
12         print "*** Warning *** Cannot find vlc-config"
13     elif os.sys.platform == 'win32':
14         # Win32 does not know how to invoke the shell itself.
15         vlcconfig="sh %s" % vlcconfig
16     return vlcconfig
17
18 def get_cflags():
19     vlcconfig=get_vlcconfig()
20     if vlcconfig is None:
21         return []
22     else:
23         cflags=os.popen('%s --cflags' % vlcconfig, 'r').readline().rstrip().split()
24         return cflags
25
26 def get_ldflags():
27     vlcconfig=get_vlcconfig()
28     if vlcconfig is None:
29         return []
30     else:
31         os.environ['top_builddir'] = '../..'
32         ldflags=os.popen('%s --libs vlc builtin' % vlcconfig, 'r').readline().rstrip().split()
33         return ldflags
34
35 # To compile in a local vlc tree
36 vlclocal = Extension('vlc',
37                 sources = ['vlcglue.c', '../../src/control/init.c'],
38                 include_dirs = ['../../include', '../../', '/usr/win32/include' ],
39                 extra_objects = [ '../../lib/libvlc.a' ],
40                 extra_compile_args = get_cflags(),
41                 extra_link_args = [ '-L../..' ]  + get_ldflags(),
42                 )
43
44 setup (name = 'MediaControl',
45        version = '0.8.2-1',
46        scripts = [ 'vlcdebug.py' ],
47        description = """VLC bindings for python.
48
49 This module provides a MediaControl object, which implements an API
50 inspired from the OMG Audio/Video Stream 1.0 specification. Moreover,
51 the module provides a Object type, which gives a low-level access to
52 the vlc objects and their variables.
53
54 Example session:
55
56 import vlc
57 mc=vlc.MediaControl(['--verbose', '1'])
58 mc.playlist_add_item('movie.mpg')
59
60 # Start the movie at 2000ms
61 p=vlc.Position()
62 p.origin=vlc.RelativePosition
63 p.key=vlc.MediaTime
64 p.value=2000
65 mc.start(p)
66 # which could be abbreviated as
67 # mc.start(2000)
68 # for the default conversion from int is to make a RelativePosition in MediaTime
69
70 # Display some text during 2000ms
71 mc.display_text('Some useless information', 0, 2000)
72
73 # Pause the video
74 mc.pause(0)
75
76 # Get status information
77 mc.get_stream_information()
78
79 # Access lowlevel objets
80 o=vlc.Object(1)
81 o.info()
82 i=o.find_object('input')
83 i.list()
84 i.get('time')
85        """,
86        ext_modules = [ vlclocal ])