+# TODO:
+# - include examples in package
+
+# Conditional build:
+%bcond_without python2 # Python 2.x version
+%bcond_without python3 # Python 3.x version (available as 'py3lint')
+
Summary: Python tool that checks if a module satisfy a coding standard
-Summary(pl): Pythonowe narzêdzie sprawdzaj±ce zgodno¶æ modu³u ze standardem kodowania
+Summary(pl.UTF-8): Pythonowe narzędzie sprawdzające zgodność modułu ze standardem kodowania
Name: pylint
-Version: 0.8.1
-Release: 1
-License: GPL
+Version: 1.4.3
+Release: 2
+License: GPL v2+
Group: Development/Languages/Python
-Source0: ftp://ftp.logilab.fr/pub/pylint/%{name}-%{version}.tar.gz
-# Source0-md5: f04addb7496a2a3e26675d36026718d7
-URL: http://www.logilab.org/projects/pylint/view
+#Source0Download: https://pypi.python.org/pypi/pylint
+Source0: https://pypi.python.org/packages/source/p/pylint/pylint-%{version}.tar.gz
+# Source0-md5: 5924c1c7ca5ca23647812f5971d0ea44
+URL: http://www.pylint.org/
+%if %{with python2}
BuildRequires: python-devel
-BuildRequires: python-modules >= 2.2.1
+BuildRequires: python-modules >= 1:2.5
+BuildRequires: python-setuptools >= 7.0
+%endif
+%if %{with python3}
+BuildRequires: python3-2to3
+BuildRequires: python3-devel
+BuildRequires: python3-modules >= 1:3.2
+BuildRequires: python3-setuptools >= 7.0
+%endif
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.219
-%pyrequires_eq python-modules
-Requires: python-logilab-astng >= 0.13.1
+BuildRequires: sphinx-pdg
+Requires: python-astroid >= 1.3.2
+Requires: python-logilab-common >= 0.53.0
+Requires: python-modules
+Requires: python-six
+Suggests: python-devel-src
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# /etc/pylintrc is deliberately packaged to both packages with same name
+%define _duplicate_files_terminate_build 0
+
%description
Python tool that checks if a module satisfy a coding standard.
-%description -l pl
-Narzêdzie sprawdzaj±ce zgodno¶æ modu³ów napisanych w jêzyku Python
-z regu³ami tworzenia kodu ¼ród³owego.
+%description -l pl.UTF-8
+Narzędzie sprawdzające zgodność modułów napisanych w języku Python z
+regułami tworzenia kodu źródłowego.
%package gui
Summary: GUI for pylint
-Summary: Graficzny interfejs u¿ytkownika dla pylinta
+Summary(pl.UTF-8): Graficzny interfejs użytkownika dla pylinta
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
Requires: python-tkinter
%description gui
Tk based GUI for pylint.
-%description gui -l pl
-Oparty na bibliotece Tk graficzny interfejs u¿ytkownika dla pylinta.
+%description gui -l pl.UTF-8
+Oparty na bibliotece Tk graficzny interfejs użytkownika dla pylinta.
+
+%package -n py3lint
+Summary: Python tool that checks if a module satisfy a coding standard
+Summary(pl.UTF-8): Pythonowe narzędzie sprawdzające zgodność modułu ze standardem kodowania
+Group: Development/Languages/Python
+Requires: python3-astroid >= 1.3.2
+Requires: python3-logilab-common >= 0.53.0
+Requires: python3-six
+Obsoletes: pylint-python3 < 1.0.0-2
+
+%description -n py3lint
+Python tool that checks if a module satisfy a coding standard.
+
+Python 3.x version, available via the 'py3lint' command.
+
+%description -n py3lint -l pl.UTF-8
+Narzędzie sprawdzające zgodność modułów napisanych w języku Python z
+regułami tworzenia kodu źródłowego.
+
+Wersja dla Pythona 3.x, dostępna przez polecenie 'py3lint'.
+
+%package -n py3lint-gui
+Summary: GUI for pylint
+Summary(pl.UTF-8): Graficzny interfejs użytkownika dla pylinta
+Group: Development/Languages/Python
+Requires: py3lint = %{version}-%{release}
+Requires: python3-tkinter
+Obsoletes: pylint-python3-gui < 1.0.0-2
+
+%description -n py3lint-gui
+Tk based GUI for pylint.
+
+%description -n py3lint-gui -l pl.UTF-8
+Oparty na bibliotece Tk graficzny interfejs użytkownika dla pylinta.
%prep
%setup -q
%build
-python setup.py build
+%if %{with python2}
+%{__python} setup.py build
+%else
+# for sphinx
+install -d build/lib
+ln -sf ../.. build/lib/pylint
+%endif
+
+%if %{with python3}
+export NO_SETUPTOOLS=1
+%{__python3} setup.py build --build-base=build3
+unset NO_SETUPTOOLS
+%endif
+
+%{__make} -C doc text \
+ PYTHONPATH=$PWD/build/lib
%install
rm -rf $RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1}
-python setup.py install \
+%if %{with python3}
+export NO_SETUPTOOLS=1
+%{__python3} setup.py build --build-base=build3 install \
--optimize=2 \
--root=$RPM_BUILD_ROOT
-install man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
-tail -n 320 examples/pylintrc > $RPM_BUILD_ROOT%{_sysconfdir}/pylintrc
+unset NO_SETUPTOOLS
+mv $RPM_BUILD_ROOT%{_bindir}/epylint $RPM_BUILD_ROOT%{_bindir}/epy3lint
+mv $RPM_BUILD_ROOT%{_bindir}/pylint $RPM_BUILD_ROOT%{_bindir}/py3lint
+mv $RPM_BUILD_ROOT%{_bindir}/pylint-gui $RPM_BUILD_ROOT%{_bindir}/py3lint-gui
+mv $RPM_BUILD_ROOT%{_bindir}/pyreverse $RPM_BUILD_ROOT%{_bindir}/py3reverse
+cp -p man/epylint.1 $RPM_BUILD_ROOT%{_mandir}/man1/epy3lint.1
+cp -p man/pylint.1 $RPM_BUILD_ROOT%{_mandir}/man1/py3lint.1
+cp -p man/pylint-gui.1 $RPM_BUILD_ROOT%{_mandir}/man1/py3lint-gui.1
+cp -p man/pyreverse.1 $RPM_BUILD_ROOT%{_mandir}/man1/py3reverse.1
+%endif
+%if %{with python2}
+%{__python} setup.py install \
+ --optimize=2 \
+ --root=$RPM_BUILD_ROOT
%py_postclean
+cp -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
+%endif
+
+cp -p examples/pylintrc $RPM_BUILD_ROOT%{_sysconfdir}/pylintrc
%clean
rm -rf $RPM_BUILD_ROOT
+%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc ChangeLog TODO README examples/* doc/*.txt
+%doc ChangeLog README examples/* doc/_build/text/*.txt
+%attr(755,root,root) %{_bindir}/epylint
%attr(755,root,root) %{_bindir}/pylint
+%attr(755,root,root) %{_bindir}/pyreverse
%attr(755,root,root) %{_bindir}/symilar
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pylintrc
-%{py_sitescriptdir}/*
-%{_mandir}/man1/*
+%{py_sitescriptdir}/pylint
+%{py_sitescriptdir}/pylint-%{version}-py*.egg-info
+%{_mandir}/man1/epylint.1*
+%{_mandir}/man1/pylint.1*
+%{_mandir}/man1/pyreverse.1*
+%{_mandir}/man1/symilar.1*
%files gui
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/pylint-gui
+%{_mandir}/man1/pylint-gui.1*
+%endif
+
+%if %{with python3}
+%files -n py3lint
+%defattr(644,root,root,755)
+%doc ChangeLog README examples/* doc/_build/text/*.txt
+%attr(755,root,root) %{_bindir}/epy3lint
+%attr(755,root,root) %{_bindir}/py3lint
+%attr(755,root,root) %{_bindir}/py3reverse
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pylintrc
+%{py3_sitescriptdir}/pylint
+%{py3_sitescriptdir}/pylint-%{version}-py*.egg-info
+%{_mandir}/man1/epy3lint.1*
+%{_mandir}/man1/py3lint.1*
+%{_mandir}/man1/py3reverse.1*
+
+%files -n py3lint-gui
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/py3lint-gui
+%{_mandir}/man1/py3lint-gui.1*
+%endif