diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..f087b429e2f81a9f37b28a8308e2210f84df6c9b --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.tar.gz filter=lfs diff=lfs merge=lfs -text diff --git a/.lfsconfig b/.lfsconfig new file mode 100644 index 0000000000000000000000000000000000000000..b8c6b904cd2180db529bb048de65db4ae961f158 --- /dev/null +++ b/.lfsconfig @@ -0,0 +1,2 @@ +[lfs] + url = https://artlfs.openeuler.openatom.cn/src-openEuler/python-pymongo diff --git a/Fix-environmental-differences-leads-to-assertion-failure.patch b/Fix-environmental-differences-leads-to-assertion-failure.patch new file mode 100644 index 0000000000000000000000000000000000000000..7fd2ac3f9fa01a2d63878b26bbd367f35827e0fd --- /dev/null +++ b/Fix-environmental-differences-leads-to-assertion-failure.patch @@ -0,0 +1,160 @@ +diff -Nur a/test/asynchronous/test_client.py b/test/asynchronous/test_client.py +--- a/test/asynchronous/test_client.py 2025-07-10 11:24:31.285600257 +0800 ++++ b/test/asynchronous/test_client.py 2025-07-10 11:24:47.128600257 +0800 +@@ -348,10 +348,14 @@ + metadata["application"] = {"name": "foobar"} + client = self.simple_client("mongodb://foo:27017/?appname=foobar&connect=false") + options = client.options +- self.assertEqual(options.pool_options.metadata, metadata) ++ actual_metadata1 = options.pool_options.metadata.copy() ++ actual_metadata1.pop('env', None) ++ self.assertEqual(actual_metadata1, metadata) + client = self.simple_client("foo", 27017, appname="foobar", connect=False) + options = client.options +- self.assertEqual(options.pool_options.metadata, metadata) ++ actual_metadata2 = options.pool_options.metadata.copy() ++ actual_metadata2.pop('env', None) ++ self.assertEqual(actual_metadata2, metadata) + # No error + self.simple_client(appname="x" * 128) + with self.assertRaises(ValueError): +@@ -380,7 +384,9 @@ + connect=False, + ) + options = client.options +- self.assertEqual(options.pool_options.metadata, metadata) ++ actual_metadata3 = options.pool_options.metadata.copy() ++ actual_metadata3.pop('env', None) ++ self.assertEqual(actual_metadata3, metadata) + metadata["platform"] = "{}|FooPlatform".format(_METADATA["platform"]) + client = self.simple_client( + "foo", +@@ -390,15 +396,19 @@ + connect=False, + ) + options = client.options +- self.assertEqual(options.pool_options.metadata, metadata) ++ actual_metadata4 = options.pool_options.metadata.copy() ++ actual_metadata4.pop('env', None) ++ self.assertEqual(actual_metadata4, metadata) + # Test truncating driver info metadata. + client = self.simple_client( + driver=DriverInfo(name="s" * _MAX_METADATA_SIZE), + connect=False, + ) + options = client.options ++ actual_metadata5 = options.pool_options.metadata.copy() ++ actual_metadata5.pop('env', None) + self.assertLessEqual( +- len(bson.encode(options.pool_options.metadata)), ++ len(bson.encode(actual_metadata5)), + _MAX_METADATA_SIZE, + ) + client = self.simple_client( +@@ -406,8 +416,10 @@ + connect=False, + ) + options = client.options ++ actual_metadata6 = options.pool_options.metadata.copy() ++ actual_metadata6.pop('env', None) + self.assertLessEqual( +- len(bson.encode(options.pool_options.metadata)), ++ len(bson.encode(actual_metadata6)), + _MAX_METADATA_SIZE, + ) + +@@ -415,8 +427,12 @@ + def test_container_metadata(self): + metadata = copy.deepcopy(_METADATA) + metadata["driver"]["name"] = "PyMongo|async" +- metadata["env"] = {} +- metadata["env"]["container"] = {"orchestrator": "kubernetes"} ++ metadata["env"] = { ++ "container": { ++ "orchestrator": "kubernetes", ++ "runtime": "docker" ++ } ++ } + client = self.simple_client("mongodb://foo:27017/?appname=foobar&connect=false") + options = client.options + self.assertEqual(options.pool_options.metadata["env"], metadata["env"]) +diff -Nur a/test/test_client.py b/test/test_client.py +--- a/test/test_client.py 2025-07-10 11:24:31.282600257 +0800 ++++ b/test/test_client.py 2025-07-10 11:24:47.129600257 +0800 +@@ -341,10 +341,14 @@ + metadata["application"] = {"name": "foobar"} + client = self.simple_client("mongodb://foo:27017/?appname=foobar&connect=false") + options = client.options +- self.assertEqual(options.pool_options.metadata, metadata) ++ actual_metadata1 = options.pool_options.metadata.copy() ++ actual_metadata1.pop('env', None) ++ self.assertEqual(actual_metadata1, metadata) + client = self.simple_client("foo", 27017, appname="foobar", connect=False) + options = client.options +- self.assertEqual(options.pool_options.metadata, metadata) ++ actual_metadata2 = options.pool_options.metadata.copy() ++ actual_metadata2.pop('env', None) ++ self.assertEqual(actual_metadata2, metadata) + # No error + self.simple_client(appname="x" * 128) + with self.assertRaises(ValueError): +@@ -373,7 +377,9 @@ + connect=False, + ) + options = client.options +- self.assertEqual(options.pool_options.metadata, metadata) ++ actual_metadata3 = options.pool_options.metadata.copy() ++ actual_metadata3.pop('env', None) ++ self.assertEqual(actual_metadata3, metadata) + metadata["platform"] = "{}|FooPlatform".format(_METADATA["platform"]) + client = self.simple_client( + "foo", +@@ -383,15 +389,19 @@ + connect=False, + ) + options = client.options +- self.assertEqual(options.pool_options.metadata, metadata) ++ actual_metadata4 = options.pool_options.metadata.copy() ++ actual_metadata4.pop('env', None) ++ self.assertEqual(actual_metadata4, metadata) + # Test truncating driver info metadata. + client = self.simple_client( + driver=DriverInfo(name="s" * _MAX_METADATA_SIZE), + connect=False, + ) + options = client.options ++ actual_metadata5 = options.pool_options.metadata.copy() ++ actual_metadata5.pop('env', None) + self.assertLessEqual( +- len(bson.encode(options.pool_options.metadata)), ++ len(bson.encode(actual_metadata5)), + _MAX_METADATA_SIZE, + ) + client = self.simple_client( +@@ -399,8 +409,11 @@ + connect=False, + ) + options = client.options ++ actual_metadata6 = options.pool_options.metadata.copy() ++ actual_metadata6.pop('env', None) + self.assertLessEqual( + len(bson.encode(options.pool_options.metadata)), ++ len(bson.encode(actual_metadata6)), + _MAX_METADATA_SIZE, + ) + +@@ -408,8 +421,12 @@ + def test_container_metadata(self): + metadata = copy.deepcopy(_METADATA) + metadata["driver"]["name"] = "PyMongo" +- metadata["env"] = {} +- metadata["env"]["container"] = {"orchestrator": "kubernetes"} ++ metadata["env"] = { ++ "container": { ++ "orchestrator": "kubernetes", ++ "runtime": "docker" ++ } ++ } + client = self.simple_client("mongodb://foo:27017/?appname=foobar&connect=false") + options = client.options + self.assertEqual(options.pool_options.metadata["env"], metadata["env"]) diff --git a/pymongo-4.13.2.tar.gz b/pymongo-4.13.2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..fe9c382906ad770841fb5e43140bc3fa64fc3673 --- /dev/null +++ b/pymongo-4.13.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f64c6469c2362962e6ce97258ae1391abba1566a953a492562d2924b44815c2 +size 2167844 diff --git a/pymongo-4.7.3.tar.gz b/pymongo-4.7.3.tar.gz deleted file mode 100644 index ac63d7107cbbb3f4240f24adb5a53f730be0d6db..0000000000000000000000000000000000000000 Binary files a/pymongo-4.7.3.tar.gz and /dev/null differ diff --git a/python-pymongo.spec b/python-pymongo.spec index fae51d3c1e0eb613a9f221946b42dd61a1045a2f..e18b7e3e66f74b8a0175d39fc64d84560d3976d8 100644 --- a/python-pymongo.spec +++ b/python-pymongo.spec @@ -1,14 +1,17 @@ Name: python-pymongo -Version: 4.7.3 +Version: 4.13.2 Release: 1 -License: Apache License 2.0 +License: Apache-2.0 Summary: PyMongo - the Python driver for MongoDB URL: https://github.com/mongodb/mongo-python-driver Source0: %{pypi_source pymongo} +Patch0: Fix-environmental-differences-leads-to-assertion-failure.patch BuildRequires: python3-devel python3-setuptools BuildRequires: python3-sphinx gcc python3-pip python3-dns BuildRequires: python3-pytest +BuildRequires: python3-hatchling python3-hatch-requirements-txt +BuildRequires: python3-pytest-asyncio %global _description \ The PyMongo distribution contains tools for interacting with \ @@ -53,19 +56,16 @@ The PyMongo distribution contains tools for interacting with MongoDB database fr %autosetup -n pymongo-%{version} -p1 %build -%py3_build +%pyproject_build %install -%py3_install +%pyproject_install chmod 755 %{buildroot}%{python3_sitearch}/bson/*.so chmod 755 %{buildroot}%{python3_sitearch}/pymongo/*.so %check -sed -i '$!N;/test_detected_environment_warning/!P;D' test/test_client.py -sed -i '/with self._caplog.at_level/,+18 d' test/test_client.py -sed -i '/test_metadata/,+49 d' test/test_client.py -python3 -m unittest discover -v +%pytest %files -n python3-bson %license LICENSE @@ -76,7 +76,7 @@ python3 -m unittest discover -v %license LICENSE %doc README.md %{python3_sitearch}/pymongo -%{python3_sitearch}/pymongo-%{version}-*.egg-info +%{python3_sitearch}/pymongo-%{version}.dist-info %files -n python3-pymongo-gridfs %{python3_sitearch}/gridfs @@ -85,6 +85,15 @@ python3 -m unittest discover -v %{_docdir}/python3-pymongo %changelog +* Wed Jul 09 2025 yaoxin <1024769339@qq.com> - 4.13.2-1 +- Update to 4.13.2: + * Fixed a bug where AsyncMongoClient would block the event loop while creating new connections, + potentially significantly increasing latency for ongoing operations. + * Fixed a bug that resulted in confusing error messages after hostname verification errors when using PyOpenSSL. + * Fixed a bug that could raise ServerSelectionTimeoutError when using timeouts with AsyncMongoClient. + * Fixed a bug that could raise NetworkTimeout errors on Windows. + * Fixed a bug where pymongo.write_concern.WriteConcern repr was not eval-able when using w="majority". + * Wed Apr 23 2025 Ge Wang - 4.7.3-1 - Update to 4.7.3