Commit 864c720e authored by qubitnano's avatar qubitnano
Browse files

mongodb: fix building with python312

parent a9a40a5e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ buildMongoDB {
    ./forget-build-dependencies-4-4.patch
    ./asio-no-experimental-string-view-4-4.patch
    ./fix-gcc-Wno-exceptions-5.0.patch
    # Fix building with python 3.12 since the imp module was removed
    ./mongodb-python312.patch
  ] ++ variants.patches;
  passthru.tests = { inherit (nixosTests) mongodb; };
}
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@ buildMongoDB {
      url = "https://github.com/mongodb/mongo/commit/5435f9585f857f6145beaf6d31daf336453ba86f.patch";
      sha256 = "sha256-gWlE2b/NyGe2243iNCXzjcERIY8/4ZWI4Gjh5SF0tYA=";
    })

    # Fix building with python 3.12 since the imp module was removed
    ./mongodb-python312.patch
  ];
  # passthru.tests = { inherit (nixosTests) mongodb; }; # currently tests mongodb-5_0
}
+22 −0
Original line number Diff line number Diff line
diff --git a/buildscripts/moduleconfig.py b/buildscripts/moduleconfig.py
index b4d0bba0490..f59ddd7bc5c 100644
--- a/buildscripts/moduleconfig.py
+++ b/buildscripts/moduleconfig.py
@@ -27,7 +27,7 @@ MongoDB SConscript files do.
 __all__ = ('discover_modules', 'discover_module_directories', 'configure_modules',
            'register_module_test')  # pylint: disable=undefined-all-variable
 
-import imp
+import importlib
 import inspect
 import os
 
@@ -71,7 +71,7 @@ def discover_modules(module_root, allowed_modules):
             print("adding module: %s" % (name))
             fp = open(build_py, "r")
             try:
-                module = imp.load_module("module_" + name, fp, build_py,
+                module = importlib.load_module("module_" + name, fp, build_py,
                                          (".py", "r", imp.PY_SOURCE))
                 if getattr(module, "name", None) is None:
                     module.name = name
+2 −2
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
, openldap
, openssl
, libpcap
, python311Packages
, curl
, Security
, CoreFoundation
@@ -32,12 +31,13 @@
}:

let
  scons = buildPackages.scons.override{ python3Packages = python311Packages; };
  scons = buildPackages.scons;
  python = scons.python.withPackages (ps: with ps; [
    pyyaml
    cheetah3
    psutil
    setuptools
    distutils
  ] ++ lib.optionals (lib.versionAtLeast version "6.0") [
    packaging
    pymongo