File python-hachoir.spec of Package python-hachoir

#
# spec file for package python-wakeonlan
#
# Copyright (c) 2017 SUSE LINUX 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/


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define         skip_python2 1
%define         skip_python36 1
Name:           python-hachoir
Version:        0.2.0
Release:        0
License:        GPLv2+
Summary:        Hachoir is a Python library to view and edit a binary stream field by field
Group:          Development/Languages/Python
Url:            https://github.com/vstinner/hachoir
Source:         hachoir-%{version}.tar.xz
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires(post): update-alternatives
Requires(postun): update-alternatives

BuildArch:      noarch
%python_subpackages

%description
Hachoir is a Python library to view and edit a binary stream field by field. In other words, Hachoir allows you to "browse" any binary stream just like you browse directories and files.

A file is splitted in a tree of fields, where the smallest field is just one bit. Examples of fields types: integers, strings, bits, padding types, floats, etc. Hachoir is the French word for a meat grinder (meat mincer), which is used by butchers to divide meat into long tubes; Hachoir is used by computer butchers to divide binary files into fields.

%prep
%setup -q -n hachoir-%version

%build
export CFLAGS="%{optflags}"
%python_build

%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/hachoir-grep
%python_clone -a %{buildroot}%{_bindir}/hachoir-metadata
%python_clone -a %{buildroot}%{_bindir}/hachoir-strip
%python_clone -a %{buildroot}%{_bindir}/hachoir-urwid
%python_clone -a %{buildroot}%{_bindir}/hachoir-wx

%post
%python_install_alternative hachoir-grep
%python_install_alternative hachoir-metadata
%python_install_alternative hachoir-strip
%python_install_alternative hachoir-urwid
%python_install_alternative hachoir-wx

%postun
%python_uninstall_alternative hachoir-grep
%python_uninstall_alternative hachoir-metadata
%python_uninstall_alternative hachoir-strip
%python_uninstall_alternative hachoir-urwid
%python_uninstall_alternative hachoir-wx

%files %{python_files}
%license COPYING
%doc README.rst TODO.rst
%python_alternative %_bindir/hachoir-grep
%python_alternative %_bindir/hachoir-metadata
%python_alternative %_bindir/hachoir-strip
%python_alternative %_bindir/hachoir-urwid
%python_alternative %_bindir/hachoir-wx
%{python_sitelib}/*

openSUSE Build Service is sponsored by