File python-efl.spec of Package python-efl

# spec file for package python-efl
# Copyright (c) 2024 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

%{?!python_module:%define python_module() python3-%{**}}

%if 0%{?suse_version} > 1599
%define build_doc 1
%define build_doc 0

Name:           python-efl
Version:        1.26.1
Release:        0
Summary:        Python bindings of evas
License:        GPL-3.0-only AND LGPL-3.0-only
Group:          Development/Libraries/Python
Patch0:         cython3.patch
%if 0%{?suse_version} > 1599
BuildRequires:  %{python_module Cython3}
BuildRequires:  %{python_module Cython}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  dbus-1-python3-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(ecore)
BuildRequires:  pkgconfig(edje)
BuildRequires:  pkgconfig(elementary)
BuildRequires:  pkgconfig(emotion)
BuildRequires:  pkgconfig(eo)
BuildRequires:  pkgconfig(evas)
# cc1 uses too much memory on x86
#ExcludeArch:    %ix86
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
# pre-unification mess
%if "%{python_flavor}" == "python2"
Obsoletes:      python-evas < %{version}
Provides:       python-evas = %{version}
Obsoletes:      python-ecore < %{version}
Provides:       python-ecore = %{version}
Obsoletes:      python-edje < %{version}
Provides:       python-edje = %{version}
Obsoletes:      python-emotion < %{version}
Provides:       python-emotion = %{version}
Obsoletes:      python-e_dbus < %{version}
Provides:       python-e_dbus = %{version}
Obsoletes:      python-elementary < %{version}
Provides:       python-elementary = %{version}

%if 0%{?suse_version}

%package -n python3-efl
Summary:        Python bindings of evas
Group:          Development/Languages/Python

%description -n python3-efl
Python bindings of the Enlightenment Foundation Libraries (efl).

Python bindings of the Enlightenment Foundation Libraries (efl).

%if 0%{?suse_version}
%if %{build_doc}
%package -n python-efl-doc
Summary:        Documentation for python-efl
Group:          Documentation/HTML
BuildRequires:  %{python_module Sphinx}
Provides:       python3-efl-doc
Conflicts:      otherproviders(python3-efl-doc)

%description -n python-efl-doc
HTML formated documentation for python-efl module.

%package -n python-efl-examples
Summary:        Examples of python-efl usage
Group:          Documentation/Other
Provides:       python3-efl-examples
Conflicts:      otherproviders(python3-efl-examples)

%description -n python-efl-examples
Some examples of usage of python-efl.

%setup -q
%if 0%{?suse_version} > 1599
%patch -P 0 -p1
# drop build date from doc to fix build-compare
sed -i "s/\(html_last_updated_fmt = \).*/\\1None/" ./doc/

export CFLAGS="$CFLAGS -Wno-declaration-after-statement"
%ifarch %ix86
export CFLAGS="$CFLAGS -O0"
%if 0%{?suse_version}
%{python_expand $python build -g}
%if %{build_doc}
python3 -m doc build/sphinx/html


# module itself

# documentation
%if 0%{?suse_version}
%if %{build_doc}
for _name in python-efl python3-efl; do
  install -m 0755 -d "%{buildroot}/%{_docdir}/$_name"
  cp -R build/sphinx/html "%{buildroot}/%{_docdir}/$_name"
  rm -r "%{buildroot}/%{_docdir}/$_name"/html/.{buildinfo,doctrees}

%python_expand %fdupes %{buildroot}%{_docdir}
%python_expand %fdupes %{buildroot}%{$python_sitearch}

# examples
for _name in python-efl python3-efl; do
  install -m 0755 -d "%{buildroot}/%{_datadir}/$_name"
  cp -R examples/  "%{buildroot}/%{_datadir}/$_name/"
  mkdir -p %{buildroot}/%{_docdir}/$_name
# Remove examples installed under python-efl namespace
rm -r "%{buildroot}/%{_datadir}/%{name}/examples"
rm -r "%{buildroot}/%{_docdir}/%{name}/"

%if 0%{?suse_version}
%files %{python_files}
%exclude %{_docdir}/python3-efl/html/

%if %{build_doc}
%files -n python-efl-doc

%files -n python-efl-examples

%if !0%{?suse_version}
%files -n python-efl

%files -n python3-efl

openSUSE Build Service is sponsored by