<div dir="ltr">When you install python-vlc using pip or a similar package manager, you<br>won't have access to VLC files so you can't generate a fresh vlc.py.<br>However, the project itself ships a reasonably updated pre-generated<br>vlc.py that we can fall back to.<br>---<br> setup.py | 24 ++++++++++++++----------<br> 1 file changed, 14 insertions(+), 10 deletions(-)<br><br>diff --git a/setup.py b/setup.py<br>index 5733a41..9013ac8 100644<br>--- a/setup.py<br>+++ b/setup.py<br>@@ -1,19 +1,23 @@<br> from distribute_setup import use_setuptools<br> use_setuptools()<br> <br>-from distutils.core import setup<br>-import sys<br>+import logging<br> import os<br>-import generate<br>+import shutil<br>+from distutils.core import setup<br> <br>-vlc_include_path = os.path.join("..","..","include","vlc")<br>-if not os.path.exists(vlc_include_path):<br>-    raise Exception("This script should be run from a VLC tree.")<br>+import generate<br> <br>-files = [ os.path.join(vlc_include_path, filename)<br>-          for filename in os.listdir(vlc_include_path) ]<br> <br>-generate.process('vlc.py', files)<br>+vlc_include_path = os.path.join("..", "..", "include", "vlc")<br>+if os.path.exists(vlc_include_path):<br>+    files = [ os.path.join(vlc_include_path, filename)<br>+              for filename in os.listdir(vlc_include_path) ]<br>+    generate.process('vlc.py', files)<br>+else:<br>+    logging.warning("This script should be run from a VLC tree. "<br>+                    "Falling back to pre-generated file.")<br>+    shutil.copy(os.path.join('generated', 'vlc.py'), 'vlc.py')<br> <br> setup(name='python-vlc',<br>       version = '1.1.0',<br>@@ -29,6 +33,6 @@ setup(name='python-vlc',<br> This module provides ctypes-based bindings for the native libvlc API<br> (see <a href="http://wiki.videolan.org/LibVLC">http://wiki.videolan.org/LibVLC</a>) of the VLC video player.<br> <br>-It is automatically generated from the include files.<br>+It is automatically generated from the include files if they are available.<br> """<br>       )<br>-- <br>2.5.1<br></div>