vlc/python | branch: master | Olivier Aubert <cont...@olivieraubert.net> | Mon Sep 25 14:57:13 2017 +0200| [5506a5283df92fa08871d6c393ed1d8f139639fb] | committer: Olivier Aubert
python-vlc: allow to specify lib and plugin path Using environment variables PYTHON_VLC_LIB_PATH and PYTHON_VLC_MODULE_PATH. This will help experimenting with various setups. Closes #31 > http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=5506a5283df92fa08871d6c393ed1d8f139639fb --- generator/header.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/generator/header.py b/generator/header.py index 3c34459..0eee6ff 100755 --- a/generator/header.py +++ b/generator/header.py @@ -49,6 +49,9 @@ import functools # Used by EventManager in override.py from inspect import getargspec +import logging +logger = logging.getLogger(__name__) + build_date = '' # build time stamp and __version__, see generate.py # The libvlc doc states that filenames are expected to be in UTF8, do @@ -105,7 +108,19 @@ _internal_guard = object() def find_lib(): dll = None - plugin_path = None + plugin_path = os.environ.get('PYTHON_VLC_MODULE_PATH', None) + if 'PYTHON_VLC_LIB_PATH' in os.environ: + try: + dll = ctypes.CDLL(os.environ['PYTHON_VLC_LIB_PATH']) + except OSError: + logger.error("Cannot load lib specified by PYTHON_VLC_LIB_PATH env. variable") + sys.exit(1) + if plugin_path and not os.path.isdir(plugin_path): + logger.error("Invalid PYTHON_VLC_MODULE_PATH specified. Please fix.") + sys.exit(1) + if dll is not None: + return dll, plugin_path + if sys.platform.startswith('linux'): p = find_library('vlc') try: _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits