Upstream 1.14

- Update to latest python packaging guidelines
This commit is contained in:
Haikel Guemar 2016-09-05 17:53:26 +02:00
parent 35f798e97e
commit eab992157c

View File

@ -1,29 +1,38 @@
%global pypi_name jsonpatch
%global github_name python-json-patch
%global commit f6f3cd235337209fc96b71316215a40d1cd3026c
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%if 0%{?fedora}
%global with_python3 1
%endif
Name: python-%{pypi_name}
Version: 1.2
Release: 9%{?dist}
Version: 1.14
Release: 1%{?dist}
Summary: Applying JSON Patches in Python
License: BSD
URL: https://github.com/stefankoegl/%{github_name}
#Source0: https://pypi.python.org/packages/source/j/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
# pypi tarball does not contain README.md and tests.py
Source0: https://github.com/stefankoegl/%{github_name}/archive/%{commit}/%{github_name}-%{version}-%{shortcommit}.tar.gz
Source0: https://pypi.io/packages/source/j/jsonpatch/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
%description
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
%package -n python2-%{pypi_name}
Summary: Applying JSON Patches in Python 2
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-jsonpointer
Requires: python-jsonpointer
%description
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary: Applying JSON Patches in Python 3
@ -33,63 +42,78 @@ BuildRequires: python3-setuptools
BuildRequires: python3-jsonpointer
Requires: python3-jsonpointer
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
Library to apply JSON Patches according to RFC 6902 - Python 3 build.
%endif
%prep
%setup -qn %{github_name}-%{commit}
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%setup -qn %{pypi_name}-%{version}
%build
%{__python} setup.py build
%py2_build
%if 0%{?with_python3}
pushd %{py3dir}
LANG=en_US.utf8 %{__python3} setup.py build
popd
LANG=en_US.utf8 %py3_build
%endif
%install
%{__python} setup.py install --skip-build --root %{buildroot}
%py2_install
for bin in jsondiff jsonpatch; do
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python2_version}
ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin-2
%if !0%{?with_python3}
ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin
%endif
done;
%if 0%{?with_python3}
pushd %{py3dir}
LANG=en_US.utf8 %{__python3} setup.py install --skip-build --root %{buildroot}
popd
LANG=en_US.utf8 %py3_install
for bin in jsondiff jsonpatch; do
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python3_version}
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin-3
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin
done;
%endif
%check
%{__python} tests.py
%{__python2} tests.py
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} tests.py
popd
%endif
%files
%files -n python2-%{pypi_name}
%doc README.md
%{!?_licensedir:%global license %%doc}
%license COPYING
%{python_sitelib}/%{pypi_name}.py*
%{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%if !0%{?with_python3}
%{_bindir}/jsondiff
%{_bindir}/jsonpatch
%endif
%{_bindir}/jsondiff-2*
%{_bindir}/jsonpatch-2*
%{python2_sitelib}/%{pypi_name}.py*
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.md
%{!?_licensedir:%global license %%doc}
%license COPYING
%{_bindir}/jsondiff
%{_bindir}/jsonpatch
%{_bindir}/jsondiff-3*
%{_bindir}/jsonpatch-3*
%{python3_sitelib}/%{pypi_name}.py*
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif
%changelog
* Mon Sep 5 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 1.14-1
- Upstream 1.14
- Update to latest python packaging guidelines
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-9
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages