[python-demjson] Update to 2.2.2.

Thomas Moschny thm at fedoraproject.org
Wed Jun 25 16:23:44 UTC 2014


commit 8dd24742796511fbedf07870e833cfc326f266e6
Author: Thomas Moschny <thm at fedoraproject.org>
Date:   Wed Jun 25 18:22:24 2014 +0200

    Update to 2.2.2.
    
    - Provide python3 subpackage.
    - Modernize spec file.
    - Update %description.

 .gitignore          |    1 +
 python-demjson.spec |  132 +++++++++++++++++++++++++++++++++++++-------------
 sources             |    2 +-
 3 files changed, 99 insertions(+), 36 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index b64a7bf..e074737 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 /demjson-1.4.tar.gz
 /demjson-1.5.tar.gz
 /demjson-1.6.tar.gz
+/demjson-2.2.2.tar.gz
diff --git a/python-demjson.spec b/python-demjson.spec
index 9a87e72..25a7ed3 100644
--- a/python-demjson.spec
+++ b/python-demjson.spec
@@ -1,76 +1,138 @@
 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
 
+%if 0%{?fedora}
+%global with_python3 1
+%{!?python3_version: %global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")}
+%endif
+
 Name:           python-demjson
-Version:        1.6
-Release:        6%{?dist}
+Version:        2.2.2
+Release:        1%{?dist}
 Summary:        Python JSON module and lint checker
-
 Group:          Development/Languages
 License:        LGPLv3+
 URL:            http://deron.meranda.us/python/demjson/
 Source0:        http://deron.meranda.us/python/demjson/dist/demjson-%{version}.tar.gz
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:      noarch
 BuildRequires:  python-devel
-BuildRequires:  python-setuptools-devel
-
+BuildRequires:  python-setuptools
+%if 0%{?with_python3}
+BuildRequires:  python3-devel
+BuildRequires:  python3-setuptools
+# needed for 2to3
+BuildRequires:  python-tools
+%endif # with_python3
 
 %description 
-This module provides classes and functions for encoding or decoding
-data represented in the language-neutral JSON format (which is often
-used as a simpler substitute for XML in Ajax web applications).  This
-implementation tries to be as compliant to the JSON specification (RFC
-4627) as possible, while still providing many optional extensions to
-allow less restrictive JavaScript syntax.  It includes complete
-Unicode support, including UTF-32, BOM, and surrogate pair processing.
-It can also support JavaScript's NaN and Infinity numeric types as
-well as it's 'undefined' type.
+The demjson package is a comprehensive Python language library to read
+and write JSON; the popular language-independent data format standard.
+
+It includes a command tool, jsonlint, that allows you to easily check
+and validate any JSON document, and spot any potential data
+portability issues. It can also reformat and re-indent a JSON document
+to make it easier to read.
+
 
-It also includes a lint-like JSON syntax validator which tests JSON
-text for strict compliance to the standard.
+%if 0%{?with_python3}
+%package -n python3-demjson
+Summary:        Python JSON module and lint checker
+Group:          Development/Languages
+
+%description -n python3-demjson
+The demjson package is a comprehensive Python language library to read
+and write JSON; the popular language-independent data format standard.
+
+It includes a command tool, jsonlint, that allows you to easily check
+and validate any JSON document, and spot any potential data
+portability issues. It can also reformat and re-indent a JSON document
+to make it easier to read.
+%endif # with_python3
 
 
 %prep
 %setup -q -n demjson-%{version}
 
+%if 0%{?with_python3}
+cp -a . %{py3dir}
+%endif # with_python3
+
 
 %build
-%if 0%{?rhel} && 0%{?rhel} < 6
-%{__python} -c 'import setuptools; execfile("setup.py")' build
-%else
 %{__python} setup.py build
-%endif
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
 
 
 %install
-rm -rf %{buildroot}
-%if 0%{?rhel} && 0%{?rhel} < 6
-%{__python} -c 'import setuptools; execfile("setup.py")' install -O1 --skip-build --root %{buildroot}
-%else
 %{__python} setup.py install -O1 --skip-build --root %{buildroot}
-%endif
-%{__install} -m 0755 -D -p jsonlint %{buildroot}%{_bindir}/jsonlint
 
 # fix shebang lines
-%{__sed} -i "1c#! /usr/bin/python" %{buildroot}%{_bindir}/jsonlint
 find %{buildroot}%{python_sitelib} -name '*.py' -exec \
-     %{__sed} -i "1{/^#!/d}" {} \;
+     sed -i "1{/^#!/d}" {} \;
+
+# rename binary
+mv %{buildroot}%{_bindir}/jsonlint{,-%{python_version}}
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
+
+# fix shebang lines
+find %{buildroot}%{python3_sitelib} -name '*.py' -exec \
+     sed -i "1{/^#!/d}" {} \;
 
+# rename binary
+mv %{buildroot}%{_bindir}/jsonlint{,-%{python3_version}}
+popd
+%endif # with_python3
 
-%clean
-rm -rf %{buildroot}
+# 2.X binary is called by default for now
+ln -s jsonlint-%{python_version} %{buildroot}%{_bindir}/jsonlint
+
+
+%check
+cd test
+PYTHONPATH=%{buildroot}%{python_sitelib} \
+%{__python} test_demjson.py
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+cd test
+2to3 -w --no-diffs test_demjson.py
+PYTHONPATH=%{buildroot}%{python3_sitelib} \
+%{__python3} test_demjson.py
+popd
+%endif # with_python3
 
 
 %files
-%defattr(-,root,root,-)
-%doc docs/demjson.html docs/jsonlint.txt
-%doc AUTHORS.txt CHANGES.txt LICENSE.txt
-%doc NEWS.txt README.txt THANKS.txt
+%doc README.txt README.md LICENSE.txt
+%doc docs
 %{python_sitelib}/*
 %{_bindir}/jsonlint
+%{_bindir}/jsonlint-%{python_version}
+
+
+%if 0%{?with_python3}
+%files -n python3-demjson
+%doc README.txt README.md LICENSE.txt
+%doc docs
+%{python3_sitelib}/*
+%{_bindir}/jsonlint-%{python3_version}
+%endif # with_python3
 
 
 %changelog
+* Wed Jun 25 2014 Thomas Moschny <thomas.moschny at gmx.de> - 2.2.2-1
+- Update to 2.2.2.
+- Provide python3 subpackage.
+- Modernize spec file.
+- Update %%description.
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.6-6
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 
diff --git a/sources b/sources
index e0d0ad4..7bb80a1 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-ac14383b0d3de1aa270f5c32bfc7cbf3  demjson-1.6.tar.gz
+5b7400827f098fc655b4b3653cf001dd  demjson-2.2.2.tar.gz


More information about the scm-commits mailing list