From 0c8fc02c40b1d70a38e105419215d6a8b215e5c51b698aa0a2d1db6fd5a66480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Wed, 20 Jan 2021 14:03:14 +0000 Subject: [PATCH] Accepting request 864634 from home:jayvdb:branches:devel:languages:python - Fix Tumbleweed multi Python 3 builds OBS-URL: https://build.opensuse.org/request/show/864634 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-cjson?expand=0&rev=9 --- python-python-cjson.changes | 5 +++++ python-python-cjson.spec | 34 +++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/python-python-cjson.changes b/python-python-cjson.changes index 1e6e6a6..fbca636 100644 --- a/python-python-cjson.changes +++ b/python-python-cjson.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Jan 20 10:16:09 UTC 2021 - John Vandenberg + +- Fix Tumbleweed multi Python 3 builds + ------------------------------------------------------------------- Wed Aug 5 14:50:03 UTC 2020 - Marketa Calabkova diff --git a/python-python-cjson.spec b/python-python-cjson.spec index 4fda69e..5cad4a8 100644 --- a/python-python-cjson.spec +++ b/python-python-cjson.spec @@ -47,36 +47,44 @@ the the range of 10-200 times for encoding operations and in the range of %prep %setup -q -n python-cjson-%{version} +cp jsontest.py jsontest2.py %if %{with python2} -cp cjson.c cjson%{python2_bin_suffix}.c -cp jsontest.py jsontest%{python2_bin_suffix}.py +cp cjson.c cjson2.c %endif %patch0 -p1 -cp cjson.c cjson%{python3_bin_suffix}.c +cp cjson.c cjson3.c -cp jsontest.py jsontest%{python3_bin_suffix}.py +cp jsontest.py jsontest3.py # Workaround dict order differences on Python 3.4 if [ %{python3_bin_suffix} = '3.4' ]; then - sed -i 's/\(testWriteComplexArray\|testWriteSmallObject\)/_\1/' jsontest%{python3_bin_suffix}.py + sed -i 's/\(testWriteComplexArray\|testWriteSmallObject\)/_\1/' jsontest3.py fi %build export CFLAGS="%{optflags} -fno-strict-aliasing" -%if %{with python2} +%{python_expand # rm cjson.c -ln -s cjson%{python2_bin_suffix}.c cjson.c -%python2_build -%endif -rm cjson.c -ln -s cjson%{python3_bin_suffix}.c cjson.c -%python3_build +if [ "$python" == "python2" ]; then + ln -s cjson2.c cjson.c +else + ln -s cjson3.c cjson.c +fi +%{$python_build} +} %install %python_install %python_expand %fdupes %{buildroot}%{$python_sitearch} %check -%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python jsontest%{$python_bin_suffix}.py +%{python_expand # run test +if [ "$python" == "python2" ]; then + python_major_ver=2 +else + python_major_ver=3 +fi +PYTHONPATH=%{buildroot}%{$python_sitearch} $python jsontest${python_major_ver}.py -v +} %files %{python_files} %doc ChangeLog README