vlc/python | branch: master | Olivier Aubert <[email protected]> | Sun Feb 24 16:22:31 2019 +0100| [e653f6e9ac90b2c05607f8f122105d4bf2867a37] | committer: Olivier Aubert
python: factorize dll loading on linux/freebsd > http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=e653f6e9ac90b2c05607f8f122105d4bf2867a37 --- generator/generate.py | 2 +- generator/templates/header.py | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/generator/generate.py b/generator/generate.py index 0333e55..e48245a 100755 --- a/generator/generate.py +++ b/generator/generate.py @@ -56,7 +56,7 @@ __all__ = ('Parser', # Version number MUST have a major < 10 and a minor < 99 so that the # generated dist version can be correctly generated. -__version__ = '1.7' +__version__ = '1.8' _debug = False diff --git a/generator/templates/header.py b/generator/templates/header.py index 7af23b8..f0d03c2 100755 --- a/generator/templates/header.py +++ b/generator/templates/header.py @@ -121,19 +121,7 @@ def find_lib(): if dll is not None: return dll, plugin_path - if sys.platform.startswith('linux'): - p = find_library('vlc') - try: - dll = ctypes.CDLL(p) - except OSError: # may fail - dll = ctypes.CDLL('libvlc.so.5') - elif sys.platform.startswith('freebsd'): - p = find_library('vlc') - try: - dll = ctypes.CDLL(p) - except OSError: # may fail - dll = ctypes.CDLL('libvlc.so.5') - elif sys.platform.startswith('win'): + if sys.platform.startswith('win'): libname = 'libvlc.dll' p = find_library(libname) if p is None: @@ -198,7 +186,17 @@ def find_lib(): dll = ctypes.CDLL('libvlc.dylib') else: - raise NotImplementedError('%s: %s not supported' % (sys.argv[0], sys.platform)) + # All other OSes (linux, freebsd...) + p = find_library('vlc') + try: + dll = ctypes.CDLL(p) + except OSError: # may fail + dll = None + if dll is None: + try: + dll = ctypes.CDLL('libvlc.so.5') + except: + raise NotImplementedError('Cannot find libvlc lib') return (dll, plugin_path) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
