File python-opencc.spec of Package python-opencc

#
# spec file for package python-opencc
#
# 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/
#
Name:           python-opencc
Version:        1.1.5
Release:        0
Summary:        Open Chinese Convert 開放中文轉換
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License:        Apache-2.0
URL:            https://github.com/BYVoid/OpenCC
Source:         _service
Source1:        FindOpenCC.cmake
Patch0:         CMakeLists-python.patch
Patch1:         cpython-link.patch
Patch2:         fixpythonbuild.patch
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  fdupes
BuildRequires:  cmake-full 
BuildRequires:  opencc-devel
BuildRequires:  cmake(pybind11) 
BuildRequires:  gcc-c++ 
BuildRequires:  %{python_module pybind11-devel}
%python_subpackages

%description
Conversion between Traditional and Simplified Chinese


%prep
%setup -q -n %_sourcedir/%name-%version -T -D
%__mkdir -p %_builddir/%_sourcedir
%__ln -rs %_sourcedir/%name-%version %_builddir/%_sourcedir

%__mkdir ./cmake
%__cp %{SOURCE1} ./cmake
%patch 0
%patch 1
%patch 2

%build
%{python_expand pushd .
%define __builddir %{_os}-%{_arch}-cpython-%{$python_version_nodots}
%cmake  -DBUILD_DOCUMENTATION:BOOL=OFF -DBUILD_PYTHON:BOOL=ON \
        -DUSE_SYSTEM_PYBIND11:BOOL=ON -DUSE_SYSTEM_RAPIDJSON:BOOL=ON \
        -DPYTHON_EXECUTABLE:FILEPATH=%{_bindir}/$python
%cmake_build
popd
mkdir -p python/opencc/clib
ln -s %{__builddir}/opencc_clib.cpython-%{$python_version_nodots}-%{_arch}-*.so python/opencc/clib
}
%pyproject_wheel
%install
%pyproject_install
%__mv %{buildroot}%{_libdir} %{buildroot}%{_usr}/lib
%{python_expand #
  %__rm -rf  %{buildroot}%{$python_sitelib}/opencc/clib
  %__mkdir -p  %{buildroot}%{$python_sitelib}/opencc/clib/share
  %__cp  python/opencc/__init__.py %{buildroot}%{$python_sitelib}/opencc
  %__cp -rf  python/tests/ %{buildroot}%{$python_sitelib}/opencc
  ln -s %{_datadir}/opencc %{buildroot}%{$python_sitelib}/opencc/clib/share/
  %__install -Dm 0644 %{__builddir}/opencc_clib.cpython-%{$python_version_nodots}-%{_arch}-*.so %{buildroot}%{$python_sitelib}/opencc/clib/
}
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%post
%postun


%files %{python_files}
%{python_sitelib}/*
%doc NEWS.md README.md AUTHORS





%changelog
呃呃
openSUSE Build Service is sponsored by