15
0
forked from pool/python-bson

- Add patch support-python314.patch:

* Support Python 3.14 removals.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bson?expand=0&rev=16
This commit is contained in:
2025-10-28 05:30:12 +00:00
committed by Git OBS Bridge
commit 84f4769e70
9 changed files with 435 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
bson-0.5.10.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fef2a86682570c3622519ddafb7477e9b876d440eba4e04017b1a5f3b49ccc27
size 24735

211
drop-python2-support.patch Normal file
View File

@@ -0,0 +1,211 @@
Index: bson-0.5.10/bson/codec.py
===================================================================
--- bson-0.5.10.orig/bson/codec.py
+++ bson-0.5.10/bson/codec.py
@@ -24,9 +24,6 @@ import calendar
from dateutil.tz import tzutc
from binascii import b2a_hex
-from six import integer_types, iterkeys, text_type, PY3
-from six.moves import xrange
-
utc = tzutc()
@@ -132,7 +129,7 @@ def encode_string(value):
def encode_cstring(value):
if not isinstance(value, bytes):
- value = text_type(value).encode("utf-8")
+ value = str(value).encode("utf-8")
if b"\x00" in value:
raise ValueError("Element names may not include NUL bytes.")
# A NUL byte is used to delimit our string, accepting one would cause
@@ -174,7 +171,7 @@ def encode_string_element(name, value):
def _is_string(value):
- if isinstance(value, text_type):
+ if isinstance(value, str):
return True
elif isinstance(value, str) or isinstance(value, bytes):
try:
@@ -189,7 +186,7 @@ def encode_value(name, value, buf, trave
generator_func, on_unknown=None):
if isinstance(value, bool):
buf.write(encode_boolean_element(name, value))
- elif isinstance(value, integer_types):
+ elif isinstance(value, int):
if value < -0x80000000 or 0x7FFFFFFFFFFFFFFF >= value > 0x7fffffff:
buf.write(encode_int64_element(name, value))
elif value > 0x7FFFFFFFFFFFFFFF:
@@ -238,7 +235,7 @@ def encode_value(name, value, buf, trave
def encode_document(obj, traversal_stack, traversal_parent=None,
generator_func=None, on_unknown=None):
buf = StringIO()
- key_iter = iterkeys(obj)
+ key_iter = iter(obj.keys())
if generator_func is not None:
key_iter = generator_func(obj, traversal_stack)
for name in key_iter:
@@ -256,7 +253,7 @@ def encode_document(obj, traversal_stack
def encode_array(array, traversal_stack, traversal_parent=None,
generator_func=None, on_unknown=None):
buf = StringIO()
- for i in xrange(0, len(array)):
+ for i in range(0, len(array)):
value = array[i]
traversal_stack.append(TraversalStep(traversal_parent or array, i))
encode_value(str(i), value, buf, traversal_stack,
@@ -295,10 +292,7 @@ def decode_document(data, base, as_array
element_type = char_struct.unpack(data[base:base + 1])[0]
- if PY3:
- ll = data.index(0, base + 1) + 1
- else:
- ll = data.index("\x00", base + 1) + 1
+ ll = data.index(0, base + 1) + 1
if decode_name:
name = data[base + 1:ll - 1]
try:
Index: bson-0.5.10/bson/network.py
===================================================================
--- bson-0.5.10.orig/bson/network.py
+++ bson-0.5.10/bson/network.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from struct import unpack
-from six import BytesIO, b
+from io import BytesIO
from . import dumps, loads
@@ -56,7 +56,7 @@ def recvbytes(self, bytes_needed, sock_b
part_count = len(chunk)
if type(chunk) == str:
- chunk = b(chunk)
+ chunk = chunk.encode('latin-1')
if part_count < 1:
return None
Index: bson-0.5.10/bson/tests/test_array.py
===================================================================
--- bson-0.5.10.orig/bson/tests/test_array.py
+++ bson-0.5.10/bson/tests/test_array.py
@@ -2,7 +2,6 @@
from unittest import TestCase
from bson import dumps, loads
-from six import PY3
class TestArray(TestCase):
@@ -74,5 +73,5 @@ class TestArray(TestCase):
def test_encoded_order(self):
serialized = dumps(self.doc)
- expected = repr(serialized)[1:] if PY3 else repr(serialized)
+ expected = repr(serialized)[1:]
self.assertEquals(expected, '\'\\xea\\x08\\x00\\x00\\x04lyrics\\x00\\xdd\\x08\\x00\\x00\\x020\\x00\\x14\\x00\\x00\\x00Viva La Vida lyrics\\x00\\x021\\x00\\x01\\x00\\x00\\x00\\x00\\x022\\x00!\\x00\\x00\\x00 I used to rule the world\\x00\\x023\\x00-\\x00\\x00\\x00 Seas would rise when I gave the word\\x00\\x024\\x00)\\x00\\x00\\x00 Now in the morning I sleep alone\\x00\\x025\\x00(\\x00\\x00\\x00 Sweep the streets I used to own\\x00\\x026\\x00\\x01\\x00\\x00\\x00\\x00\\x027\\x00 \\x00\\x00\\x00 I used to roll the dice\\x00\\x028\\x00)\\x00\\x00\\x00 Feel the fear in my enemy\\\'s eyes\\x00\\x029\\x00\\\'\\x00\\x00\\x00 Listen as the crowd would sing\\x00\\x0210\\x008\\x00\\x00\\x00 "Now the old king is dead! Long live the king!"\\x00\\x0211\\x00\\x01\\x00\\x00\\x00\\x00\\x0212\\x00"\\x00\\x00\\x00 One minute I held the key\\x00\\x0213\\x00)\\x00\\x00\\x00 Next the walls were closed on me\\x00\\x0214\\x00/\\x00\\x00\\x00 And I discovered that my castles stand\\x00\\x0215\\x001\\x00\\x00\\x00 Upon pillars of salt and pillars of sand\\x00\\x0216\\x00\\x01\\x00\\x00\\x00\\x00\\x0217\\x00)\\x00\\x00\\x00 I hear Jerusalem bells a ringing\\x00\\x0218\\x00)\\x00\\x00\\x00 Roman Cavalry choirs are singing\\x00\\x0219\\x00*\\x00\\x00\\x00 Be my mirror, my sword and shield\\x00\\x0220\\x00+\\x00\\x00\\x00 My missionaries in a foreign field\\x00\\x0221\\x00\\x01\\x00\\x00\\x00\\x00\\x0222\\x00(\\x00\\x00\\x00 For some reason I can\\\'t explain\\x00\\x0223\\x00$\\x00\\x00\\x00 Once you go there was never\\x00\\x0224\\x00\\x1d\\x00\\x00\\x00 Never an honest word\\x00\\x0225\\x00,\\x00\\x00\\x00 And that was when I ruled the world\\x00\\x0226\\x00\\x01\\x00\\x00\\x00\\x00\\x0227\\x00(\\x00\\x00\\x00 It was the wicked and wild wind\\x00\\x0228\\x00)\\x00\\x00\\x00 Blew down the doors to let me in\\x00\\x0229\\x001\\x00\\x00\\x00 Shattered windows and the sound of drums\\x00\\x0230\\x000\\x00\\x00\\x00 People couldn\\\'t believe what I\\\'d become\\x00\\x0231\\x00\\x01\\x00\\x00\\x00\\x00\\x0232\\x00\\x1d\\x00\\x00\\x00 Revolutionaries wait\\x00\\x0233\\x00&\\x00\\x00\\x00 For my head on a silver plate\\x00\\x0234\\x00)\\x00\\x00\\x00 Just a puppet on a lonely string\\x00\\x0235\\x00+\\x00\\x00\\x00 Oh who would ever want to be king?\\x00\\x0236\\x00\\x01\\x00\\x00\\x00\\x00\\x0237\\x00)\\x00\\x00\\x00 I hear Jerusalem bells a ringing\\x00\\x0238\\x00)\\x00\\x00\\x00 Roman Cavalry choirs are singing\\x00\\x0239\\x00*\\x00\\x00\\x00 Be my mirror, my sword and shield\\x00\\x0240\\x00+\\x00\\x00\\x00 My missionaries in a foreign field\\x00\\x0241\\x00\\x01\\x00\\x00\\x00\\x00\\x0242\\x00(\\x00\\x00\\x00 For some reason I can\\\'t explain\\x00\\x0243\\x00.\\x00\\x00\\x00 I know Saint Peter won\\\'t call my name\\x00\\x0244\\x00\\x1d\\x00\\x00\\x00 Never an honest word\\x00\\x0245\\x00,\\x00\\x00\\x00 But that was when I ruled the world\\x00\\x0246\\x00\\x01\\x00\\x00\\x00\\x00\\x0247\\x00)\\x00\\x00\\x00 I hear Jerusalem bells a ringing\\x00\\x0248\\x00)\\x00\\x00\\x00 Roman Cavalry choirs are singing\\x00\\x0249\\x00*\\x00\\x00\\x00 Be my mirror, my sword and shield\\x00\\x0250\\x00+\\x00\\x00\\x00 My missionaries in a foreign field\\x00\\x0251\\x00\\x01\\x00\\x00\\x00\\x00\\x0252\\x00(\\x00\\x00\\x00 For some reason I can\\\'t explain\\x00\\x0253\\x00.\\x00\\x00\\x00 I know Saint Peter won\\\'t call my name\\x00\\x0254\\x00\\x1d\\x00\\x00\\x00 Never an honest word\\x00\\x0255\\x00,\\x00\\x00\\x00 But that was when I ruled the world\\x00\\x00\\x00\'')
Index: bson-0.5.10/bson/tests/test_random_tree.py
===================================================================
--- bson-0.5.10.orig/bson/tests/test_random_tree.py
+++ bson-0.5.10/bson/tests/test_random_tree.py
@@ -3,9 +3,6 @@ from binascii import hexlify
from random import randint
from unittest import TestCase
-from six import text_type, PY3
-from six.moves import xrange
-
from bson import dumps, loads
@@ -13,10 +10,10 @@ def populate(parent, howmany, max_childr
if howmany > max_children:
children = randint(2, max_children)
distribution = []
- for _ in xrange(0, children - 1):
+ for _ in range(0, children - 1):
distribution.append(int(howmany / children))
distribution.append(howmany - sum(distribution, 0))
- for i in xrange(0, children):
+ for i in range(0, children):
steal_target = randint(0, children - 1)
while steal_target == i:
steal_target = randint(0, children -1)
@@ -25,7 +22,7 @@ def populate(parent, howmany, max_childr
distribution[i] += steal_count
distribution[steal_target] -= steal_count
- for i in xrange(0, children):
+ for i in range(0, children):
make_dict = randint(0, 1)
if make_dict:
baby = {}
@@ -34,8 +31,7 @@ def populate(parent, howmany, max_childr
populate(baby, distribution[i], max_children)
if isinstance(parent, dict):
key = os.urandom(8)
- key = "".join(chr(c) for c in hexlify(key)) \
- if PY3 else key.encode("hex")
+ key = "".join(chr(c) for c in hexlify(key))
parent[key] = baby
else:
parent.append(baby)
@@ -44,17 +40,15 @@ def populate(parent, howmany, max_childr
def populate_with_leaves(parent, howmany):
- for _ in xrange(0, howmany):
+ for _ in range(0, howmany):
leaf = os.urandom(4)
- leaf = "".join(chr(c) for c in hexlify(leaf)) \
- if PY3 else leaf.encode("hex")
+ leaf = "".join(chr(c) for c in hexlify(leaf))
make_unicode = randint(0, 1)
if make_unicode:
- leaf = text_type(leaf)
+ leaf = str(leaf)
if isinstance(parent, dict):
key = os.urandom(4)
- key = "".join(chr(c) for c in hexlify(key)) \
- if PY3 else key.encode("hex")
+ key = "".join(chr(c) for c in hexlify(key))
parent[key] = leaf
else:
parent.append(leaf)
@@ -62,7 +56,7 @@ def populate_with_leaves(parent, howmany
class TestRandomTree(TestCase):
def test_random_tree(self):
- for _ in xrange(0, 16):
+ for _ in range(0, 16):
p = {}
populate(p, 256, 4)
sp = dumps(p)
Index: bson-0.5.10/setup.py
===================================================================
--- bson-0.5.10.orig/setup.py
+++ bson-0.5.10/setup.py
@@ -27,7 +27,7 @@ setup(
name="bson",
version="0.5.10",
packages=["bson"],
- install_requires=["python-dateutil>=2.4.0", "six>=1.9.0"],
+ install_requires=["python-dateutil>=2.4.0"],
author="Ayun Park",
author_email="iamparkayun@gmail.com",
description="BSON codec for Python",
@@ -37,8 +37,6 @@ setup(
keywords="BSON codec",
url="http://github.com/py-bson/bson",
classifiers=[
- 'Programming Language :: Python :: 2.6',
- 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',

35
fix2038.patch Normal file
View File

@@ -0,0 +1,35 @@
Index: bson-0.5.8/bson/objectid.py
===================================================================
--- bson-0.5.8.orig/bson/objectid.py
+++ bson-0.5.8/bson/objectid.py
@@ -158,7 +158,7 @@ class ObjectId(object):
generation_time = generation_time - generation_time.utcoffset()
timestamp = calendar.timegm(generation_time.timetuple())
oid = struct.pack(
- ">i", int(timestamp)) + b"\x00\x00\x00\x00\x00\x00\x00\x00"
+ ">L", int(timestamp) & 0xFFFFFFFF) + b"\x00\x00\x00\x00\x00\x00\x00\x00"
return cls(oid)
@classmethod
@@ -184,7 +184,7 @@ class ObjectId(object):
"""
# 4 bytes current time
- oid = struct.pack(">i", int(time.time()))
+ oid = struct.pack(">L", int(time.time()) & 0xFFFFFFFF)
# 3 bytes machine
oid += ObjectId._machine_bytes
Index: bson-0.5.8/bson/tests/test_objectid.py
===================================================================
--- bson-0.5.8.orig/bson/tests/test_objectid.py
+++ bson-0.5.8/bson/tests/test_objectid.py
@@ -522,7 +522,7 @@ class TestObjectId(unittest.TestCase):
if 'PyPy 1.8.0' in sys.version:
# See https://bugs.pypy.org/issue1092
raise SkipTest("datetime.timedelta is broken in pypy 1.8.0")
- d = datetime.datetime.utcnow()
+ d = datetime.datetime.utcfromtimestamp(2000000000)
d = d - datetime.timedelta(microseconds=d.microsecond)
oid = ObjectId.from_datetime(d)
self.assertEqual(d, oid.generation_time.replace(tzinfo=None))

46
python-bson.changes Normal file
View File

@@ -0,0 +1,46 @@
-------------------------------------------------------------------
Tue Oct 28 05:29:28 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python314.patch:
* Support Python 3.14 removals.
-------------------------------------------------------------------
Thu Nov 14 20:23:54 UTC 2024 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add fix2038.patch to fix an issue with year 2038
-------------------------------------------------------------------
Fri Dec 29 13:44:20 UTC 2023 - Antonio Larrosa <alarrosa@suse.com>
- Use %{?sle15_python_module_pythons}
-------------------------------------------------------------------
Tue Dec 19 01:47:46 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python312.patch:
* Support Python 3.12 by using assertEqual.
- Switch to pyproject macros.
-------------------------------------------------------------------
Thu Nov 3 12:54:43 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Add drop-python2-support.patch to remote python-six dep gh#py-bson/bson#118
- Remove python_module macro definition
- More specific python_sitelib in %files
-------------------------------------------------------------------
Fri Sep 23 02:48:27 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
- Update to version v0.5.10
* Merge pull request #110 from yangroro/master
* Add python 3.9, 3.10-dev for testing
-------------------------------------------------------------------
Mon Aug 30 10:39:53 UTC 2021 - pgajdos@suse.com
- %check: use %pyunittest rpm macro
-------------------------------------------------------------------
Mon Apr 8 04:58:07 PM UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Initial spec for v0.5.8

68
python-bson.spec Normal file
View File

@@ -0,0 +1,68 @@
#
# spec file for package python-bson
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-bson
Version: 0.5.10
Release: 0
Summary: BSON codec for Python
License: Apache-2.0 AND BSD-3-Clause
URL: https://github.com/py-bson/bson
Source: https://github.com/py-bson/bson/archive/%{version}.tar.gz#/bson-%{version}.tar.gz
# PATCH-FIX-UPSTREAM drop-python2-support.patch gh#py-bson/bson#118
Patch0: drop-python2-support.patch
# PATCH-FIX-OPENSUSE Use assertEqual to support Python 3.12
Patch1: support-python312.patch
Patch2: fix2038.patch
Patch3: support-python314.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-python-dateutil >= 2.4.0
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module python-dateutil >= 2.4.0}
# /SECTION
%python_subpackages
%description
BSON codec for Python.
%prep
%autosetup -p1 -n bson-%{version}
sed -i '1 {/^#!/d}' bson/*.py
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pyunittest discover -v
%files %{python_files}
%doc README.rst
%license LICENSE LICENSE_APACHE
%{python_sitelib}/bson
%{python_sitelib}/bson-%{version}.dist-info
%changelog

26
support-python312.patch Normal file
View File

@@ -0,0 +1,26 @@
Index: bson-0.5.10/bson/tests/test_array.py
===================================================================
--- bson-0.5.10.orig/bson/tests/test_array.py
+++ bson-0.5.10/bson/tests/test_array.py
@@ -69,9 +69,9 @@ class TestArray(TestCase):
def test_long_array(self):
serialized = dumps(self.doc)
doc2 = loads(serialized)
- self.assertEquals(self.doc, doc2)
+ self.assertEqual(self.doc, doc2)
def test_encoded_order(self):
serialized = dumps(self.doc)
expected = repr(serialized)[1:]
- self.assertEquals(expected, '\'\\xea\\x08\\x00\\x00\\x04lyrics\\x00\\xdd\\x08\\x00\\x00\\x020\\x00\\x14\\x00\\x00\\x00Viva La Vida lyrics\\x00\\x021\\x00\\x01\\x00\\x00\\x00\\x00\\x022\\x00!\\x00\\x00\\x00 I used to rule the world\\x00\\x023\\x00-\\x00\\x00\\x00 Seas would rise when I gave the word\\x00\\x024\\x00)\\x00\\x00\\x00 Now in the morning I sleep alone\\x00\\x025\\x00(\\x00\\x00\\x00 Sweep the streets I used to own\\x00\\x026\\x00\\x01\\x00\\x00\\x00\\x00\\x027\\x00 \\x00\\x00\\x00 I used to roll the dice\\x00\\x028\\x00)\\x00\\x00\\x00 Feel the fear in my enemy\\\'s eyes\\x00\\x029\\x00\\\'\\x00\\x00\\x00 Listen as the crowd would sing\\x00\\x0210\\x008\\x00\\x00\\x00 "Now the old king is dead! Long live the king!"\\x00\\x0211\\x00\\x01\\x00\\x00\\x00\\x00\\x0212\\x00"\\x00\\x00\\x00 One minute I held the key\\x00\\x0213\\x00)\\x00\\x00\\x00 Next the walls were closed on me\\x00\\x0214\\x00/\\x00\\x00\\x00 And I discovered that my castles stand\\x00\\x0215\\x001\\x00\\x00\\x00 Upon pillars of salt and pillars of sand\\x00\\x0216\\x00\\x01\\x00\\x00\\x00\\x00\\x0217\\x00)\\x00\\x00\\x00 I hear Jerusalem bells a ringing\\x00\\x0218\\x00)\\x00\\x00\\x00 Roman Cavalry choirs are singing\\x00\\x0219\\x00*\\x00\\x00\\x00 Be my mirror, my sword and shield\\x00\\x0220\\x00+\\x00\\x00\\x00 My missionaries in a foreign field\\x00\\x0221\\x00\\x01\\x00\\x00\\x00\\x00\\x0222\\x00(\\x00\\x00\\x00 For some reason I can\\\'t explain\\x00\\x0223\\x00$\\x00\\x00\\x00 Once you go there was never\\x00\\x0224\\x00\\x1d\\x00\\x00\\x00 Never an honest word\\x00\\x0225\\x00,\\x00\\x00\\x00 And that was when I ruled the world\\x00\\x0226\\x00\\x01\\x00\\x00\\x00\\x00\\x0227\\x00(\\x00\\x00\\x00 It was the wicked and wild wind\\x00\\x0228\\x00)\\x00\\x00\\x00 Blew down the doors to let me in\\x00\\x0229\\x001\\x00\\x00\\x00 Shattered windows and the sound of drums\\x00\\x0230\\x000\\x00\\x00\\x00 People couldn\\\'t believe what I\\\'d become\\x00\\x0231\\x00\\x01\\x00\\x00\\x00\\x00\\x0232\\x00\\x1d\\x00\\x00\\x00 Revolutionaries wait\\x00\\x0233\\x00&\\x00\\x00\\x00 For my head on a silver plate\\x00\\x0234\\x00)\\x00\\x00\\x00 Just a puppet on a lonely string\\x00\\x0235\\x00+\\x00\\x00\\x00 Oh who would ever want to be king?\\x00\\x0236\\x00\\x01\\x00\\x00\\x00\\x00\\x0237\\x00)\\x00\\x00\\x00 I hear Jerusalem bells a ringing\\x00\\x0238\\x00)\\x00\\x00\\x00 Roman Cavalry choirs are singing\\x00\\x0239\\x00*\\x00\\x00\\x00 Be my mirror, my sword and shield\\x00\\x0240\\x00+\\x00\\x00\\x00 My missionaries in a foreign field\\x00\\x0241\\x00\\x01\\x00\\x00\\x00\\x00\\x0242\\x00(\\x00\\x00\\x00 For some reason I can\\\'t explain\\x00\\x0243\\x00.\\x00\\x00\\x00 I know Saint Peter won\\\'t call my name\\x00\\x0244\\x00\\x1d\\x00\\x00\\x00 Never an honest word\\x00\\x0245\\x00,\\x00\\x00\\x00 But that was when I ruled the world\\x00\\x0246\\x00\\x01\\x00\\x00\\x00\\x00\\x0247\\x00)\\x00\\x00\\x00 I hear Jerusalem bells a ringing\\x00\\x0248\\x00)\\x00\\x00\\x00 Roman Cavalry choirs are singing\\x00\\x0249\\x00*\\x00\\x00\\x00 Be my mirror, my sword and shield\\x00\\x0250\\x00+\\x00\\x00\\x00 My missionaries in a foreign field\\x00\\x0251\\x00\\x01\\x00\\x00\\x00\\x00\\x0252\\x00(\\x00\\x00\\x00 For some reason I can\\\'t explain\\x00\\x0253\\x00.\\x00\\x00\\x00 I know Saint Peter won\\\'t call my name\\x00\\x0254\\x00\\x1d\\x00\\x00\\x00 Never an honest word\\x00\\x0255\\x00,\\x00\\x00\\x00 But that was when I ruled the world\\x00\\x00\\x00\'')
+ self.assertEqual(expected, '\'\\xea\\x08\\x00\\x00\\x04lyrics\\x00\\xdd\\x08\\x00\\x00\\x020\\x00\\x14\\x00\\x00\\x00Viva La Vida lyrics\\x00\\x021\\x00\\x01\\x00\\x00\\x00\\x00\\x022\\x00!\\x00\\x00\\x00 I used to rule the world\\x00\\x023\\x00-\\x00\\x00\\x00 Seas would rise when I gave the word\\x00\\x024\\x00)\\x00\\x00\\x00 Now in the morning I sleep alone\\x00\\x025\\x00(\\x00\\x00\\x00 Sweep the streets I used to own\\x00\\x026\\x00\\x01\\x00\\x00\\x00\\x00\\x027\\x00 \\x00\\x00\\x00 I used to roll the dice\\x00\\x028\\x00)\\x00\\x00\\x00 Feel the fear in my enemy\\\'s eyes\\x00\\x029\\x00\\\'\\x00\\x00\\x00 Listen as the crowd would sing\\x00\\x0210\\x008\\x00\\x00\\x00 "Now the old king is dead! Long live the king!"\\x00\\x0211\\x00\\x01\\x00\\x00\\x00\\x00\\x0212\\x00"\\x00\\x00\\x00 One minute I held the key\\x00\\x0213\\x00)\\x00\\x00\\x00 Next the walls were closed on me\\x00\\x0214\\x00/\\x00\\x00\\x00 And I discovered that my castles stand\\x00\\x0215\\x001\\x00\\x00\\x00 Upon pillars of salt and pillars of sand\\x00\\x0216\\x00\\x01\\x00\\x00\\x00\\x00\\x0217\\x00)\\x00\\x00\\x00 I hear Jerusalem bells a ringing\\x00\\x0218\\x00)\\x00\\x00\\x00 Roman Cavalry choirs are singing\\x00\\x0219\\x00*\\x00\\x00\\x00 Be my mirror, my sword and shield\\x00\\x0220\\x00+\\x00\\x00\\x00 My missionaries in a foreign field\\x00\\x0221\\x00\\x01\\x00\\x00\\x00\\x00\\x0222\\x00(\\x00\\x00\\x00 For some reason I can\\\'t explain\\x00\\x0223\\x00$\\x00\\x00\\x00 Once you go there was never\\x00\\x0224\\x00\\x1d\\x00\\x00\\x00 Never an honest word\\x00\\x0225\\x00,\\x00\\x00\\x00 And that was when I ruled the world\\x00\\x0226\\x00\\x01\\x00\\x00\\x00\\x00\\x0227\\x00(\\x00\\x00\\x00 It was the wicked and wild wind\\x00\\x0228\\x00)\\x00\\x00\\x00 Blew down the doors to let me in\\x00\\x0229\\x001\\x00\\x00\\x00 Shattered windows and the sound of drums\\x00\\x0230\\x000\\x00\\x00\\x00 People couldn\\\'t believe what I\\\'d become\\x00\\x0231\\x00\\x01\\x00\\x00\\x00\\x00\\x0232\\x00\\x1d\\x00\\x00\\x00 Revolutionaries wait\\x00\\x0233\\x00&\\x00\\x00\\x00 For my head on a silver plate\\x00\\x0234\\x00)\\x00\\x00\\x00 Just a puppet on a lonely string\\x00\\x0235\\x00+\\x00\\x00\\x00 Oh who would ever want to be king?\\x00\\x0236\\x00\\x01\\x00\\x00\\x00\\x00\\x0237\\x00)\\x00\\x00\\x00 I hear Jerusalem bells a ringing\\x00\\x0238\\x00)\\x00\\x00\\x00 Roman Cavalry choirs are singing\\x00\\x0239\\x00*\\x00\\x00\\x00 Be my mirror, my sword and shield\\x00\\x0240\\x00+\\x00\\x00\\x00 My missionaries in a foreign field\\x00\\x0241\\x00\\x01\\x00\\x00\\x00\\x00\\x0242\\x00(\\x00\\x00\\x00 For some reason I can\\\'t explain\\x00\\x0243\\x00.\\x00\\x00\\x00 I know Saint Peter won\\\'t call my name\\x00\\x0244\\x00\\x1d\\x00\\x00\\x00 Never an honest word\\x00\\x0245\\x00,\\x00\\x00\\x00 But that was when I ruled the world\\x00\\x0246\\x00\\x01\\x00\\x00\\x00\\x00\\x0247\\x00)\\x00\\x00\\x00 I hear Jerusalem bells a ringing\\x00\\x0248\\x00)\\x00\\x00\\x00 Roman Cavalry choirs are singing\\x00\\x0249\\x00*\\x00\\x00\\x00 Be my mirror, my sword and shield\\x00\\x0250\\x00+\\x00\\x00\\x00 My missionaries in a foreign field\\x00\\x0251\\x00\\x01\\x00\\x00\\x00\\x00\\x0252\\x00(\\x00\\x00\\x00 For some reason I can\\\'t explain\\x00\\x0253\\x00.\\x00\\x00\\x00 I know Saint Peter won\\\'t call my name\\x00\\x0254\\x00\\x1d\\x00\\x00\\x00 Never an honest word\\x00\\x0255\\x00,\\x00\\x00\\x00 But that was when I ruled the world\\x00\\x00\\x00\'')
Index: bson-0.5.10/bson/tests/test_random_tree.py
===================================================================
--- bson-0.5.10.orig/bson/tests/test_random_tree.py
+++ bson-0.5.10/bson/tests/test_random_tree.py
@@ -61,4 +61,4 @@ class TestRandomTree(TestCase):
populate(p, 256, 4)
sp = dumps(p)
p2 = loads(sp)
- self.assertEquals(p, p2)
+ self.assertEqual(p, p2)

22
support-python314.patch Normal file
View File

@@ -0,0 +1,22 @@
Index: bson-0.5.10/setup.py
===================================================================
--- bson-0.5.10.orig/setup.py
+++ bson-0.5.10/setup.py
@@ -4,7 +4,7 @@
# Copyright (c) 2015, Ayun Park. All rights reserved.
# For licensing, see LICENSE file included in the package.
import sys
-import pkgutil
+import importlib.util
from setuptools import setup
from setuptools.command.install import install
@@ -13,7 +13,7 @@ class NewInstall(install):
@staticmethod
def check_pymongo():
- if pkgutil.find_loader('pymongo'):
+ if importlib.util.find_spec('pymongo'):
return True
return False