Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.16 #26

Merged
merged 12 commits into from
Jan 12, 2024
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see
<http://www.gnu.org/licenses/>.

Changes in v0.16.2:
1/ Removed AnyError alias of Exiv2Error exception.
2/ Improved handling of enums:
1/ Enum results are returned as Python enum instead of int.
2/ Passing ints as enum parameters is deprecated.
3/ SWIG v4.1.0 or later required to run SWIG.

Changes in v0.16.1:
1/ Binary wheels incorporate libexiv2 v0.27.7.

Expand Down
4 changes: 4 additions & 0 deletions src/interface/basicio.i
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
%include "shared/preamble.i"
%include "shared/buffers.i"
%include "shared/enum.i"
%include "shared/exception.i"
%include "shared/keep_reference.i"
%include "shared/unique_ptr.i"
%include "shared/windows_path.i"
Expand All @@ -31,6 +32,9 @@

%import "types.i"

// Catch all C++ exceptions
EXCEPTION()

UNIQUE_PTR(Exiv2::BasicIo);

// Potentially blocking calls allow Python threads
Expand Down
11 changes: 10 additions & 1 deletion src/interface/datasets.i
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
// Copyright (C) 2021-23 Jim Easterbrook [email protected]
// Copyright (C) 2021-24 Jim Easterbrook [email protected]
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -18,11 +18,19 @@
%module(package="exiv2") datasets

%include "shared/preamble.i"
%include "shared/exception.i"
%include "shared/static_list.i"
%include "shared/unique_ptr.i"

%import "metadatum.i"

// Catch some C++ exceptions
%exception;
EXCEPTION(Exiv2::IptcDataSets::dataSet)
EXCEPTION(Exiv2::IptcDataSets::recordId)
EXCEPTION(Exiv2::IptcKey::IptcKey(std::string))
EXCEPTION(Exiv2::IptcKey::IptcKey(std::string const &))

UNIQUE_PTR(Exiv2::IptcKey);

// IptcDataSets::application2RecordList and IptcDataSets::envelopeRecordList
Expand Down Expand Up @@ -52,6 +60,7 @@ LIST_POINTER(const Exiv2::DataSet*, Exiv2::DataSet, number_ != 0xffff)
%ignore Exiv2::Dictionary_i;
%ignore Exiv2::IptcDataSets::dataSetList;
%ignore Exiv2::IptcDataSets::IptcDataSets;
%ignore Exiv2::IptcDataSets::~IptcDataSets;
%ignore Exiv2::RecordInfo;
%ignore Exiv2::StringSet;
%ignore Exiv2::StringSet_i;
Expand Down
6 changes: 5 additions & 1 deletion src/interface/easyaccess.i
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
// Copyright (C) 2021-23 Jim Easterbrook [email protected]
// Copyright (C) 2021-24 Jim Easterbrook [email protected]
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -18,6 +18,10 @@
%module(package="exiv2") easyaccess

%include "shared/preamble.i"
%include "shared/exception.i"

// Catch all C++ exceptions
EXCEPTION()

// Store data.end() after converting input
%typemap(check) Exiv2::ExifData& (Exiv2::ExifData::const_iterator _global_end) %{
Expand Down
4 changes: 4 additions & 0 deletions src/interface/exif.i
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
%include "shared/buffers.i"
%include "shared/containers.i"
%include "shared/data_iterator.i"
%include "shared/exception.i"
%include "shared/keep_reference.i"
%include "shared/windows_path.i"

Expand All @@ -30,6 +31,9 @@
%import "metadatum.i"
%import "tags.i"

// Catch all C++ exceptions
EXCEPTION()

// ExifThumb keeps a reference to the ExifData it uses
KEEP_REFERENCE_EX(Exiv2::ExifThumb*, swig_obj[0])

Expand Down
66 changes: 35 additions & 31 deletions src/interface/image.i
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
// Copyright (C) 2021-23 Jim Easterbrook [email protected]
// Copyright (C) 2021-24 Jim Easterbrook [email protected]
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -23,6 +23,7 @@
%include "shared/preamble.i"
%include "shared/buffers.i"
%include "shared/enum.i"
%include "shared/exception.i"
%include "shared/keep_reference.i"
%include "shared/windows_path.i"

Expand All @@ -34,6 +35,9 @@
%import "tags.i";
%import "xmp.i";

// Catch all C++ exceptions
EXCEPTION()

UNIQUE_PTR(Exiv2::Image);

// Potentially blocking calls allow Python threads
Expand Down Expand Up @@ -110,13 +114,13 @@ KEEP_REFERENCE(Exiv2::DataBuf&)

// Make image types available
#if (EXIV2_VERSION_HEX >= 0x001c0000)
#define _BMFF "bmff", int(Exiv2::ImageType::bmff),
#define _WEBP "webp", int(Exiv2::ImageType::webp),
#define _BMFF "bmff", Exiv2::ImageType::bmff,
#define _WEBP "webp", Exiv2::ImageType::webp,
#define _VIDEO \
"asf", int(Exiv2::ImageType::asf), \
"mkv", int(Exiv2::ImageType::mkv), \
"qtime", int(Exiv2::ImageType::qtime), \
"riff", int(Exiv2::ImageType::riff),
"asf", Exiv2::ImageType::asf, \
"mkv", Exiv2::ImageType::mkv, \
"qtime", Exiv2::ImageType::qtime, \
"riff", Exiv2::ImageType::riff,
#else
#define _BMFF "bmff", int(19),
#define _WEBP "webp", int(23),
Expand All @@ -128,33 +132,33 @@ KEEP_REFERENCE(Exiv2::DataBuf&)
#endif

ENUM(ImageType, "Supported image formats.",
"arw", int(Exiv2::ImageType::arw),
"arw", Exiv2::ImageType::arw,
_BMFF
"bmp", int(Exiv2::ImageType::bmp),
"cr2", int(Exiv2::ImageType::cr2),
"crw", int(Exiv2::ImageType::crw),
"dng", int(Exiv2::ImageType::dng),
"eps", int(Exiv2::ImageType::eps),
"exv", int(Exiv2::ImageType::exv),
"gif", int(Exiv2::ImageType::gif),
"jp2", int(Exiv2::ImageType::jp2),
"jpeg", int(Exiv2::ImageType::jpeg),
"mrw", int(Exiv2::ImageType::mrw),
"nef", int(Exiv2::ImageType::nef),
"none", int(Exiv2::ImageType::none),
"orf", int(Exiv2::ImageType::orf),
"pgf", int(Exiv2::ImageType::pgf),
"png", int(Exiv2::ImageType::png),
"psd", int(Exiv2::ImageType::psd),
"raf", int(Exiv2::ImageType::raf),
"rw2", int(Exiv2::ImageType::rw2),
"sr2", int(Exiv2::ImageType::sr2),
"srw", int(Exiv2::ImageType::srw),
"tga", int(Exiv2::ImageType::tga),
"tiff", int(Exiv2::ImageType::tiff),
"bmp", Exiv2::ImageType::bmp,
"cr2", Exiv2::ImageType::cr2,
"crw", Exiv2::ImageType::crw,
"dng", Exiv2::ImageType::dng,
"eps", Exiv2::ImageType::eps,
"exv", Exiv2::ImageType::exv,
"gif", Exiv2::ImageType::gif,
"jp2", Exiv2::ImageType::jp2,
"jpeg", Exiv2::ImageType::jpeg,
"mrw", Exiv2::ImageType::mrw,
"nef", Exiv2::ImageType::nef,
"none", Exiv2::ImageType::none,
"orf", Exiv2::ImageType::orf,
"pgf", Exiv2::ImageType::pgf,
"png", Exiv2::ImageType::png,
"psd", Exiv2::ImageType::psd,
"raf", Exiv2::ImageType::raf,
"rw2", Exiv2::ImageType::rw2,
"sr2", Exiv2::ImageType::sr2,
"srw", Exiv2::ImageType::srw,
"tga", Exiv2::ImageType::tga,
"tiff", Exiv2::ImageType::tiff,
_VIDEO
_WEBP
"xmp", int(Exiv2::ImageType::xmp));
"xmp", Exiv2::ImageType::xmp);
%ignore Exiv2::ImageType::none;

// Ignore const versions of methods
Expand Down
4 changes: 4 additions & 0 deletions src/interface/iptc.i
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@
%include "shared/preamble.i"
%include "shared/containers.i"
%include "shared/data_iterator.i"
%include "shared/exception.i"

%include "stdint.i"
%include "std_string.i"

%import "datasets.i"
%import "metadatum.i"

// Catch all C++ exceptions
EXCEPTION()

EXTEND_METADATUM(Exiv2::Iptcdatum)

DATA_ITERATOR_TYPEMAPS(IptcData_iterator, Exiv2::IptcData::iterator)
Expand Down
6 changes: 5 additions & 1 deletion src/interface/metadatum.i
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
// Copyright (C) 2021-23 Jim Easterbrook [email protected]
// Copyright (C) 2021-24 Jim Easterbrook [email protected]
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -20,6 +20,7 @@
#pragma SWIG nowarn=314 // 'print' is a python keyword, renaming to '_print'

%include "shared/preamble.i"
%include "shared/exception.i"
%include "shared/keep_reference.i"
%include "shared/unique_ptr.i"

Expand All @@ -28,6 +29,9 @@
%import "types.i"
%import "value.i"

// Catch all C++ exceptions
EXCEPTION()

UNIQUE_PTR(Exiv2::Key);

// Keep a reference to Metadatum when calling value()
Expand Down
6 changes: 5 additions & 1 deletion src/interface/preview.i
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
// Copyright (C) 2021-23 Jim Easterbrook [email protected]
// Copyright (C) 2021-24 Jim Easterbrook [email protected]
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -22,6 +22,7 @@

%include "shared/preamble.i"
%include "shared/buffers.i"
%include "shared/exception.i"
%include "shared/keep_reference.i"
%include "shared/windows_path.i"

Expand All @@ -31,6 +32,9 @@
%import "image.i";
%import "types.i";

// Catch all C++ exceptions
EXCEPTION()

// Some calls don't raise exceptions
%noexception Exiv2::PreviewImage::__len__;
%noexception Exiv2::PreviewImage::extension;
Expand Down
19 changes: 19 additions & 0 deletions src/interface/properties.i
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,31 @@
%module(package="exiv2") properties

%include "shared/preamble.i"
%include "shared/exception.i"
%include "shared/enum.i"
%include "shared/static_list.i"
%include "shared/unique_ptr.i"

%import "datasets.i"
%import "metadatum.i"

// Catch all C++ exceptions...
EXCEPTION()

// ...except these
%noexception Exiv2::XmpKey::~XmpKey;
%noexception Exiv2::XmpKey::familyName;
%noexception Exiv2::XmpKey::groupName;
%noexception Exiv2::XmpKey::key;
%noexception Exiv2::XmpKey::tag;
%noexception Exiv2::XmpKey::tagLabel;
%noexception Exiv2::XmpKey::tagName;
%noexception Exiv2::XmpProperties::prefix;
%noexception Exiv2::XmpProperties::propertyDesc;
%noexception Exiv2::XmpProperties::propertyInfo;
%noexception Exiv2::XmpProperties::propertyTitle;
%noexception Exiv2::XmpProperties::propertyType;

UNIQUE_PTR(Exiv2::XmpKey);

// Make Xmp category more Pythonic
Expand Down Expand Up @@ -108,6 +126,7 @@ static PyObject* struct_to_dict(const Exiv2::XmpNsInfo* info) {
%ignore Exiv2::XmpNsInfo::Ns;

// Ignore stuff Python can't use
%ignore Exiv2::XmpProperties::~XmpProperties;
%ignore Exiv2::XmpProperties::lookupNsRegistry;
%ignore Exiv2::XmpProperties::printProperties;
%ignore Exiv2::XmpProperties::printProperty;
Expand Down
Loading