Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif

%global pypi_name autopep8
%global py3_name python3-%{pypi_name}

Name:           python-autopep8
Version:        1.2.4
Release:        1%{?dist}
Summary:        The package autopep8 formats Python code based on the output of the pep8 utility

License:        MIT
URL:            http://pypi.python.org/pypi/autopep8
Source0:        https://files.pythonhosted.org/packages/source/a/%{pypi_name}/%{pypi_name}-%{version}.tar.gz

BuildArch:      noarch

%description
autopep8 formats Python code based on the output of the pep8 utility.

%package -n python2-%{pypi_name}
Summary:        The package autopep8 formats Python code based on the output of the pep8 utility

BuildRequires:  python2-devel
BuildRequires:  python-pep8
Requires:       python-pep8
%{?python_provide:%python_provide python2-%{pypi_name}}

%description -n python2-%{pypi_name}
autopep8 formats Python code based on the output of the pep8 utility.



%if 0%{?with_python3}
%package -n %{py3_name}
Summary:        The package autopep8 formats Python code based on the output of the pep8 utility

%{?python_provide:%python_provide python3-%{pypi_name}}
BuildRequires:  python3-devel
BuildRequires:  python3-pep8
Requires:       python3-pep8

%description -n %{py3_name}
autopep8 formats Python code based on the output of the pep8 utility.
%endif


%prep
%autosetup -n autopep8-%{version}
sed -i -e '1d' autopep8.py
touch test/__init__.py #test needs to be a python module otherwise test will fial


%build
%py2_build

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


%check
# rpmbuild forces the use of LANG=C which fails unit tests
%if 0%{?fedora} || 0%{?rhel} > 6
LANG=en_US.utf8 %{__python2} setup.py test
%endif

%if 0%{?with_python3}
LANG=en_US.utf8 %{__python3} setup.py test
%endif


%install
%if 0%{?with_python3}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
mv %{buildroot}%{_bindir}/%{pypi_name} %{buildroot}%{_bindir}/%{py3_name}
pushd %{buildroot}%{_bindir}
ln -s %{py3_name} %{pypi_name}-3
ln -s %{py3_name} %{pypi_name}-%{python3_version}
popd
%endif

%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
pushd %{buildroot}%{_bindir}
ln -s %{pypi_name} %{pypi_name}-2
ln -s %{pypi_name} %{pypi_name}-%{python2_version}
popd


%files -n python2-%{pypi_name}
%doc README.rst
%license LICENSE
%{python2_sitelib}/*
%{_bindir}/%{pypi_name}
%{_bindir}/%{pypi_name}-2
%{_bindir}/%{pypi_name}-%{python2_version}

%if 0%{?with_python3}
%files -n %{py3_name}
%license LICENSE
%doc README.rst
%{python3_sitelib}/*
%{_bindir}/%{py3_name}
%{_bindir}/%{pypi_name}-3
%{_bindir}/%{pypi_name}-%{python3_version}
%endif



%changelog
* Tue Nov 01 2016 Matthias Runge <mrunge@redhat.com> - 1.2.4-1
- update to 1.2.4
- update python3 executable name in new style (rhbz#1341315)

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

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

* Wed Jan 27 2016 Robert Kuska <rkuska@redhat.com> - 1.2.1-1
- Update to 1.2.1

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Fri Aug 28 2015 Nikola Dipanov <ndipanov@redhat.com> - 1.2-1
- Update to upstream version 1.2

* Sat Jul 11 2015 Haïkel Guémar <hguemar@fedoraproject.org> - 1.1.1-1
- Upstream 1.1.1
- Use python versioned macros
- Add missing dist in release tag
- Add python3 subpackage

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

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

* Tue Aug 13 2013 Nikola Dipanov <ndipanov@redhat.com> - 0.9.2-1
- Update to upstream version 0.9.2

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Sep 06 2012 Nikola Dipanov <ndipanov@redhat.com> - 0.8-1
- initial build