diff --git a/0001-Skip-unit-test-in-packaging.patch b/0001-Skip-unit-test-in-packaging.patch new file mode 100644 index 0000000000000000000000000000000000000000..5f03e5c7d42ec2926136735bfd3f135700abc0c7 --- /dev/null +++ b/0001-Skip-unit-test-in-packaging.patch @@ -0,0 +1,25 @@ +From 5bf37e237694ac7bf028f9129561d1265fd95621 Mon Sep 17 00:00:00 2001 +From: Alfredo Moralejo +Date: Tue, 6 Feb 2018 16:57:17 +0000 +Subject: [PATCH] Skip unit test in packaging + +Tarball from pypy does not provides tests.js file. +--- + tests.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests.py b/tests.py +index 548d28b..0386e29 100755 +--- a/tests.py ++++ b/tests.py +@@ -13,6 +13,7 @@ import sys + + class ApplyPatchTestCase(unittest.TestCase): + ++ @unittest.skip("Skipping in packaging") + def test_js_file(self): + with open('./tests.js', 'r') as f: + tests = json.load(f) +-- +1.8.3.1 + diff --git a/jsonpatch-1.32.tar.gz b/jsonpatch-1.32.tar.gz index 6f1fa906a841794290e7d57efeb98e6b66d1b23f..1833e54c12052acd0233a323320a1620e5f66702 100644 Binary files a/jsonpatch-1.32.tar.gz and b/jsonpatch-1.32.tar.gz differ diff --git a/python-jsonpatch.spec b/python-jsonpatch.spec index cd34437d876f4f5526b09fe9e18cf791fee92908..6ed5a46ee470f277a6091a141ea40284ff1d44b4 100644 --- a/python-jsonpatch.spec +++ b/python-jsonpatch.spec @@ -1,41 +1,41 @@ -%define anolis_release 2 +%define anolis_release 3 +%bcond_without tests %global pypi_name jsonpatch +%global github_name json-patch Name: python-%{pypi_name} Version: 1.32 -Release: %{anolis_release}%{dist} +Release: %{anolis_release}%{dist} Summary: Applying JSON Patches in Python - License: BSD -URL: https://github.com/stefankoegl/python-json-patch -Source0: https://pypi.io/packages/source/j/jsonpatch/%{pypi_name}-%{version}.tar.gz - +URL: https://github.com/stefankoegl/python-%{github_name} +Source0: %{pypi_source} BuildArch: noarch -%description -Library to apply JSON Patches according to RFC 6902 - Python 2 build. - -%package -n python3-%{pypi_name} -Summary: Applying JSON Patches in Python 3 +Patch0: 0001-Skip-unit-test-in-packaging.patch -BuildRequires: python3-devel -BuildRequires: python3-jsonpointer -Requires: python3-jsonpointer +%description +Library to apply JSON Patches according to RFC 6902. -%{?python_provide:%python_provide python3-%{pypi_name}} +%package -n python%{python3_pkgversion}-%{pypi_name} +Summary: Library to apply JSON Patches in Python 3 +BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-jsonpointer +BuildRequires: pyproject-rpm-macros +Requires: python%{python3_pkgversion}-jsonpointer +%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} -%description -n python3-%{pypi_name} +%description -n python%{python3_pkgversion}-%{pypi_name} Library to apply JSON Patches according to RFC 6902 - Python 3 build. -%package -n python3-%{pypi_name}-doc -Summary: doc files for python3-%{pypi_name} -Requires: python3-%{pypi_name} = %{version}-%{release} +%package -n python%{python3_pkgversion}-%{pypi_name}-doc +Summary: doc files for python%{python3_pkgversion}-%{pypi_name} +Requires: python%{python3_pkgversion}-%{pypi_name} = %{version}-%{release} -%description -n python3-%{pypi_name}-doc -doc files for python3-%{pypi_name} +%description -n python%{python3_pkgversion}-%{pypi_name}-doc +The documentation files for python%{python3_pkgversion}-%{pypi_name} %prep -%setup -qn python-json-patch-%{version} +%autosetup -n %{pypi_name}-%{version} -p1 %generate_buildrequires %pyproject_buildrequires @@ -45,27 +45,30 @@ doc files for python3-%{pypi_name} %install %pyproject_install -# remove jsondiff binary conflicting with python-jsondiff rm %{buildroot}%{_bindir}/jsondiff -mv %{buildroot}%{_bindir}/jsonpatch %{buildroot}%{_bindir}/jsonpatch-%{python3_version} -ln -s ./jsonpatch-%{python3_version} %{buildroot}%{_bindir}/jsonpatch-3 -ln -s ./jsonpatch-%{python3_version} %{buildroot}%{_bindir}/jsonpatch +mv %{buildroot}%{_bindir}/%{pypi_name} %{buildroot}%{_bindir}/%{pypi_name}-%{python3_version} +ln -s ./%{pypi_name}-%{python3_version} %{buildroot}%{_bindir}/%{pypi_name}-%{python3_pkgversion} +ln -s ./%{pypi_name}-%{python3_version} %{buildroot}%{_bindir}/%{pypi_name} +%pyproject_save_files %{pypi_name} +%if %{with tests} %check %{__python3} tests.py +%endif -%files -n python3-%{pypi_name} +%files -n python%{python3_pkgversion}-%{pypi_name} -f %{pyproject_files} %license COPYING -%{_bindir}/jsonpatch -%{_bindir}/jsonpatch-3* -%{python3_sitelib}/%{pypi_name}.py* -%{python3_sitelib}/__pycache__/* -%{python3_sitelib}/%{pypi_name}-%{version}.dist-info/ +%{_bindir}/%{pypi_name} +%{_bindir}/%{pypi_name}-%{python3_pkgversion} +%{_bindir}/%{pypi_name}-%{python3_version} -%files -n python3-%{pypi_name}-doc -%doc README.md +%files -n python%{python3_pkgversion}-%{pypi_name}-doc +%doc AUTHORS README.md %changelog +* Sun Apr 09 2023 Shawn Wang - 1.32-3 +- Optimize the spec file + * Mon Feb 27 2023 mgb01105731 - 1.32-2 - optimise dependency