File python-ctypesgen.spec of Package python-ctypesgen

#
# spec file for package python-ctypesgen
#
# Copyright (c) 2014 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 http://bugs.opensuse.org/
#


Name:           python-ctypesgen
Version:        0.0+r151
Release:        0
Summary:        Pure Python Wrapper Generator for ctypes
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            http://code.google.com/p/ctypesgen/
# svn export http://ctypesgen.googlecode.com/svn/trunk/ %%{name}-%%{version}
Source:         %{name}-%{version}.tar.xz
BuildRequires:  fdupes
BuildRequires:  python-devel >= 2.3
Obsoletes:      ctypesgen < %{version}
Provides:       ctypesgen = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1110
BuildRequires:  help2man
%endif
%if 0%{?suse_version} > 1110
BuildArch:      noarch
%endif

%description
This project automatically generates ctypes wrappers for header files written in C.

%prep
%setup -q

%build
python ./setup.py build
%if 0%{?suse_version} > 1110
# generate a man page
help2man ./ctypesgen.py \
	--name="Automatically generate ctypes wrappers for hearder files written in C" \
	--version-string %{version} \
	--no-info \
	-o ctypesgen.py.1
%endif

%install
python ./setup.py install \
	--skip-build \
	--prefix="%{_prefix}" \
	--root=%{buildroot} \
	--optimize=2
# fix executale bits
for i in $(grep -Rl %{_bindir}/env %{buildroot}%{python_sitelib}); do
    chmod +x "${i}"
done
%if 0%{?suse_version} > 1110
# install man page
install -p -D -m0644 ctypesgen.py.1 %{buildroot}%{_mandir}/man1/ctypesgen.py.1
%endif
%fdupes %{buildroot}/%{_prefix}

%check
#pushd test
#python testsuite.py
#popd

%files
%defattr(-,root,root)
%doc LICENSE README todo.txt demo/
%{_bindir}/ctypesgen.py
%{python_sitelib}/*egg-info
%{python_sitelib}/ctypesgencore
%if 0%{?suse_version} > 1110
%{_mandir}/man1/ctypesgen.py.1*
%endif

%changelog
openSUSE Build Service is sponsored by