Blob Blame History Raw
%global pypi_name bashate

%if 0%{?fedora}
%global with_python3 1
%endif

Name:           python-%{pypi_name}
Version:        0.5.1
Release:        9%{?dist}
Summary:        A pep8 equivalent for bash scripts

License:        ASL 2.0
URL:            https://pypi.python.org/pypi/bashate
Source0:        https://pypi.io/packages/source/b/%{pypi_name}/%{pypi_name}-%{version}.tar.gz

# not yet released upstream fix for Python >= 3.6
# https://review.openstack.org/496054
Patch0001: 0001-Don-t-mock-sysv.args.patch

BuildArch:      noarch

%description
It is a pep8 equivalent for bash scripts.
This program attempts to be an automated style checker for bash scripts
to fill the same part of code review that pep8 does in most OpenStack
projects. It started from humble beginnings in the DevStack project,
and will continue to evolve over time.

%package -n python2-%{pypi_name}
Summary:        A pep8 equivalent for bash scripts
%{?python_provide:%python_provide python2-%{pypi_name}}

BuildRequires:  python2-devel
BuildRequires:  python2-pbr
BuildRequires:  python2-fixtures
BuildRequires:  python2-mock

Requires:       python2-setuptools
Requires:       python2-pbr
Requires:       python2-babel

%description -n python2-%{pypi_name}
It is a pep8 equivalent for bash scripts.
This program attempts to be an automated style checker for bash scripts
to fill the same part of code review that pep8 does in most OpenStack
projects. It started from humble beginnings in the DevStack project,
and will continue to evolve over time.

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        A pep8 equivalent for bash scripts
%{?python_provide:%python_provide python3-%{pypi_name}}

BuildRequires:  python3-devel
BuildRequires:  python3-pbr
BuildRequires:  python3-fixtures
BuildRequires:  python3-mock

Requires:       python3-setuptools
Requires:       python3-pbr
Requires:       python3-babel

 
%description -n python3-%{pypi_name}
It is a pep8 equivalent for bash scripts.
This program attempts to be an automated style checker for bash scripts
to fill the same part of code review that pep8 does in most OpenStack
projects. It started from humble beginnings in the DevStack project,
and will continue to evolve over time.
%endif


%package -n python-%{pypi_name}-doc
Summary: Documentation for bashate module

BuildRequires:  python2-sphinx
BuildRequires:  python2-oslo-sphinx
BuildRequires:  python2-reno


%description -n python-%{pypi_name}-doc
Documentation for the bashate module

%prep
%autosetup -S git -n %{pypi_name}-%{version}

# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
rm -rf {test-,}requirements.txt

%build
%py2_build
# doc
export PYTHONPATH="$( pwd ):$PYTHONPATH"
pushd doc
sphinx-build-2 -b html -d build/doctrees   source build/html
popd
rm -fr doc/build/html/.buildinfo

%if 0%{?with_python3}
%py3_build
%endif

%install
%if 0%{?with_python3}
%py3_install
mv %{buildroot}%{_bindir}/%{pypi_name} %{buildroot}%{_bindir}/%{pypi_name}-%{python3_version}
ln -s ./%{pypi_name}-%{python3_version} %{buildroot}%{_bindir}/%{pypi_name}-3
%endif

%py2_install
mv %{buildroot}%{_bindir}/%{pypi_name} %{buildroot}%{_bindir}/%{pypi_name}-%{python2_version}
ln -s ./%{pypi_name}-%{python2_version} %{buildroot}%{_bindir}/%{pypi_name}-2

%if 0%{?with_python3}
ln -s ./%{pypi_name}-3 %{buildroot}%{_bindir}/%{pypi_name}
%else
ln -s ./%{pypi_name}-2 %{buildroot}%{_bindir}/%{pypi_name}
%endif

%check
%{__python2} setup.py test

%if 0%{?with_python3}
%{__python3} setup.py test
%endif

%files -n python2-%{pypi_name}
%doc README.rst
%license LICENSE
%if !0%{?with_python3}
%{_bindir}/%{pypi_name}
%endif
%{_bindir}/%{pypi_name}-2
%{_bindir}/%{pypi_name}-%{python2_version}
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info


%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst
%license LICENSE
%{_bindir}/%{pypi_name}
%{_bindir}/%{pypi_name}-3
%{_bindir}/%{pypi_name}-%{python3_version}
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif

%files -n python-%{pypi_name}-doc
%doc doc/build/html
%license LICENSE

%changelog
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.5.1-8
- Rebuilt for Python 3.7

* Mon Mar 26 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.5.1-7
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.5.1-3
- Rebuild for Python 3.6

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

* Sat Jun 25 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 0.5.1-1
- Upstream 0.5.1
- Fix python3 support (RHBZ#1314529)
- Use pypi.io URL

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

* Sun Nov 22 2015 Chandan Kumar <chkumar246@gmail.com> - 0.3.2-1
- Bumped to version 0.3.2
- Added missing test dependencies

* Wed Sep 30 2015 Chandan Kumar <chkumar246@gmail.com> -0.3.1-2
- Added python2 and python3 subpackage

* Wed Aug 12 2015 chandankumar <chkumar246@gmail.com> - 0.3.1-1
- Initial package.