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
17 srcdir=os.environ['srcdir']
26 for n in ( 'vlc-config',
27 os.path.join( top_builddir, 'vlc-config' )):
32 print "*** Warning *** Cannot find vlc-config"
33 elif os.sys.platform == 'win32':
34 # Win32 does not know how to invoke the shell itself.
35 vlcconfig="sh %s" % vlcconfig
38 def get_vlc_version():
39 vlcconfig=get_vlcconfig()
43 version=os.popen('%s --version' % vlcconfig, 'r').readline().strip()
47 vlcconfig=get_vlcconfig()
51 cflags=os.popen('%s --cflags vlc' % vlcconfig, 'r').readline().rstrip().split()
55 vlcconfig=get_vlcconfig()
60 if os.sys.platform == 'darwin':
61 ldflags = "-read_only_relocs warning".split()
62 ldflags.extend(os.popen('%s --libs vlc external' % vlcconfig,
63 'r').readline().rstrip().split())
64 if os.sys.platform == 'darwin':
65 ldflags.append('-lstdc++')
68 #source_files = [ 'vlc_module.c', 'vlc_object.c', 'vlc_mediacontrol.c',
69 # 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
70 source_files = [ 'vlc_internal.c' ]
72 # To compile in a local vlc tree
73 vlclocal = Extension('vlcinternal',
74 sources = [ os.path.join( srcdir, f ) for f in source_files ],
75 include_dirs = [ top_builddir,
76 os.path.join( srcdir, '..', '..', 'include' ),
78 '/usr/win32/include' ],
80 extra_compile_args = get_cflags(),
81 extra_link_args = [ '-L' + os.path.join(top_builddir, 'src', '.libs') ] + get_ldflags(),
84 setup (name = 'VLC Internal Bindings',
85 version = get_vlc_version(),
86 #scripts = [ os.path.join( srcdir, 'vlcwrapper.py') ],
87 keywords = [ 'vlc', 'video' ],
89 description = """VLC internal bindings for python.
91 This module provides an Object type, which gives a low-level access to
92 the vlc objects and their variables.
98 # Access lowlevel objets
99 o=vlcinternal.Object(1)
101 i=o.find_object('input')
105 ext_modules = [ vlclocal ])