Update to new packaging guidelines

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Igor Gnatenko 2015-08-05 07:22:48 +03:00
parent 8fa21b59e6
commit 5d413e8709

View File

@ -1,9 +1,8 @@
%global modname appdirs
%bcond_without python3
Name: python-%{modname}
Version: 1.4.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Python module for determining platform-specific directories
License: MIT
@ -11,80 +10,65 @@ URL: http://github.com/ActiveState/appdirs
Source0: https://pypi.python.org/packages/source/a/%{modname}/%{modname}-%{version}.tar.gz
BuildRequires: python2-devel python-setuptools
BuildRequires: python3-devel python3-setuptools
BuildArch: noarch
%description
A small Python module for determining appropriate " + " platform-specific
directories, e.g. a "user data dir".
%if %{with python3}
%package -n python2-%{modname}
Summary: Python 2 module for determining platform-specific directoriess
%{?python_provide:%python_provide python2-%{modname}}
%description -n python2-%{modname}
A small Python 2 module for determining appropriate " + " platform-specific
directories, e.g. a "user data dir".
%package -n python3-%{modname}
Summary: Python 3 module for determining platform-specific directoriess
BuildRequires: python3-devel python3-setuptools
%{?python_provide:%python_provide python3-%{modname}}
%description -n python3-%{modname}
A small Python 3 module for determining appropriate " + " platform-specific
directories, e.g. a "user data dir".
%endif
%prep
%autosetup -n %{modname}-%{version}
rm -rf %{modname}.egg-info
%if %{with python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%py2_build
%if %{with python3}
pushd %{py3dir}
%py3_build
popd
%endif
%py3_build
%install
%py2_install
%if %{with python3}
pushd %{py3dir}
%py3_install
popd
%endif
%py3_install
sed -i -e '1{\@^#!/usr/bin/env python@d}' %{buildroot}%{python2_sitelib}/%{modname}.py
%if %{with python3}
sed -i -e '1{\@^#!/usr/bin/env python@d}' %{buildroot}%{python3_sitelib}/%{modname}.py
%endif
sed -i -e '1{\@^#!/usr/bin/env python@d}' %{buildroot}%{python3_sitelib}/%{modname}.py
%check
%{__python2} setup.py test
%{__python3} setup.py test
%if %{with python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif
%files
%files -n python2-%{modname}
%license LICENSE.txt
%doc README.rst CHANGES.rst
%{python2_sitelib}/%{modname}.*
%{python2_sitelib}/%{modname}-%{version}-py?.?.egg-info/
%{python2_sitelib}/%{modname}-%{version}-py%python2_version.egg-info/
%if %{with python3}
%files -n python3-%{modname}
%license LICENSE.txt
%doc README.rst CHANGES.rst
%{python3_sitelib}/%{modname}.py
%{python3_sitelib}/__pycache__/%{modname}.cpython-??.py*
%{python3_sitelib}/%{modname}-%{version}-py?.?.egg-info/
%endif
%{python3_sitelib}/__pycache__/%{modname}.cpython-%python3_version_nodots.py*
%{python3_sitelib}/%{modname}-%{version}-py%python3_version.egg-info/
%changelog
* Wed Aug 05 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 1.4.0-4
- Update to new packaging guidelines
* Sun Aug 02 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 1.4.0-3
- Use modern python rpm macros