Blob Blame History Raw
%if 0%{?rhel} && 0%{?rhel} < 8
%bcond_with python3
%else
%bcond_without python3
%endif

%global modname behave

Name:           python-%{modname}
Version:        1.2.5
Release:        17%{?dist}
Summary:        Tools for the behavior-driven development, Python style

License:        BSD
URL:            http://pypi.python.org/pypi/%{modname}
Source0:        https://github.com/behave/behave/archive/v%{version}/%{modname}-%{version}.tar.gz
Patch0:         HTML-Formatter.patch
Patch1:         html_formatter_no_set_codecs.patch
# https://github.com/behave/behave/commit/3b90000922638f56e9de521bc51f1ed46a5203c7
Patch2:         0001-support-ref-link-for-each-step.patch
# https://github.com/behave/behave/commit/d3f7a2ac99c6f7faae331b05f56096eb851d11c9
Patch3:         0002-Add-step-label-to-be-used-in-step-refs-like.patch

BuildArch:      noarch

%global _description \
Behavior-driven development (or BDD) is an agile software development\
technique that encourages collaboration between developers, QA and non-\
technical or business participants in a software project.\
\
%{modname} uses tests written in a natural language style, backed up\
by Python code.

%description %{_description}

%package -n python2-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{modname}}
BuildRequires:  python2-devel
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires:  python-setuptools
BuildRequires:  python-parse
BuildRequires:  python-parse_type
BuildRequires:  python-six
BuildRequires:  python-nose
Requires:       python-setuptools
Requires:       python-parse
Requires:       python-parse_type
Requires:       python-six
%else
BuildRequires:  python2-setuptools
BuildRequires:  python2-parse
BuildRequires:  python2-parse_type
BuildRequires:  python2-six
BuildRequires:  python2-nose
Requires:       python2-setuptools
Requires:       python2-parse
Requires:       python2-parse_type
Requires:       python2-six
%endif
BuildRequires:  python2-mock

%description -n python2-%{modname} %{_description}

Python 2 version.

%if %{with python3}
%package -n python3-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-parse
BuildRequires:  python3-parse_type
BuildRequires:  python3-six
BuildRequires:  python3-mock
BuildRequires:  python3-nose
Requires:       python3-setuptools
Requires:       python3-parse
Requires:       python3-parse_type
Requires:       python3-six

%description -n python3-%{modname} %{_description}

Python 3 version.
%endif

%package doc
Summary:        Documentation for %{name}
BuildRequires:  help2man
BuildRequires:  python-sphinxcontrib-cheeseshop
BuildRequires:  python-sphinx

%description doc %{_description}

This package contains documentation in reST and HTML formats and some
brief feature-examples.

%prep
%autosetup -n %{modname}-%{version} -p1
# Copy reST-files into a seperate dir
mkdir -p reST
cp -a docs/*.rst reST

%build
%py2_build
%if %{with python3}
%py3_build
%endif

# Build the autodocs
make html -C docs
rm -rf build/docs/html/.buildinfo

%install
mkdir -p %{buildroot}%{_mandir}/man1

%py2_install
mv %{buildroot}%{_bindir}/%{modname}{,-%{python2_version}}
ln -s %{modname}-%{python2_version} %{buildroot}%{_bindir}/%{modname}-2
PYTHONPATH=%{buildroot}%{python2_sitelib} help2man \
  --no-info \
  --name="Run a number of feature tests with behave." \
  --output=%{modname}-%{python2_version}.1 \
  %{buildroot}%{_bindir}/%{modname}-%{python2_version}
install -Dpm0644 %{modname}-%{python2_version}.1 %{buildroot}%{_mandir}/man1/
ln -s %{modname}-%{python2_version}.1 %{buildroot}%{_mandir}/man1/%{modname}.1

%if %{with python3}
%py3_install
mv %{buildroot}%{_bindir}/%{modname}{,-%{python3_version}}
ln -s %{modname}-%{python3_version} %{buildroot}%{_bindir}/%{modname}-3
PYTHONPATH=%{buildroot}%{python3_sitelib} help2man \
  --no-info \
  --name="Run a number of feature tests with behave." \
  --output=%{modname}-%{python3_version}.1 \
  %{buildroot}%{_bindir}/%{modname}-%{python3_version}
install -Dpm0644 %{modname}-%{python3_version}.1 %{buildroot}%{_mandir}/man1/
%endif

ln -sf %{modname}-2 %{buildroot}%{_bindir}/%{modname}

%check
nosetests-%{python2_version} -v
%if %{with python3}
nosetests-%{python3_version} -v
%endif

%files -n python2-%{modname}
%license LICENSE
%doc README.rst
%{_bindir}/%{modname}-2
%{_bindir}/%{modname}-%{python2_version}
%{python2_sitelib}/%{modname}-*.egg-info/
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/setuptools_%{modname}.py*
%doc %{_mandir}/man1/%{modname}-%{python2_version}.1*
%doc %{_mandir}/man1/%{modname}.1*

%{_bindir}/%{modname}

%if %{with python3}
%files -n python3-%{modname}
%license LICENSE
%doc README.rst
%doc %{_mandir}/man1/%{modname}-%{python3_version}.1*
%{_bindir}/%{modname}-3
%{_bindir}/%{modname}-%{python3_version}
%{python3_sitelib}/%{modname}-*.egg-info/
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/setuptools_%{modname}.py
%{python3_sitelib}/__pycache__/setuptools_%{modname}.*
%endif

%files doc
%license LICENSE
%doc README.rst build/docs/html reST

%changelog
* Fri Aug 12 2016 Igor Gnatenko <ignatenko@redhat.com> - 1.2.5-17
- Modernize spec
- Backport patch to put label into sphinx before step

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.5-16
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Tue Jul 12 2016 Matěj Cepl <mcepl@redhat.com> - 1.2.5-15
- Recover the build on RHEL-7 again.

* Wed Jun 22 2016 Matěj Cepl <mcepl@redhat.com> - 1.2.5-14
- Add a symlink /usr/bin/behave unconditionally (fix #1348872)

* Fri Jun 03 2016 Igor Gnatenko <ignatenko@redhat.com> - 1.2.5-13
- Update packaging to be compliant with new guidelines
- Fix building manpage
- Really run tests for python3
- Proper handling for binaries

* Wed Mar 23 2016 Matěj Cepl <mcepl@redhat.com> - 1.2.5-12
- it works a way better when the symlink actually points to somewhere.

* Wed Mar 23 2016 Matěj Cepl <mcepl@redhat.com> - 1.2.5-11
- /usr/bin/behave belongs to python2 package still (#1319632)

* Fri Mar 04 2016 Miro Hrončok <mhroncok@redhat.com> - 1.2.5-10
- Move python3 requires to python3 subpackage (#1314741)

* Mon Feb 29 2016 Matěj Cepl <mcepl@redhat.com> - 1.2.5-9
- RHEL-7 doesn't have py3k toolchain.

* Mon Feb 29 2016 Matěj Cepl <mcepl@redhat.com> - 1.2.5-8
- Fix wrong %%if conditions.

* Thu Feb 25 2016 Miro Hrončok <mhroncok@redhat.com> - 1.2.5-7
- Make Python 3 the default version for the binary and provide a binary for 2 as well

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sun Nov 15 2015 Björn Esser <besser82@fedoraproject.org> - 1.2.5-5
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Tue Nov 03 2015 Matěj Cepl <mcepl@redhat.com> - 1.2.5-3
- Build also python3 packages (fix #1276923).

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Thu May 21 2015 Matej Cepl <mcepl@redhat.com> - 1.2.5-2
- Add a patch for embeding video in HTML formatted report

* Wed Apr 29 2015 Matej Cepl <mcepl@redhat.com> - 1.2.5-1
- Upgrade to the latest release (fix #1214767)

* Fri Sep 12 2014 Matěj Cepl <mcepl@redhat.com> - 1.2.4-4
- Add another patch to fix an Unicode error (thanks for vbenes for
  fixing my earlier proposal).

* Thu Jul 17 2014 Matěj Cepl <mcepl@redhat.com> - 1.2.4-2
- Build documentation even on EPEL-7.

* Thu Jun 19 2014 Matěj Cepl <mcepl@redhat.com> - 1.2.4-1
- New upstream release

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.3-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri May 09 2014 Matěj Cepl <mcepl@redhat.com> - 1.2.3-13
- Remove bundled compatibility libraries and add Requires
  (fix #1096220).

* Mon Apr 07 2014 Matěj Cepl <mcepl@redhat.com> - 1.2.3-12
- Add python-setuptools dependency (fix #1084996)

* Wed Mar 19 2014 Matěj Cepl <mcepl@redhat.com> - 1.2.3-11
- Another fix for RHBZ# 1067388 by Vadim Rutkovsky

* Wed Mar 12 2014 Matěj Cepl <mcepl@redhat.com> - 1.2.3-10
- Fix Patch 1

* Wed Mar 12 2014 Matěj Cepl <mcepl@redhat.com> - 1.2.3-9
- Add two patches provided by Vadim Rutkovsky (fix #1058371 and
  #1067388)

* Tue Oct 29 2013 Matěj Cepl <mcepl@redhat.com> - 1.2.3-8
- Add Vadim Rutkovsky’s HTML Formatter patch (fix #1024023)

* Wed Oct 23 2013 Matěj Cepl <mcepl@redhat.com> - 1.2.3-7
- Make generating of docs conditional again.

* Wed Oct 23 2013 Björn Esser <bjoern.esser@gmail.com> - 1.2.3-6
- fixed all remaining issues as mentioned in rhbz# 987622 c# 16
- added needed conditionals for building on el6.

* Tue Oct 22 2013 Matěj Cepl <mcepl@redhat.com> - 1.2.3-5
- Generate sphinx documentation

* Tue Oct 22 2013 Matěj Cepl <mcepl@redhat.com> - 1.2.3-4
- Fix spelling to en_US (apparently reviewer doesn't understand proper
  English ;))
- Add specific python2 marcros
- Fix files in _bindir to refer to python2 explicitly.
- Run testsuite

* Mon Oct 21 2013 Matěj Cepl <mcepl@redhat.com> - 1.2.3-3
- Update generation of manpage from --help output.

* Sun Jul 28 2013 Matěj Cepl <mcepl@redhat.com> - 1.2.3-2
- Fix changelog
- Give up on Python3 module ATM
  (https://bugzilla.redhat.com/show_bug.cgi?id=987622#c2 and
  https://github.com/behave/behave/issues/119)
- noarch package doesn't need CFLAGS set

* Tue Jul 23 2013 Matěj Cepl <mcepl@redhat.com> - 1.2.3-1
- initial package for Fedora