From dee6ebf8081afa1b285d1f2d162657d554d42be6325c486d7cae64c5d69ed46c Mon Sep 17 00:00:00 2001 From: Todd R Date: Thu, 26 Oct 2017 02:48:00 +0000 Subject: [PATCH] Accepting request 535524 from home:TheBlackCat:branches:devel:languages:python - Implement single-spec version OBS-URL: https://build.opensuse.org/request/show/535524 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bitstring?expand=0&rev=8 --- python-bitstring.changes | 5 ++++ python-bitstring.spec | 53 ++++++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/python-bitstring.changes b/python-bitstring.changes index 87bdca7..67eeb42 100644 --- a/python-bitstring.changes +++ b/python-bitstring.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Oct 18 16:42:21 UTC 2017 - toddrme2178@gmail.com + +- Implement single-spec version + ------------------------------------------------------------------- Sun Jul 31 15:18:28 UTC 2016 - mardnh@gmx.de diff --git a/python-bitstring.spec b/python-bitstring.spec index 3ca1d43..fff22a2 100644 --- a/python-bitstring.spec +++ b/python-bitstring.spec @@ -1,7 +1,7 @@ # # spec file for package python-bitstring # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# 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 @@ -16,28 +16,34 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +# Test files missing +%bcond_with test Name: python-bitstring Version: 3.1.5 Release: 0 -Url: http://python-bitstring.googlecode.com Summary: Simple construction, analysis and modification of binary data License: MIT -Group: Development/Libraries/Python +Group: Development/Languages/Python +Url: https://github.com/scott-griffiths/bitstring Source: https://files.pythonhosted.org/packages/source/b/bitstring/bitstring-%{version}.zip -BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: python-devel +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros BuildRequires: unzip -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else -BuildArch: noarch +%if %{with test} +BuildRequires: %{python_module pytest} %endif +BuildArch: noarch + +%python_subpackages %description -bitstring is a pure Python module designed to help make +Bitstring is a pure Python module designed to help make the creation and analysis of binary data as simple and natural as possible. -BitStrings can be constructed from integers (big and little endian), hex, +Bitstrings can be constructed from integers (big and little endian), hex, octal, binary, strings or files. They can be sliced, joined, reversed, inserted into, overwritten, etc. with simple functions or slice notation. They can also be read from, searched and replaced, and navigated in, @@ -45,21 +51,26 @@ similar to a file or stream. %prep %setup -q -n bitstring-%{version} -# For rpmlint warning: remove shebang from python library: -sed -i '/^#!/d' bitstring.py - -# Fix wrong EOL encoding: -sed -i 's/\r$//' README.rst release_notes.txt +sed -i 's/\r$//' README.rst +sed -i '1{\@^#!/usr/bin/env python@d}' bitstring.py %build -python setup.py build +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} -%files -%defattr(-,root,root) -%doc LICENSE README.rst release_notes.txt doc/* +%if %{with test} +%check +%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib} +py.test-%{$python_bin_suffix} +} +%endif + +%files %{python_files} +%defattr(-,root,root,-) +%doc LICENSE README.rst %{python_sitelib}/* %changelog