Skip to content

Commit

Permalink
Merge pull request #37 from jim-easterbrook/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
jim-easterbrook authored Aug 2, 2024
2 parents 52f9ca2 + e2dcc35 commit 829065a
Show file tree
Hide file tree
Showing 95 changed files with 1,064 additions and 151,537 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build-linux-28.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
- name: Fetch Exiv2 source
run: >
wget -nv
https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.2.tar.gz
https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.3.tar.gz
-O exiv2.tar.gz
- name: Extract Exiv2 source
run: |
tar -xzf exiv2.tar.gz
mv exiv2-0.28.2 libexiv2
mv exiv2-0.28.3 libexiv2
- name: Download inih
run: >
Expand Down Expand Up @@ -54,13 +54,14 @@ jobs:
-D EXIV2_BUILD_SAMPLES=OFF
-D EXIV2_BUILD_UNIT_TESTS=OFF
-D EXIV2_ENABLE_NLS=ON
-D EXIV2_ENABLE_FILESYSTEM_ACCESS=ON
-D EXIV2_BUILD_EXIV2_COMMAND=OFF
-D EXIV2_TEAM_WARNINGS_AS_ERRORS=OFF &&
cmake --build build-linux-release --config Release &&
cmake --install build-linux-release --config Release
- name: Store results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-28-wheels
path: wheelhouse/*.whl
7 changes: 4 additions & 3 deletions .github/workflows/build-macos-28.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
- name: Fetch Exiv2 source
run: >
wget -nv
https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.2.tar.gz
https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.3.tar.gz
-O exiv2.tar.gz
- name: Extract Exiv2 source
shell: bash
run: |
tar -xzf exiv2.tar.gz
mv exiv2-0.28.2 libexiv2
mv exiv2-0.28.3 libexiv2
- name: Build wheels
uses: pypa/[email protected]
Expand All @@ -38,13 +38,14 @@ jobs:
-D EXIV2_BUILD_SAMPLES=OFF
-D EXIV2_BUILD_UNIT_TESTS=OFF
-D EXIV2_ENABLE_NLS=ON
-D EXIV2_ENABLE_FILESYSTEM_ACCESS=ON
-D EXIV2_BUILD_EXIV2_COMMAND=OFF
-D EXIV2_TEAM_WARNINGS_AS_ERRORS=OFF &&
cmake --build build-base_mac --config Release &&
cmake --install build-base_mac --config Release
- name: Store results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: macos-28-wheels
path: wheelhouse/*.whl
7 changes: 4 additions & 3 deletions .github/workflows/build-macos-arm-28.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
- name: Fetch Exiv2 source
run: >
wget -nv
https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.2.tar.gz
https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.3.tar.gz
-O exiv2.tar.gz
- name: Extract Exiv2 source
shell: bash
run: |
tar -xzf exiv2.tar.gz
mv exiv2-0.28.2 libexiv2
mv exiv2-0.28.3 libexiv2
- name: Install pipx
run: pip install pipx
Expand All @@ -43,13 +43,14 @@ jobs:
-D EXIV2_BUILD_SAMPLES=OFF
-D EXIV2_BUILD_UNIT_TESTS=OFF
-D EXIV2_ENABLE_NLS=ON
-D EXIV2_ENABLE_FILESYSTEM_ACCESS=ON
-D EXIV2_BUILD_EXIV2_COMMAND=OFF
-D EXIV2_TEAM_WARNINGS_AS_ERRORS=OFF &&
cmake --build build-base_mac --config Release &&
cmake --install build-base_mac --config Release
- name: Store results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: macos-arm-28-wheels
path: wheelhouse/*.whl
7 changes: 4 additions & 3 deletions .github/workflows/build-windows-28.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
- name: Fetch Exiv2 source
run: >
c:\msys64\usr\bin\wget.exe -nv
https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.2.tar.gz
https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.3.tar.gz
-O exiv2.tar.gz
- name: Extract Exiv2 source
shell: bash
run: |
tar -xzf exiv2.tar.gz
mv exiv2-0.28.2 libexiv2
mv exiv2-0.28.3 libexiv2
# tweaks to allow NLS
echo -e "24a25\n> self.requires('libgettext/0.21')" |
c:/msys64/usr/bin/patch.exe libexiv2/conanfile.py
Expand All @@ -56,13 +56,14 @@ jobs:
-D EXIV2_BUILD_EXIV2_COMMAND=OFF
-D EXIV2_BUILD_UNIT_TESTS=OFF
-D EXIV2_ENABLE_NLS=ON
-D EXIV2_ENABLE_FILESYSTEM_ACCESS=ON
-G "Visual Studio 16 2019" &&
cmake --build build-msvc --config Release &&
cmake --install build-msvc --config Release &&
copy build-msvc\bin\libcurl.dll build-msvc\install\bin
- name: Store results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: windows-28-wheels
path: wheelhouse/*.whl
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ along with this program. If not, see

Changes in v0.17.0:
1/ API change: derived classes of BasicIo are omitted from Python.
2/ Binary wheels incorporate libexiv2 v0.28.3.
3/ enableBMFF() function is deprecated.
4/ Documentation is available on https://python-exiv2.readthedocs.io/
5/ Improved handling of Windows code page character sets.

Changes in v0.16.3:
1/ Binary wheels incorporate libexiv2 v0.28.2.
Expand Down
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ The C++ documentation is still needed in these cases.
Support for bmff files (e.g. CR3, HEIF, HEIC, AVIF, JPEG XL)
------------------------------------------------------------

Python-exiv2 from version 0.8.3 onwards is built with support for BMFF files.
In order to use BMFF files in your Python program you need to call the ``enableBMFF`` function.
Python-exiv2 from version 0.17.0 has support for BMFF files enabled by default if libexiv2 was compiled with support for BMFF files enabled.
In earlier versions you need to call the ``enableBMFF`` function before using BMFF files in your program.
Use of BMFF files may infringe patents.
Please read the Exiv2 `statement on BMFF`_ patents before doing so.

Installation
Expand Down
3 changes: 1 addition & 2 deletions src/interface/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-exiv2 - Python interface to exiv2
# http://github.com/jim-easterbrook/python-exiv2
# Copyright (C) 2021-22 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 Down Expand Up @@ -31,7 +31,6 @@ def main():
print('python-exiv2 version:', exiv2.__version__)
print('python-exiv2 examples:',
os.path.join(os.path.dirname(__file__), 'examples'))
print('BMFF support:', exiv2.enableBMFF(False))
if args.verbosity:
print('libexiv2 build options:')
pprint.pprint(exiv2.versionInfo())
Expand Down
5 changes: 5 additions & 0 deletions src/interface/basicio.i
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
%include "shared/buffers.i"
%include "shared/enum.i"
%include "shared/exception.i"
%include "shared/exv_options.i"
%include "shared/keep_reference.i"
%include "shared/unique_ptr.i"
%include "shared/windows_path.i"
Expand All @@ -40,6 +41,10 @@
// Catch all C++ exceptions
EXCEPTION()

%fragment("EXV_USE_CURL");
%fragment("EXV_USE_SSH");
%fragment("EXV_ENABLE_FILESYSTEM");

UNIQUE_PTR(Exiv2::BasicIo);

// Potentially blocking calls allow Python threads
Expand Down
14 changes: 14 additions & 0 deletions src/interface/easyaccess.i
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,24 @@

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

// Catch all C++ exceptions
EXCEPTION()

EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::apertureValue)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::brightnessValue)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::dateTimeOriginal)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::exposureBiasValue)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::exposureIndex)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::flash)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::flashEnergy)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::lightSource)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::maxApertureValue)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::sensingMethod)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::shutterSpeedValue)
EXV_ENABLE_EASYACCESS_FUNCTION(Exiv2::subjectArea)

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

Expand All @@ -43,6 +44,12 @@ IMPORT_ENUM(TypeId)
// Catch all C++ exceptions
EXCEPTION()

EXV_ENABLE_FILESYSTEM_FUNCTION(Exiv2::ExifThumb::setJpegThumbnail(
const std::string&))
EXV_ENABLE_FILESYSTEM_FUNCTION(Exiv2::ExifThumb::setJpegThumbnail(
const std::string&, URational, URational, uint16_t))
EXV_ENABLE_FILESYSTEM_FUNCTION(Exiv2::ExifThumbC::writeFile)

// ExifThumb keeps a reference to the ExifData it uses
KEEP_REFERENCE_EX(Exiv2::ExifThumb*, args)

Expand Down
24 changes: 21 additions & 3 deletions src/interface/image.i
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
%include "shared/buffers.i"
%include "shared/enum.i"
%include "shared/exception.i"
%include "shared/exv_options.i"
%include "shared/keep_reference.i"
%include "shared/windows_path.i"

Expand All @@ -45,6 +46,12 @@ IMPORT_ENUM(MetadataId)
// Catch all C++ exceptions
EXCEPTION()

%fragment("EXV_USE_CURL");
%fragment("EXV_USE_SSH");
%fragment("EXV_ENABLE_FILESYSTEM");
EXV_ENABLE_FILESYSTEM_FUNCTION(Exiv2::ImageFactory::create(
ImageType, const std::string&))

UNIQUE_PTR(Exiv2::Image);

// Potentially blocking calls allow Python threads
Expand Down Expand Up @@ -132,19 +139,30 @@ Create a MemIo subclass of BasicIo using the provided memory.
}
}

// Enable BMFF if libexiv2 was compiled with BMFF support
%init %{
#if defined EXV_ENABLE_BMFF && !EXIV2_TEST_VERSION(0, 28, 3)
Exiv2::enableBMFF(true);
#endif
%}

// Make enableBMFF() function available regardless of exiv2 version
%feature("docstring") enableBMFF "Enable BMFF support.
If libexiv2 has been built with BMFF support included it can be enabled
by calling enableBMFF(True).
If libexiv2 has been built with BMFF support it is already enabled
and this fubction does nothing.
:type enable: bool, optional
:param enable: Set to True to enable BMFF file access.
:rtype: bool
:return: True if libexiv2 has been built with BMFF support.";
%inline %{
static bool enableBMFF(bool enable) {
// deprecated since 2024-08-01
PyErr_WarnEx(PyExc_DeprecationWarning,
"BMFF is already enabled if libexiv2 was built with BMFF support",
1);
#ifdef EXV_ENABLE_BMFF
return Exiv2::enableBMFF(enable);
return true;
#else
return false;
#endif // EXV_ENABLE_BMFF
Expand Down
6 changes: 6 additions & 0 deletions src/interface/preview.i
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ For Exif thumbnail images see the :py:class:`ExifThumb` class.";
%include "shared/preamble.i"
%include "shared/buffers.i"
%include "shared/exception.i"
%include "shared/exv_options.i"
%include "shared/keep_reference.i"
%include "shared/struct_dict.i"
%include "shared/windows_path.i"
Expand All @@ -41,6 +42,11 @@ For Exif thumbnail images see the :py:class:`ExifThumb` class.";
// Catch all C++ exceptions
EXCEPTION()

%fragment("EXV_USE_CURL");
%fragment("EXV_USE_SSH");
%fragment("EXV_ENABLE_FILESYSTEM");
EXV_ENABLE_FILESYSTEM_FUNCTION(Exiv2::PreviewImage::writeFile)

// Some calls don't raise exceptions
%noexception Exiv2::PreviewImage::__len__;
%noexception Exiv2::PreviewImage::extension;
Expand Down
Loading

0 comments on commit 829065a

Please sign in to comment.