Hello community,
here is the log from the commit of package python-canonicaljson for
openSUSE:Factory checked in at 2018-04-22 14:40:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-canonicaljson (Old)
and /work/SRC/openSUSE:Factory/.python-canonicaljson.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-canonicaljson"
Sun Apr 22 14:40:30 2018 rev:2 rq:599476 version:1.1.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-canonicaljson/python-canonicaljson.changes
2017-08-08 11:58:45.076150406 +0200
+++
/work/SRC/openSUSE:Factory/.python-canonicaljson.new/python-canonicaljson.changes
2018-04-22 14:40:35.990882999 +0200
@@ -1,0 +2,10 @@
+Fri Apr 20 18:08:21 UTC 2018 - [email protected]
+
+- Cleanup duplicate files in singlespec package with fdupes
+
+-------------------------------------------------------------------
+Fri Apr 20 18:05:19 UTC 2018 - [email protected]
+
+- Update to 1.1.3
+
+-------------------------------------------------------------------
Old:
----
python-canonicaljson-1.0.0.tar.gz
New:
----
python-canonicaljson-1.1.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-canonicaljson.spec ++++++
--- /var/tmp/diff_new_pack.VbEAco/_old 2018-04-22 14:40:37.614824237 +0200
+++ /var/tmp/diff_new_pack.VbEAco/_new 2018-04-22 14:40:37.614824237 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-canonicaljson
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 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
@@ -20,7 +20,7 @@
%define github_user matrix-org
%define short_name canonicaljson
Name: python-%{short_name}
-Version: 1.0.0
+Version: 1.1.3
Release: 0
Summary: Canonical JSON
License: Apache-2.0
@@ -31,6 +31,7 @@
BuildRequires: %{python_module frozendict}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module simplejson}
+BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
@@ -61,6 +62,7 @@
%install
%python_install
+%fdupes %{buildroot}%{_prefix}
%files %{python_files}
%defattr(-,root,root,-)
++++++ python-canonicaljson-1.0.0.tar.gz -> python-canonicaljson-1.1.3.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/.gitignore
new/python-canonicaljson-1.1.3/.gitignore
--- old/python-canonicaljson-1.0.0/.gitignore 2015-08-21 20:06:51.000000000
+0200
+++ new/python-canonicaljson-1.1.3/.gitignore 2018-04-13 10:56:44.000000000
+0200
@@ -1,7 +1,8 @@
-.coverage
-.tox/
+/.coverage
+/.idea/
+/.tox/
__pycache__/
*.egg-info/
*.pyc
-build/
-dist/
+/build/
+/dist/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/.travis.yml
new/python-canonicaljson-1.1.3/.travis.yml
--- old/python-canonicaljson-1.0.0/.travis.yml 2015-08-21 20:06:51.000000000
+0200
+++ new/python-canonicaljson-1.1.3/.travis.yml 2018-04-13 10:56:44.000000000
+0200
@@ -1,12 +1,36 @@
language: python
-env:
-- TOXENV=packaging
-- TOXENV=pep8
-- TOXENV=py3pep8
-- TOXENV=py27
-- TOXENV=py33
-- TOXENV=py34
-- TOXENV=pypy
+
+# tell travis to cache ~/.cache/pip
+cache: pip
+
+matrix:
+ include:
+ - python: 2.7
+ env: TOXENV=packaging
+
+ - python: 2.7
+ env: TOXENV=pep8
+
+ - python: 3.6
+ env: TOXENV=py3pep8
+
+ - python: 2.7
+ env: TOXENV=py27
+
+ - python: 3.3
+ env: TOXENV=py33
+
+ - python: 3.4
+ env: TOXENV=py34
+
+ - python: 3.5
+ env: TOXENV=py35
+
+ - python: 3.6
+ env: TOXENV=py36
+
+ - python: pypy
+ env: TOXENV=pypy
install:
- pip install tox
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/CHANGES.md
new/python-canonicaljson-1.1.3/CHANGES.md
--- old/python-canonicaljson-1.0.0/CHANGES.md 1970-01-01 01:00:00.000000000
+0100
+++ new/python-canonicaljson-1.1.3/CHANGES.md 2018-04-13 10:56:44.000000000
+0200
@@ -0,0 +1,25 @@
+Version 1.1.3 released 2018-04-13
+
+ * Bump depencency on frozendict to >=1.0, to fix conflicts with older
+ versions.
+
+Version 1.1.2 released 2018-04-12
+
+ * Fix escaping of control characters U+0000 to U+001F AGAIN, which was STILL
+ broken in the previous release
+
+Version 1.1.1 released 2018-04-11
+
+ * Fix escaping of control characters U+0000 to U+001F, which was broken in
+ the previous release
+
+Version 1.1.0 released 2018-04-06
+
+ * Significant performance improvements
+ (https://github.com/matrix-org/python-canonicaljson/pull/7,
+ https://github.com/matrix-org/python-canonicaljson/pull/8,
+ https://github.com/matrix-org/python-canonicaljson/pull/9)
+
+Version 1.0.0 released 2015-08-21
+
+ * Initial release
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/MANIFEST.in
new/python-canonicaljson-1.1.3/MANIFEST.in
--- old/python-canonicaljson-1.0.0/MANIFEST.in 2015-08-21 20:06:51.000000000
+0200
+++ new/python-canonicaljson-1.1.3/MANIFEST.in 2018-04-13 10:56:44.000000000
+0200
@@ -1,5 +1,6 @@
include *.in
include *.py
+include *.md
include LICENSE
include tox.ini
-include requirements.txt
+prune debian
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/README.rst
new/python-canonicaljson-1.1.3/README.rst
--- old/python-canonicaljson-1.0.0/README.rst 2015-08-21 20:06:51.000000000
+0200
+++ new/python-canonicaljson-1.1.3/README.rst 2018-04-13 10:56:44.000000000
+0200
@@ -13,7 +13,7 @@
* Encodes objects and arrays as `RFC 7159`_ JSON.
* Sorts object keys so that you get the same result each time.
-* Has no inignificant whitespace to make the output as small as possible.
+* Has no insignificant whitespace to make the output as small as possible.
* Escapes only the characters that must be escaped, U+0000 to U+0019 / U+0022 /
U+0056, to keep the output as small as possible.
* Uses the shortest escape sequence for each escaped character.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/canonicaljson.py
new/python-canonicaljson-1.1.3/canonicaljson.py
--- old/python-canonicaljson-1.0.0/canonicaljson.py 2015-08-21
20:06:51.000000000 +0200
+++ new/python-canonicaljson-1.1.3/canonicaljson.py 2018-04-13
10:56:44.000000000 +0200
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket Ltd
+# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,12 +15,118 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import re
+from six import unichr, PY2
+# using simplejson rather than regular json gives approximately a 100%
+# performance improvement (as measured on python 2.7.12/simplejson 3.13.2)
import simplejson as json
from frozendict import frozendict
-__version__ = '1.0.0'
+__version__ = '1.1.3'
+
+
+def _default(obj):
+ if type(obj) is frozendict:
+ # fishing the protected dict out of the object is a bit nasty,
+ # but we don't really want the overhead of copying the dict.
+ return obj._dict
+ raise TypeError('Object of type %s is not JSON serializable' %
+ obj.__class__.__name__)
+
+
+# ideally we'd set ensure_ascii=False, but the ensure_ascii codepath is so
+# much quicker (assuming c speedups are enabled) that it's actually much
+# quicker to let it do that and then substitute back (it's about 2.5x faster).
+#
+# (in any case, simplejson's ensure_ascii doesn't get U+2028 and U+2029 right,
+# as per https://github.com/simplejson/simplejson/issues/206).
+#
+_canonical_encoder = json.JSONEncoder(
+ ensure_ascii=True,
+ separators=(',', ':'),
+ sort_keys=True,
+ default=_default,
+)
+
+_pretty_encoder = json.JSONEncoder(
+ ensure_ascii=True,
+ indent=4,
+ sort_keys=True,
+ default=_default,
+)
+
+# This regexp matches either `\uNNNN` or `\\`. We match '\\' (and leave it
+# unchanged) to make sure that the regex doesn't accidentally capture the uNNNN
+# in `\\uNNNN`, which is an escaped backslash followed by 'uNNNN'.
+_U_ESCAPE = re.compile(r"\\u([0-9a-f]{4})|\\\\")
+
+
+def _unascii(s):
+ """Unpack `\\uNNNN` escapes in 's' and encode the result as UTF-8
+
+ This method takes the output of the JSONEncoder and expands any \\uNNNN
+ escapes it finds (except for \\u0000 to \\u001F, which are converted to
+ \\xNN escapes).
+
+ For performance, it assumes that the input is valid JSON, and performs few
+ sanity checks.
+ """
+
+ # make the fast path fast: if there are no matches in the string, the
+ # whole thing is ascii. On python 2, that means we're done. On python 3,
+ # we have to turn it into a bytes, which is quickest with encode('utf-8')
+ m = _U_ESCAPE.search(s)
+ if not m:
+ return s if PY2 else s.encode('utf-8')
+
+ # appending to a string (or a bytes) is slooow, so we accumulate sections
+ # of string result in 'chunks', and join them all together later.
+ # (It doesn't seem to make much difference whether we accumulate
+ # utf8-encoded bytes, or strings which we utf-8 encode after rejoining)
+ #
+ chunks = []
+
+ # 'pos' tracks the index in 's' that we have processed into 'chunks' so
+ # far.
+ pos = 0
+
+ while m:
+ start = m.start()
+ end = m.end()
+
+ g = m.group(1)
+
+ if g is None:
+ # escaped backslash: pass it through along with anything before the
+ # match
+ chunks.append(s[pos:end])
+ else:
+ # \uNNNN, but we have to watch out for surrogate pairs
+ c = int(g, 16)
+
+ if c < 0x20:
+ # leave as a \uNNNN escape
+ chunks.append(s[pos:end])
+ else:
+ if c & 0xfc00 == 0xd800 and s[end:end + 2] == '\\u':
+ esc2 = s[end + 2:end + 6]
+ c2 = int(esc2, 16)
+ if c2 & 0xfc00 == 0xdc00:
+ c = 0x10000 + (((c - 0xd800) << 10) | (c2 - 0xdc00))
+ end += 6
+
+ chunks.append(s[pos:start])
+ chunks.append(unichr(c))
+
+ pos = end
+ m = _U_ESCAPE.search(s, pos)
+
+ # pass through anything after the last match
+ chunks.append(s[pos:])
+
+ return (''.join(chunks)).encode("utf-8")
def encode_canonical_json(json_object):
@@ -31,30 +138,11 @@
Returns:
bytes encoding the JSON object"""
-
- return json.dumps(
- json_object,
- ensure_ascii=False,
- separators=(',', ':'),
- sort_keys=True,
- cls=FrozenEncoder
- ).encode("UTF-8")
+ s = _canonical_encoder.encode(json_object)
+ return _unascii(s)
def encode_pretty_printed_json(json_object):
"""Encodes the JSON object dict as human readable ascii bytes."""
- return json.dumps(
- json_object,
- ensure_ascii=True,
- indent=4,
- sort_keys=True,
- cls=FrozenEncoder
- ).encode("ascii")
-
-
-class FrozenEncoder(json.JSONEncoder):
- def default(self, obj):
- if type(obj) is frozendict:
- return dict(obj)
- return json.JSONEncoder.default(self, obj)
+ return _pretty_encoder.encode(json_object).encode("ascii")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/debian/changelog
new/python-canonicaljson-1.1.3/debian/changelog
--- old/python-canonicaljson-1.0.0/debian/changelog 1970-01-01
01:00:00.000000000 +0100
+++ new/python-canonicaljson-1.1.3/debian/changelog 2018-04-13
10:56:44.000000000 +0200
@@ -0,0 +1,35 @@
+python-canonicaljson (1.1.3) stable; urgency=medium
+
+ * Bump depencency on frozendict to >=1.0, to fix conflicts with older
+ versions.
+
+ -- Richard van der Hoff <[email protected]> Fri, 13 Apr 2018 09:51:24 +0100
+
+python-canonicaljson (1.1.2) stable; urgency=medium
+
+ * Fix escaping of control characters U+0000 to U+001F AGAIN, which was STILL
+ broken in the previous release
+
+ -- Richard van der Hoff <[email protected]> Thu, 12 Apr 2018 15:53:56 +0100
+
+python-canonicaljson (1.1.1) stable; urgency=medium
+
+ * Fix escaping of control characters U+0000 to U+001F, which was broken in
+ the previous release
+
+ -- Richard van der Hoff <[email protected]> Wed, 11 Apr 2018 18:01:50 +0100
+
+python-canonicaljson (1.1.0) stable; urgency=medium
+
+ * Significant performance improvements
+ (https://github.com/matrix-org/python-canonicaljson/pull/7,
+ https://github.com/matrix-org/python-canonicaljson/pull/8,
+ https://github.com/matrix-org/python-canonicaljson/pull/9)
+
+ -- Richard van der Hoff <[email protected]> Tue, 10 Apr 2018 16:42:19 +0100
+
+canonicaljson (1.0.0-1) wheezy; urgency=low
+
+ * source package automatically created by stdeb 0.6.0+git
+
+ -- Erik Johnston <[email protected]> Fri, 13 Nov 2015 14:47:18 +0000
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/debian/clean
new/python-canonicaljson-1.1.3/debian/clean
--- old/python-canonicaljson-1.0.0/debian/clean 1970-01-01 01:00:00.000000000
+0100
+++ new/python-canonicaljson-1.1.3/debian/clean 2018-04-13 10:56:44.000000000
+0200
@@ -0,0 +1 @@
+*.egg-info/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/debian/compat
new/python-canonicaljson-1.1.3/debian/compat
--- old/python-canonicaljson-1.0.0/debian/compat 1970-01-01
01:00:00.000000000 +0100
+++ new/python-canonicaljson-1.1.3/debian/compat 2018-04-13
10:56:44.000000000 +0200
@@ -0,0 +1 @@
+9
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/debian/control
new/python-canonicaljson-1.1.3/debian/control
--- old/python-canonicaljson-1.0.0/debian/control 1970-01-01
01:00:00.000000000 +0100
+++ new/python-canonicaljson-1.1.3/debian/control 2018-04-13
10:56:44.000000000 +0200
@@ -0,0 +1,56 @@
+Source: python-canonicaljson
+Maintainer: Richard van der Hoff <[email protected]>
+Section: python
+Priority: optional
+Build-Depends:
+ debhelper (>= 9),
+ dh-python,
+ python-all (>= 2.6.6-3),
+ python-setuptools (>= 0.6.24),
+ python3-all,
+ python3-setuptools (>= 0.6.24),
+ python-frozendict (>= 0.4),
+ python-simplejson (>= 3.6.5),
+ python3-frozendict (>= 0.4),
+ python3-simplejson (>= 3.6.5)
+Standards-Version: 3.9.7
+X-Python-Version: >= 2.7
+
+Package: python-canonicaljson
+Architecture: all
+Depends:
+ python-frozendict (>= 0.4),
+ python-simplejson (>= 3.6.5),
+ ${misc:Depends},
+ ${python:Depends}
+Provides: ${python:Provides}
+Description: canonical JSON implementation for Python 2
+ Canonical JSON implementation for Python 2.
+ .
+ * Encodes objects and arrays as RFC 7159 JSON.
+ * Sorts object keys so that you get the same result each time.
+ * Has no inignificant whitespace to make the output as small as possible.
+ * Escapes only the characters that must be escaped, U+0000 to U+0019 / U+0022
/
+ U+0056, to keep the output as small as possible.
+ * Uses the shortest escape sequence for each escaped character.
+ * Encodes the JSON as UTF-8.
+ * Can encode frozendict immutable dictionaries.
+
+Package: python3-canonicaljson
+Architecture: all
+Depends:
+ python3-frozendict (>= 0.4),
+ python3-simplejson (>= 3.6.5),
+ ${misc:Depends},
+ ${python3:Depends}
+Description: canonical JSON implementation for Python 3
+ Canonical JSON implementation for Python 3.
+ .
+ * Encodes objects and arrays as RFC 7159 JSON.
+ * Sorts object keys so that you get the same result each time.
+ * Has no inignificant whitespace to make the output as small as possible.
+ * Escapes only the characters that must be escaped, U+0000 to U+0019 / U+0022
/
+ U+0056, to keep the output as small as possible.
+ * Uses the shortest escape sequence for each escaped character.
+ * Encodes the JSON as UTF-8.
+ * Can encode frozendict immutable dictionaries.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/debian/copyright
new/python-canonicaljson-1.1.3/debian/copyright
--- old/python-canonicaljson-1.0.0/debian/copyright 1970-01-01
01:00:00.000000000 +0100
+++ new/python-canonicaljson-1.1.3/debian/copyright 2018-04-13
10:56:44.000000000 +0200
@@ -0,0 +1,29 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Contact: Richard van der Hoff <[email protected]>
+
+Files: *
+Copyright: 2014-2015 OpenMarket Ltd
+ 2018 New Vector Ltd
+License: Apache-2.0
+
+Files: debian/*
+Copyright: 2014-2015 OpenMarket Ltd
+ 2017 Andrew Shadura <[email protected]>
+ 2018 New Vector Ltd
+License: Apache-2.0
+
+License: Apache-2.0
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ .
+ http://www.apache.org/licenses/LICENSE-2.0
+ .
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ .
+ On Debian systems, the complete text of the Apache License,
+ version 2.0 can be found in ‘/usr/share/common-licenses/Apache-2.0’.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-canonicaljson-1.0.0/debian/python-canonicaljson.docs
new/python-canonicaljson-1.1.3/debian/python-canonicaljson.docs
--- old/python-canonicaljson-1.0.0/debian/python-canonicaljson.docs
1970-01-01 01:00:00.000000000 +0100
+++ new/python-canonicaljson-1.1.3/debian/python-canonicaljson.docs
2018-04-13 10:56:44.000000000 +0200
@@ -0,0 +1 @@
+README.rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-canonicaljson-1.0.0/debian/python3-canonicaljson.docs
new/python-canonicaljson-1.1.3/debian/python3-canonicaljson.docs
--- old/python-canonicaljson-1.0.0/debian/python3-canonicaljson.docs
1970-01-01 01:00:00.000000000 +0100
+++ new/python-canonicaljson-1.1.3/debian/python3-canonicaljson.docs
2018-04-13 10:56:44.000000000 +0200
@@ -0,0 +1 @@
+README.rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/debian/rules
new/python-canonicaljson-1.1.3/debian/rules
--- old/python-canonicaljson-1.0.0/debian/rules 1970-01-01 01:00:00.000000000
+0100
+++ new/python-canonicaljson-1.1.3/debian/rules 2018-04-13 10:56:44.000000000
+0200
@@ -0,0 +1,6 @@
+#!/usr/bin/make -f
+
+export PYBUILD_NAME=canonicaljson
+
+%:
+ dh $@ --with python2,python3 --buildsystem=pybuild
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/debian/source/format
new/python-canonicaljson-1.1.3/debian/source/format
--- old/python-canonicaljson-1.0.0/debian/source/format 1970-01-01
01:00:00.000000000 +0100
+++ new/python-canonicaljson-1.1.3/debian/source/format 2018-04-13
10:56:44.000000000 +0200
@@ -0,0 +1 @@
+3.0 (native)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/debian/source/options
new/python-canonicaljson-1.1.3/debian/source/options
--- old/python-canonicaljson-1.0.0/debian/source/options 1970-01-01
01:00:00.000000000 +0100
+++ new/python-canonicaljson-1.1.3/debian/source/options 2018-04-13
10:56:44.000000000 +0200
@@ -0,0 +1 @@
+extend-diff-ignore="\.egg-info"
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/releasing.md
new/python-canonicaljson-1.1.3/releasing.md
--- old/python-canonicaljson-1.0.0/releasing.md 1970-01-01 01:00:00.000000000
+0100
+++ new/python-canonicaljson-1.1.3/releasing.md 2018-04-13 10:56:44.000000000
+0200
@@ -0,0 +1,44 @@
+Releasing python-canonicaljson
+==============================
+
+* bump version in `canonicaljson.py`
+* update changelog
+* update debian changelog:
+ * Add new entry: `dch -v <ver>`
+ * Mark as released: `dch --distribution stable -r`
+* Build and upload to pypi:
+ * `rm -r dist`
+ * `python setup.py sdist bdist_wheel`
+ * `twine upload -s dist/*`
+* `git tag -s v<ver>`
+* `git push`
+* `git push --tags`
+* Follow instructions below to release debian packaging.
+
+Prerequisites for debian packaging
+----------------------------------
+
+```
+sudo apt-get install sbuild
+sudo apt-get install ubuntu-dev-tools # for mk-sbuild
+sudo sbuild-adduser $LOGNAME
+
+newgrp sbuild
+mk-sbuild stretch
+```
+
+If your kernel doesn't support `aufs`, you'll need to set `union-type=overlay`
+in `/etc/schroot/chroot.d/sbuild-stretch-amd64`.
+
+Debian release
+--------------
+
+```
+# We need to build from a pristine copy of the repo (otherwise you end up with
+# your whole working copy in the source tarball), so:
+git clone [email protected]:matrix-org/python-canonicaljson.git -b v<ver>
python-canonicaljson-clean
+
+cd python-canonicaljson-clean
+sbuild -s --arch-all -d stretch
+debsign
+```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/requirements.txt
new/python-canonicaljson-1.1.3/requirements.txt
--- old/python-canonicaljson-1.0.0/requirements.txt 2015-08-21
20:06:51.000000000 +0200
+++ new/python-canonicaljson-1.1.3/requirements.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
--e .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/setup.cfg
new/python-canonicaljson-1.1.3/setup.cfg
--- old/python-canonicaljson-1.0.0/setup.cfg 1970-01-01 01:00:00.000000000
+0100
+++ new/python-canonicaljson-1.1.3/setup.cfg 2018-04-13 10:56:44.000000000
+0200
@@ -0,0 +1,3 @@
+[bdist_wheel]
+# we can generate universal wheels that support both Python 2 and Python 3.
+universal=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/setup.py
new/python-canonicaljson-1.1.3/setup.py
--- old/python-canonicaljson-1.0.0/setup.py 2015-08-21 20:06:51.000000000
+0200
+++ new/python-canonicaljson-1.1.3/setup.py 2018-04-13 10:56:44.000000000
+0200
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# Copyright 2015 OpenMarket Ltd
+# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -46,8 +47,21 @@
description="Canonical JSON",
install_requires=[
"simplejson>=3.6.5",
- "frozendict>=0.4",
+ "frozendict>=1.0",
+ "six",
],
+ zip_safe=True,
long_description=read_file(("README.rst",)),
keywords="json",
+ author='The Matrix.org Team',
+ author_email='[email protected]',
+ url='https://github.com/matrix-org/python-canonicaljson',
+ license='Apache License, Version 2.0',
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Apache Software License',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 3',
+ ],
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/test_canonicaljson.py
new/python-canonicaljson-1.1.3/test_canonicaljson.py
--- old/python-canonicaljson-1.0.0/test_canonicaljson.py 2015-08-21
20:06:51.000000000 +0200
+++ new/python-canonicaljson-1.1.3/test_canonicaljson.py 2018-04-13
10:56:44.000000000 +0200
@@ -1,4 +1,7 @@
+# -*- coding: utf-8 -*-
+#
# Copyright 2015 OpenMarket Ltd
+# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,12 +30,47 @@
def test_encode_canonical(self):
self.assertEquals(encode_canonical_json({}), b'{}')
+ # ctrl-chars should be encoded.
+ self.assertEquals(
+ encode_canonical_json(u"text\u0003\r\n"),
+ b'"text\\u0003\\r\\n"',
+ )
+
+ # quotes and backslashes should be escaped.
+ self.assertEquals(
+ encode_canonical_json(r'"\ test'),
+ b'"\\"\\\\ test"',
+ )
+
+ # non-ascii should come out utf8-encoded.
+ self.assertEquals(encode_canonical_json({
+ u"la merde amusée": u"💩",
+ }), b'{"la merde amus\xc3\xa9e":"\xF0\x9F\x92\xA9"}')
+
+ # so should U+2028 and U+2029
+ self.assertEquals(
+ encode_canonical_json({u"spaces": u"\u2028 \u2029"}),
+ b'{"spaces":"\xe2\x80\xa8 \xe2\x80\xa9"}',
+ )
+
+ # but we need to watch out for 'u1234' after backslash, which should
+ # get encoded to an escaped backslash, followed by u1234
+ self.assertEquals(
+ encode_canonical_json(u"\\u1234"),
+ b'"\\\\u1234"',
+ )
+
def test_encode_pretty_printed(self):
self.assertEquals(encode_pretty_printed_json({}), b'{}')
def test_frozen_dict(self):
- self.assertEquals(encode_canonical_json(frozendict({})), b'{}')
- self.assertEquals(encode_pretty_printed_json(frozendict({})), b'{}')
+ self.assertEquals(
+ encode_canonical_json(frozendict({"a": 1})),
+ b'{"a":1}',
+ )
+ self.assertEquals(
+ encode_pretty_printed_json(frozendict({"a": 1})),
+ b'{\n "a": 1\n}')
def test_unknown_type(self):
class Unknown(object):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-canonicaljson-1.0.0/tox.ini
new/python-canonicaljson-1.1.3/tox.ini
--- old/python-canonicaljson-1.0.0/tox.ini 2015-08-21 20:06:51.000000000
+0200
+++ new/python-canonicaljson-1.1.3/tox.ini 2018-04-13 10:56:44.000000000
+0200
@@ -1,11 +1,11 @@
[tox]
-envlist = packaging, pep8, py3pep8, py27, py33, py34, pypy
+envlist = packaging, pep8, py3pep8, py26, py27, py33, py34, py35, py36, pypy
[testenv]
deps =
coverage
nose
- -rrequirements.txt
+
commands =
coverage run --source canonicaljson -m nose
coverage report -m --fail-under 100
@@ -22,7 +22,7 @@
commands = flake8 .
[testenv:py3pep8]
-basepython = python3.4
+basepython = python3.6
deps =
flake8
commands = flake8 .