File python-CXX.spec of Package python-CXX

# spec file for package python-CXX
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# 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

%define modname CXX
%define tarname pycxx
Name:           python-CXX
Version:        6.2.5
Release:        0
Summary:        Write Python extensions in C++
License:        BSD-3-Clause
Group:          Development/Languages/Python
Source0:        %{tarname}-%{version}.tar.gz
Source1:        %{name}-rpmlintrc
Patch0:         python-CXX-6.2.3-change-include-paths.patch
# PATCH-FIX-UPSTREAM python-CXX-6.2.5-fix-version.patch -- fix version number from 6.24 to 6.25, needs to be updated for new releases
Patch1:         python-CXX-6.2.5-fix-version.patch
BuildRequires:  python-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       python-cxx = %{version}
Obsoletes:      python-cxx < %{version}
%if 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
BuildArch:      noarch

PyCXX is a set of classes to help create extensions of Python in the C
language. The first part encapsulates the Python C API taking care of
exceptions and ref counting. The second part supports the building of Python
extension modules in C++.

%package devel
Summary:        Development files for %{name}
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
%if 0%{?suse_version} > 1110
%py_requires -d
Provides:       python-cxx-devel = %{version}
Obsoletes:      python-cxx-devel < %{version}

%description devel
Header files and documentation for %{name} development.

%setup -q -n %{tarname}-%{version}
%patch0 -p1
%patch1 -p1

python build

python install --root=%{buildroot} --prefix=%{_prefix}
install %{modname}/*.hxx %{buildroot}/%{_includedir}/python%{py_ver}/%{modname}
install %{modname}/*.h %{buildroot}/%{_includedir}/python%{py_ver}/%{modname}/
cp -R %{modname}/Python2 %{buildroot}/%{_includedir}/python%{py_ver}/%{modname}/
install Src/*.c %{buildroot}/%{_datadir}/python%{py_ver}/%{modname}/
install Src/*.cxx %{buildroot}/%{_datadir}/python%{py_ver}/%{modname}/
cp -R Src/Python2 %{buildroot}/%{_datadir}/python%{py_ver}/%{modname}/
chmod -x %{buildroot}/%{_datadir}/python%{py_ver}/%{modname}/*.*
chmod -x %{buildroot}/%{_includedir}/python%{py_ver}/%{modname}/*.*


%files devel
%doc Doc/Python2/
%dir %{_datadir}/python%{py_ver}/