From 4118f8c8fdddce6dcf7b77bc709fffa880e6b013e858fc889c63c2983c3053d2 Mon Sep 17 00:00:00 2001 From: Todd R Date: Wed, 26 Apr 2017 14:35:08 +0000 Subject: [PATCH] Accepting request 491262 from home:TheBlackCat:branches:devel:languages:python - Implement single-spec version - Fix source URL - Run tests - Add do_not_remove_build_directory_manually.patch This avoids deleting build directories that the single-spec macro system needs. OBS-URL: https://build.opensuse.org/request/show/491262 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-ujson?expand=0&rev=9 --- do_not_remove_build_directory_manually.patch | 48 ++++++++++++++++++++ python-ujson.changes | 10 ++++ python-ujson.spec | 42 +++++++++++++---- 3 files changed, 92 insertions(+), 8 deletions(-) create mode 100644 do_not_remove_build_directory_manually.patch diff --git a/do_not_remove_build_directory_manually.patch b/do_not_remove_build_directory_manually.patch new file mode 100644 index 0000000..8964d37 --- /dev/null +++ b/do_not_remove_build_directory_manually.patch @@ -0,0 +1,48 @@ +From 39435177118c9fbc5d3863879c6e4616fd4c12c5 Mon Sep 17 00:00:00 2001 +From: anthraxx +Date: Tue, 26 Jan 2016 14:34:08 +0100 +Subject: [PATCH] do not forcefully remove the build directory manually + +this fixes issue #179. +setuptools should itself know when to use cache or create a +new build... however if someone wants to override that, it's +still possible but forcefully doing that on whatever +setuptools target will (and does) introduce problems. + +Build directory should be cleaned up via the clean sub-command. +examples: +- clean up temp: + python setup.py clean +- clean up whole build dir + python setup.py clean -a + +Or if somebody wants to, the build dir could be removed on the +shell. +--- + setup.py | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/setup.py b/setup.py +index 1e1e220..9f9c8b6 100644 +--- a/setup.py ++++ b/setup.py +@@ -3,7 +3,6 @@ + except ImportError: + from distutils.core import setup, Extension + import distutils.sysconfig +-import shutil + import os.path + import re + import sys +@@ -22,11 +21,6 @@ + Programming Language :: Python :: 3.2 + """.splitlines())) + +-try: +- shutil.rmtree("./build") +-except(OSError): +- pass +- + module1 = Extension('ujson', + sources = ['./python/ujson.c', + './python/objToJSON.c', diff --git a/python-ujson.changes b/python-ujson.changes index 93fd115..9780a7e 100644 --- a/python-ujson.changes +++ b/python-ujson.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Apr 26 03:28:07 UTC 2017 - toddrme2178@gmail.com + +- Implement single-spec version +- Fix source URL +- Run tests +- Add do_not_remove_build_directory_manually.patch + This avoids deleting build directories that the single-spec + macro system needs. + ------------------------------------------------------------------- Fri Dec 16 11:52:13 UTC 2016 - jengelh@inai.de diff --git a/python-ujson.spec b/python-ujson.spec index dd0a1e9..752a1b1 100644 --- a/python-ujson.spec +++ b/python-ujson.spec @@ -1,7 +1,7 @@ # # spec file for package python-ujson # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,9 @@ # +%bcond_with tests + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-ujson Version: 1.35 Release: 0 @@ -23,10 +26,21 @@ Summary: JSON encoder and decoder for Python License: BSD-3-Clause Group: Development/Languages/Python Url: http://www.esn.me -Source: https://pypi.io/packages/source/u/ujson/ujson-%{version}.tar.gz -BuildRequires: python-devel -BuildRequires: python-setuptools +Source: https://files.pythonhosted.org/packages/source/u/ujson/ujson-%{version}.tar.gz +# PATCH-FIX-UPSTREAM -- do_not_remove_build_directory_manually.patch -- https://github.com/esnme/ultrajson/issues/179 +Patch0: do_not_remove_build_directory_manually.patch +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +%if %{with tests} +BuildRequires: %{python_module blist} +BuildRequires: %{python_module six} +BuildRequires: %{python_module pytz} +BuildRequires: python-unittest2 +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-build +%python_subpackages %description UltraJSON is a JSON encoder and decoder written in pure C with @@ -35,16 +49,28 @@ decoder experience please checkout ujson4c_, based on UltraJSON. %prep %setup -q -n ujson-%{version} +%patch0 -p1 %build -CFLAGS="%{optflags}" python setup.py build +export CFLAGS="%{optflags}" +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitearch} -%files +%if %{with tests} +%check +pushd tests +%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch} +$python tests.py +} +%endif + +%files %{python_files} %defattr(-,root,root,-) %doc README.rst -%{python_sitearch}/* +%{python_sitearch}/ujson.* +%{python_sitearch}/ujson-%{version}-py*.egg-info %changelog