Skip to content

Commit 6f27274

Browse files
Make some easyaccess functions conditional
This eliminates the need to have separate SWIG files for libexiv2 v0.27.3 and older.
1 parent f5219cc commit 6f27274

36 files changed

+132
-151341
lines changed

src/interface/easyaccess.i

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,24 @@
2323

2424
%include "shared/preamble.i"
2525
%include "shared/exception.i"
26+
%include "shared/exv_options.i"
2627

2728
// Catch all C++ exceptions
2829
EXCEPTION()
2930

31+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::apertureValue)
32+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::brightnessValue)
33+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::dateTimeOriginal)
34+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::exposureBiasValue)
35+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::exposureIndex)
36+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::flash)
37+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::flashEnergy)
38+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::lightSource)
39+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::maxApertureValue)
40+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::sensingMethod)
41+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::shutterSpeedValue)
42+
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::subjectArea)
43+
3044
// Store data.end() after converting input
3145
%typemap(check) Exiv2::ExifData& (Exiv2::ExifData::const_iterator _global_end) %{
3246
_global_end = $1->end();

src/interface/shared/exv_options.i

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,22 @@ namespace Exiv2 {
7474
}
7575
}
7676
%enddef // EXV_ENABLE_FILESYSTEM_FUNCTION
77+
78+
// Macro to not call a function if libexiv2 version is <= 0.27.3
79+
%define EXV_ENABLE_EASYACCESS_FUNCTION(signature)
80+
%fragment("_set_python_exception");
81+
%fragment("set_EXV_ENABLE_FILESYSTEM");
82+
%exception signature {
83+
try {
84+
%#if EXIV2_TEST_VERSION(0, 27, 4)
85+
$action
86+
%#else
87+
throw Exiv2::Error(Exiv2::kerFunctionNotSupported);
88+
%#endif
89+
}
90+
catch(std::exception const& e) {
91+
_set_python_exception();
92+
SWIG_fail;
93+
}
94+
}
95+
%enddef // EXV_ENABLE_EASYACCESS_FUNCTION

src/swig-0_27_3/__init__.py

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/swig-0_27_3/__main__.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/swig-0_27_3/basicio.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)