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 pypi_name jsonpatch
%global github_name python-json-patch %if 0%{?fedora}
%global commit f6f3cd235337209fc96b71316215a40d1cd3026c
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global with_python3 1 %global with_python3 1
%endif
Name: python-%{pypi_name} Name: python-%{pypi_name}
Version: 1.2 Version: 1.14
Release: 9%{?dist} Release: 1%{?dist}
Summary: Applying JSON Patches in Python Summary: Applying JSON Patches in Python
License: BSD License: BSD
URL: https://github.com/stefankoegl/%{github_name} URL: https://github.com/stefankoegl/%{github_name}
#Source0: https://pypi.python.org/packages/source/j/%{pypi_name}/%{pypi_name}-%{version}.tar.gz #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 # 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 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: python2-devel
BuildRequires: python-setuptools BuildRequires: python-setuptools
BuildRequires: python-jsonpointer BuildRequires: python-jsonpointer
Requires: 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. Library to apply JSON Patches according to RFC 6902 - Python 2 build.
%if 0%{?with_python3} %if 0%{?with_python3}
%package -n python3-%{pypi_name} %package -n python3-%{pypi_name}
Summary: Applying JSON Patches in Python 3 Summary: Applying JSON Patches in Python 3
@ -33,63 +42,78 @@ BuildRequires: python3-setuptools
BuildRequires: python3-jsonpointer BuildRequires: python3-jsonpointer
Requires: python3-jsonpointer Requires: python3-jsonpointer
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name} %description -n python3-%{pypi_name}
Library to apply JSON Patches according to RFC 6902 - Python 3 build. Library to apply JSON Patches according to RFC 6902 - Python 3 build.
%endif %endif
%prep %prep
%setup -qn %{github_name}-%{commit} %setup -qn %{pypi_name}-%{version}
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build %build
%{__python} setup.py build %py2_build
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} LANG=en_US.utf8 %py3_build
LANG=en_US.utf8 %{__python3} setup.py build
popd
%endif %endif
%install %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} %if 0%{?with_python3}
pushd %{py3dir} LANG=en_US.utf8 %py3_install
LANG=en_US.utf8 %{__python3} setup.py install --skip-build --root %{buildroot} for bin in jsondiff jsonpatch; do
popd 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 %endif
%check %check
%{__python} tests.py %{__python2} tests.py
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir}
%{__python3} tests.py %{__python3} tests.py
popd
%endif %endif
%files %files -n python2-%{pypi_name}
%doc README.md %doc README.md
%{!?_licensedir:%global license %%doc}
%license COPYING %license COPYING
%{python_sitelib}/%{pypi_name}.py* %if !0%{?with_python3}
%{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %{_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} %if 0%{?with_python3}
%files -n python3-%{pypi_name} %files -n python3-%{pypi_name}
%doc README.md %doc README.md
%{!?_licensedir:%global license %%doc}
%license COPYING %license COPYING
%{_bindir}/jsondiff
%{_bindir}/jsonpatch
%{_bindir}/jsondiff-3*
%{_bindir}/jsonpatch-3*
%{python3_sitelib}/%{pypi_name}.py* %{python3_sitelib}/%{pypi_name}.py*
%{python3_sitelib}/__pycache__/* %{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif %endif
%changelog %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 * 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 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages