File mcomix.spec of Package mcomix

#
# spec file for package mcomix
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?sle15_python_module_pythons}

%if 0%{?suse_version} > 1500
%define pythons python3
%endif

Name:           mcomix
Version:        3.1.0
Release:        0
Summary:        Comics Viewer
License:        GPL-2.0-only
Group:          Productivity/Graphics/Viewers
URL:            https://sourceforge.net/p/mcomix/wiki/Home/
Source0:        https://sourceforge.net/projects/mcomix/files/MComix-%{version}/%{name}-%{version}.tar.gz
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module wheel}
BuildRequires:  gobject-introspection
%if 0%{?suse_version} > 1500
Requires:       python3-PyMuPDF
%endif
%if 0%{?sle_version} >= 0150400
Requires:       mupdf
%endif
Requires:       %{pythons}-Pillow
Requires:       %{pythons}-gobject-Gdk
Requires:       %{pythons}-pycairo
Requires:       /usr/bin/7z
Requires:       /usr/bin/chardetect
Requires:       typelib-1_0-Gtk-3_0
Recommends:     /usr/bin/lha
Recommends:     unrar
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  fdupes
%endif

%description
Comics Viewer forked from comix.

%prep
%setup -q
# remove extra executable flags
find . -type f | xargs chmod a-x

%build
%pyproject_wheel

%install
%pyproject_install
{
	echo '%defattr(-,root,root,-)'
	%{python_expand ls %{buildroot}%{$python_sitelib}/mcomix/messages/*/LC_MESSAGES/mcomix.mo | \
	sed 's@%{buildroot}\(%{$python_sitelib}/mcomix/messages/\([^/]\+\)/LC_MESSAGES/mcomix.mo\)@%lang(\2) \1@' }
} | tee %{name}.lang
install -Dm 644 share/applications/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
for a in share/icons/hicolor/* ; do
    install -Dm 644 -t %{buildroot}%{_datadir}/icons/hicolor/${a##*/}/apps $a/apps/*
    [[ -d $a/mimetypes ]] && install -Dm 644 -t %{buildroot}%{_datadir}/icons/hicolor/${a##*/}/mimetypes $a/mimetypes/*
done
install -Dm 644 share/mime/packages/%{name}.xml %{buildroot}%{_datadir}/mime/packages/%{name}.xml
install -Dm 644 share/metainfo/%{name}.metainfo.xml %{buildroot}%{_datadir}/metainfo/%{name}.metainfo.xml
install -Dm 644 share/man/man1/%{name}.1.gz -t %{buildroot}%{_datadir}/man/man1

%if 0%{?suse_version}
%fdupes -s %{buildroot}%{_datadir}/icons
%python_expand %fdupes -s %{buildroot}%{$python_sitelib}/mcomix
%python_expand %fdupes -s %{buildroot}%{$python_sitelib}/mcomix-*
%endif

%files -n %{name} -f %{name}.lang
%attr(755,root,root) %{_bindir}/mcomix
%{python_sitelib}/mcomix-*
%dir %{python_sitelib}/mcomix/
%{python_sitelib}/mcomix/*.py*
%{python_sitelib}/mcomix/library/
%{python_sitelib}/mcomix/images/
%{python_sitelib}/mcomix/messages/
%{python_sitelib}/mcomix/archive/
%{python_sitelib}/mcomix/__pycache__/
%{python_sitelib}/mcomix/_vendor/
%{_datadir}/metainfo/*
%{_datadir}/applications/mcomix.desktop
%{_datadir}/icons/hicolor
%{_datadir}/mime/packages/mcomix.xml
%{_mandir}/man1/mcomix*

%changelog
* Wed Nov 22 2023 Giacomo Comes <gcomes.obs@gmail.com>
- fixed typo: Requires: /usr/bin/chardet -> Requires: /usr/bin/chardetect
* Wed Nov  1 2023 Giacomo Comes <gcomes.obs@gmail.com>
- replace Requires: python3-chardet with Requires: /usr/bin/chardet
- use %%{python_module} macro for BuildRequires: of python modules
- use %%{pythons} macro for Requires: of python modules
- cleanup in the %%files section
* Wed Oct 11 2023 Giacomo Comes <gcomes.obs@gmail.com>
- replace Requires: PyGObject with Requires: python3-gobject-Gdk
- replace Requires: chardet with Requires: python3-chardet
- since version 2.2.0 mcomix needs puthon 3.7, use the macro
  sle15_python_module_pythons to build mcomix on Leap using
  a modern version of python
* Wed Oct  4 2023 Sergio Laverde <sergiolaverde0@gmail.com>
- update to 2.3.0:
  * MComix now offers a high-resolution application icon.
  * Restored Python 3.7 compatibility in native PDF extractor.
- changes introduced in 2.2.1:
  * Added missing vendor package to source distribution.
- changes introduced in 2.2.0:
  * Fixed incorrect PDF transformations on systems using a recent
  version of MuPDF.
  * Fixed incompatibility with Pillow 10.0.0 due to bug in version check.
  * MComix can now use the PyMuPDF Python package to provide PDF reading
  capabilities, with improved extraction/decoding speed.
  * Added support for MobiPocket (AZW3) format books. Archives with DRM
  are not supported.
  * The OSD now shows the current page and the total number of pages.
  * The tabs of the Preferences dialog are scrollable so all dialog tabs
  can be properly used on smaller screens.
  * Updated the simplified Chinese translation.
* Mon May 29 2023 Dirk Müller <dmueller@suse.com>
- update to 2.1.1:
  * Improved quality and speed of the magnifying lens.
  * Added new de facto IEC prefixes.
  * Window size should be remembered correctly again when
    restarting the application.
  * Replaced usage of deprecated GTK threading/timer
    functionality.
  * Fixed GLib application name. This improves integration
    with Gnome.
* Mon Dec 26 2022 Andrea Manzini <andrea.manzini@suse.com>
- fix wrong attributes in original archived source
* Sat Dec 24 2022 Andrea Manzini <andrea.manzini@suse.com>
- Update to 2.1.0:
  * Fixed byte/unicode error in library search text field.
  * Fixed DPI detection for PDFs which cannot be decoded using UTF-8.
  * Fixed magnifying lens errors when image was rotated
* Tue Jun 28 2022 Giacomo Comes <gcomes.obs@gmail.com>
- add Requires: typelib-1_0-Gtk-3_0
  * fix boo#1200948
* Thu Jun  2 2022 Giacomo Comes <gcomes.obs@gmail.com>
- spec file cleanup
- add BuildRequires: gobject-introspection
- replace Requires: python3-gobject with Requires: python3-gobject-Gdk
* Mon May 30 2022 Giacomo Comes <gcomes.obs@gmail.com>
- Update to 2.0.2:
  * Fixed bytes/unicode error in library 'Add collection' dialog.
  * Fixed missing localization and image resources after calling
    "setup.py install"
  * Fixed bytes/unicode error in unrar executable extraction handler.
  * Fixed one more instance of incorrect color conversion from preferences.
- Update to 2.0.1:
  * Fixed conversion of unexpected color values from stored preferences.
  * Fixed error trying to display page file size within archives where
    members have not been extracted yet.
  * Fixed bytes/unicode error in the library 'Add Book' dialog.
  * Fixed endless password popup when library fails to genrate thumbnail
    for password-protected archive.
  * Handle error when thumbnail metadata Thumb::MTime is a floating point
    number.
  * Fixed alphanumeric sort for names with mismatched text/number patterns.
  * Fixed unicode/bytes error in "Save as" dialog, as well as errors
    when saving double-page images.
- Update to 2.0.0:
  * MComix now requires Python 3, GTK+ 3, PyGObject, and PyCairo.
  * Animated image formats are now supported.
  * Supported image formats are now a combination of formats supported by
    GDK/Pixbuf and Pillow formats.
* Sun Jul 16 2017 sleep_walker@opensuse.org
- clean the spec with spec-cleaner
* Wed Aug  3 2016 sleep_walker@opensuse.org
- bump to 1.2.1
  for list of changes check ChangeLog file
* Tue Nov 10 2015 tiwai@suse.de
- Add missing dependency on python-setuptools
* Mon Nov  2 2015 sleep_walker@opensuse.org
- localization was not part of package - fix it
* Mon Nov  2 2015 sleep_walker@opensuse.org
- bump to 1.01
  - Keyboard shortcuts can now be edited from MComix' preference dialog
    in a new tab "Shortcuts". (by Valentin Gologuzov)
    Please not that the arrow keys, Backspace and Escape cannot be bound
    to actions right now, unless you're manually editing the config file.
  - During database upgrade, MComix did not consider that books in the
    "Last read" database might no longer exist, leading to program crash.
    This has been fixed.
  - Adding a collection with a numeric name to the library made the library
    unusable. This has been fixed.
  - Fixed win32 builds missing the 'calendar' module.
  - Fixed bookmarks not being displayed in the Ubuntu Unity global menu.
  - Fixed 'Continue reading' not working when files are opened from
    the command line (by Boris Bogar).
  - Improved page extraction and caching algorithm, leading to much better
    responsiveness, especially for viewing large archives. (by Benoit Pierre)
  - MComix will now always hide the mouse cursor after a period of
    inactivity, even when not in fullscreen mode. (by Benoit Pierre)
  - The ALT+Left and ALT+Right keys will now either advance one page,
    or go back one page, depending on the user being in manga mode.
  - CTRL plus mouse wheel will now zoom in/out one level.
  - Manual zooming will now use a logarithmic scale instead of a linear
    spline.
  - The library will now use natural sorting for "Sort by name" and
    "Sort by path" instead of alphanumeric sorting, bringing it in line
    with most other sorting done by MComix.
  - Adding a book to a collection with the same book already existing
    in another collection did not immediately show the book in the
    library main view when the new collection was already selected.
  - MComix can now use the '7z' executable to read .tar.xz and .tar.lzma
    archives.
  - ZIP archives using BZIP2 compression will now fall back to external
    unzip/7z instead of failing (by Awad Mackie).
  - MComix can now read PDF files using tools provided by mupdf,
    namely mutool and mudraw. (by Benoit Pierre)
  - MComix will now use the current GTK theme's icons for
    Next/Previous buttons.
  - Added AppData meta information for software repositories.
  - Updated traditional Chinese translation (by Wayne Su).
* Thu Jul 24 2014 sleep_walker@suse.cz
- remove windows-fix.patch as it is not needed after update of
  python-setuptools
* Thu Jul 24 2014 sleep_walker@suse.cz
- let there be mcomix!
- add windows-fix.patch as python-setuptools doesn't take it correctly
  otherwise
openSUSE Build Service is sponsored by