[vlc-devel] [PATCH] Improve vlc python binding source distribution

Nicolas Chauvet (kwizart) kwizart at gmail.com
Sat May 23 16:37:43 CEST 2009


There is a need to improve the vlc python binding distribution as sources.
According to http://docs.python.org/distutils/index.html#distutils-index,
some field was missing or used unappropriately.

Please verify that no outdated MANIFEST is keept in current dir.

Source distribution can be generated with:
$ python setup.py sdist

Suggested versioning scheme :
 1.0 to match vlc version (1.0-bugfix branch)
 1.0.0.90 when development version
 1.0.1 for python-vlc stable releases.

Notes:
1/pkg-config vlc support is currently hardcoded with:
    if 1:
        vlcconfig="pkg-config libvlc"
2/Initial report http://bugzilla.rpmfusion.org/show_bug.cgi?id=391
---
 bindings/python/MANIFEST.in |    7 ++++++
 bindings/python/setup.py    |   47 +++++++++++++++++++++++++++---------------
 2 files changed, 37 insertions(+), 17 deletions(-)
 create mode 100644 bindings/python/MANIFEST.in

diff --git a/bindings/python/MANIFEST.in b/bindings/python/MANIFEST.in
new file mode 100644
index 0000000..5e74474
--- /dev/null
+++ b/bindings/python/MANIFEST.in
@@ -0,0 +1,7 @@
+include vlcglue.h
+include vlc_mediacontrol.c
+include vlc_position.c
+include vlc_instance.c
+include vlc_mediaplayer.c
+include vlc_media.c
+include vlcwidget.py
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 018e080..d5db1d8 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -1,5 +1,6 @@
 from distutils.core import setup, Extension
 import os
+import commands
 
 # Get build variables (buildir, srcdir)
 top_builddir = os.path.join( '..', '..' )
@@ -31,6 +32,9 @@ def get_vlcconfig():
         if os.path.exists(n):
             vlcconfig=n
             break
+    status, output = commands.getstatusoutput('pkg-config libvlc --exists')
+    if 1:
+        vlcconfig="pkg-config libvlc"
     if vlcconfig is None:
         print "*** Warning *** Cannot find vlc-config"
     elif os.sys.platform == 'win32':
@@ -43,7 +47,10 @@ def get_vlc_version():
     if vlcconfig is None:
         return ""
     else:
-        version=os.popen('%s --version' % vlcconfig, 'r').readline().strip()
+        if 1:
+             version=os.popen('%s --modversion' % vlcconfig, 'r').readline().strip()
+        else: 
+             version=os.popen('%s --version' % vlcconfig, 'r').readline().strip()
         return version
     
 def get_cflags():
@@ -51,7 +58,10 @@ def get_cflags():
     if vlcconfig is None:
         return []
     else:
-        cflags=os.popen('%s --cflags vlc' % vlcconfig, 'r').readline().rstrip().split()
+        if 1:
+            cflags=os.popen('%s --cflags ' % vlcconfig, 'r').readline().strip()
+        else:
+            cflags=os.popen('%s --cflags vlc' % vlcconfig, 'r').readline().rstrip().split()
         return cflags
 
 def get_ldflags():
@@ -62,14 +72,14 @@ def get_ldflags():
 	ldflags = []
 	if os.sys.platform == 'darwin':
 	    ldflags = "-read_only_relocs warning".split()
-        ldflags.extend(os.popen('%s --libs external' % vlcconfig,
-				'r').readline().rstrip().split())
+        if 1:
+          ldflags.extend(os.popen('%s --libs ' % vlcconfig,
+                                 'r').readline().rstrip().split())
+        else:
+            ldflags.extend(os.popen('%s --libs external' % vlcconfig,
+  				'r').readline().rstrip().split())
 	if os.sys.platform == 'darwin':
 	    ldflags.append('-lstdc++')
-        if not libtool:
-            # vlc-config is broken and gives a -lvlc which
-            # does not exist if libtool is disabled.
-            ldflags.remove('-lvlc')
         return ldflags
 
 #source_files = [ 'vlc_module.c', 'vlc_mediacontrol.c',
@@ -80,29 +90,32 @@ source_files = [ 'vlc_module.c' ]
 vlclocal = Extension('vlc',
 		sources = [ os.path.join( srcdir, f ) for f in source_files ],
 		include_dirs = [ top_builddir,
-			      os.path.join( srcdir, '..', '..', 'include' ),
-			      srcdir,
-			      '/usr/win32/include' ],
+			      srcdir ],
 		extra_objects = [ ],
                 extra_compile_args = get_cflags(),
 		extra_link_args = linkargs + get_ldflags(),
                 )
 
-setup (name = 'VLC Bindings',
-       version = get_vlc_version(),
-       #scripts = [ os.path.join( srcdir, 'vlcwrapper.py') ],
+setup (name = 'python-vlc',
+       version = '1.0.0.90',
+       author='Olivier Aubert',
+       author_email='oaubert at bat710.univ-lyon1.fr',
+       url='http://wiki.videolan.org/PythonBinding',
+       #scripts = [ os.path.join( srcdir, 'vlcwidget.py') ],
+       py_modules=['vlcwrapper'],
        keywords = [ 'vlc', 'video' ],
        license = "GPL", 
-       description = """VLC bindings for python.
+       description = 'VLC bindings for python.',
+       long_description = """VLC bindings for python.
 
 This module provides bindings for the native libvlc API of the VLC
 video player. Documentation can be found on the VLC wiki : 
-http://wiki.videolan.org/index.php/ExternalAPI
+http://wiki.videolan.org/ExternalAPI
 
 This module also provides a MediaControl object, which implements an
 API inspired from the OMG Audio/Video Stream 1.0 specification.
 Documentation can be found on the VLC wiki :
-http://wiki.videolan.org/index.php/PythonBinding
+http://wiki.videolan.org/PythonBinding
 
 Example session:
 
-- 
1.6.0.6




More information about the vlc-devel mailing list