diff options
| author | morefigs <morefigs@gmail.com> | 2019-02-21 17:24:15 +1100 |
|---|---|---|
| committer | morefigs <morefigs@gmail.com> | 2019-02-21 17:24:15 +1100 |
| commit | 4efb63b1285b831f2489b7a41da3eb22ef31cd5d (patch) | |
| tree | 2f9088f7a52384b506310133c94ead5e7ccbd20b | |
| parent | 79d24ae0b181f41373e4437390a4b881a3dae7eb (diff) | |
| download | pymba-4efb63b1285b831f2489b7a41da3eb22ef31cd5d.tar.gz pymba-4efb63b1285b831f2489b7a41da3eb22ef31cd5d.zip | |
check local directory first for VimbaC.dll
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | pymba/__init__.py | 2 | ||||
| -rw-r--r-- | pymba/vimba_c.py | 34 | ||||
| -rw-r--r-- | setup.py | 2 |
4 files changed, 26 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a9f1f0..4b9f1e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Command type features can now be called directly as an object attribute. ### Changed - Increased default frame buffer size from 3 to 10. +- Also looks in working directory for VimbaC.dll to make distribution easier. ## [0.3] - 2019/02/11 ### Added diff --git a/pymba/__init__.py b/pymba/__init__.py index 9095a32..3ad7a40 100644 --- a/pymba/__init__.py +++ b/pymba/__init__.py @@ -2,4 +2,4 @@ from .vimba import Vimba, VimbaException from .frame import Frame -PYMBA_VERSION = '0.3' +PYMBA_VERSION = '0.3.1' diff --git a/pymba/vimba_c.py b/pymba/vimba_c.py index 30b9d77..802d5e8 100644 --- a/pymba/vimba_c.py +++ b/pymba/vimba_c.py @@ -8,30 +8,42 @@ if sys_plat == "win32": def find_win_dll(arch): """ Finds the highest versioned windows dll for the specified architecture. """ - bases = [ - r'C:\Program Files\Allied Vision Technologies\AVTVimba_%i.%i\VimbaC\Bin\Win%i\VimbaC.dll', - r'C:\Program Files\Allied Vision\Vimba_%i.%i\VimbaC\Bin\Win%i\VimbaC.dll' - ] dlls = [] - for base in bases: - for major in range(3): - for minor in range(10): - candidate = base % (major, minor, arch) - if os.path.isfile(candidate): - dlls.append(candidate) + + filename = 'VimbaC.dll' + + # look in local working directory first + if os.path.isfile(filename): + dlls.append(filename) + if not dlls: if 'VIMBA_HOME' in os.environ: - candidate = os.environ ['VIMBA_HOME'] + '\VimbaC\Bin\Win%i\VimbaC.dll' % (arch) + candidate = os.environ['VIMBA_HOME'] + r'\VimbaC\Bin\Win%i\VimbaC.dll' % (arch) if os.path.isfile(candidate): dlls.append(candidate) + + if not dlls: + bases = [ + r'C:\Program Files\Allied Vision Technologies\AVTVimba_%i.%i\VimbaC\Bin\Win%i\VimbaC.dll', + r'C:\Program Files\Allied Vision\Vimba_%i.%i\VimbaC\Bin\Win%i\VimbaC.dll' + ] + for base in bases: + for major in range(3): + for minor in range(10): + candidate = base % (major, minor, arch) + if os.path.isfile(candidate): + dlls.append(candidate) + if not dlls: raise IOError("VimbaC.dll not found.") + return dlls[-1] if '64' in platform.architecture()[0]: vimbaC_path = find_win_dll(64) else: vimbaC_path = find_win_dll(32) + dll_loader = windll else: @@ -6,7 +6,7 @@ from pymba import PYMBA_VERSION setup(name='pymba', version=PYMBA_VERSION, description="Pymba is a Python wrapper for Allied Vision's Vimba C API.", - long_description="Pymba is a Python wrapper for Allied Vision's Vimba C API. It wraps the VimbaC library file " + long_description="Pymba is a Python wrapper for Allied Vision's Vimba C API. It wraps the Vimba C library file " "included in the Vimba installation to provide a simple Python interface for Allied Vision " "cameras. It currently supports most of the functionality provided by Vimba.", # https://pypi.org/pypi?%3Aaction=list_classifiers |
