You are not logged in.

#1 Yesterday 09:12:07

drankinatty
Member
From: Nacogdoches, Texas
Registered: 2009-04-24
Posts: 105
Website

Update broke scons build: ModuleNotFoundError: No module pkg_resources

All,

  I'm stuck on the update for the AUR mongodb44 package after the last update. I suspected a simple rebuild would be all that was needed as there were no breaking changes from boost 1.92 apparent in the package, but a rebuild would be required to pull in the new .so version.

  However I ran head-long into a scons/python problem that prevents the build from starting due to not finding a needed module using the old pkg_resources syntax. I am not a python programmer and scons is a bit like witchcraft, so I'm a bit stuck. The build error is:

==> Starting build()...
scons: Reading SConscript files ...
ModuleNotFoundError: No module named 'pkg_resources':
  File "/build/mongodb44/src/mongo-r4.4.29/SConstruct", line 19:
    from pkg_resources import parse_version
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Build failed, check /home/david/arch/pkg/chroot/david/build

  Okay, great, the line complained about is attempting to pull in a parse_version module:

from pkg_resources import parse_version

  That looks pretty simple, but the pkg_resources Migration Guide isn't quite verbose enough to get me over the hump. How do I implement a replacement for the code above so it works with the new pkg_resources.parse_version (or the like). I know this wants to accomplish the pkg_resources.parse_version (I think), but how do you translate from old to new?

  Something to point me in the right direction would be greatly appreciated.


David C. Rankin, J.D.,P.E.

Offline

#2 Yesterday 21:12:52

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,350

Re: Update broke scons build: ModuleNotFoundError: No module pkg_resources

It seems there is a 4.4.31 release, have you tried that one ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 Yesterday 23:07:55

loqs
Member
Registered: 2014-03-06
Posts: 19,015

Re: Update broke scons build: ModuleNotFoundError: No module pkg_resources

diff --git a/SConstruct b/SConstruct
index b65c61dc..c262a31a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -16,7 +16,7 @@ import textwrap
 import uuid
 from glob import glob
 
-from pkg_resources import parse_version
+from packaging.version import parse as parse_version
 
 import SCons
 
diff --git a/buildscripts/linter/runner.py b/buildscripts/linter/runner.py
index 623a3c42..33649e42 100644
--- a/buildscripts/linter/runner.py
+++ b/buildscripts/linter/runner.py
@@ -10,7 +10,7 @@ import site
 import subprocess
 import sys
 import threading
-import pkg_resources
+import packaging.version
 
 from . import base
 
@@ -33,7 +33,7 @@ def _check_version(linter, cmd_path, args):
                 decoded_output, stderr)
 
         pattern = r"\b(?:(%s) )?(?P<version>\S+)\b" % (linter.cmd_name)
-        required_version = pkg_resources.parse_version(linter.required_version)
+        required_version = packaging.version.parse(linter.required_version)
 
         match = re.search(pattern, decoded_output)
         if match:
@@ -41,7 +41,7 @@ def _check_version(linter, cmd_path, args):
         else:
             found_version = '0.0'
 
-        if pkg_resources.parse_version(found_version) < required_version:
+        if packaging.version.parse(found_version) < required_version:
             logging.info(
                 "Linter %s has wrong version for '%s'. Expected >= '%s',"
                 "Standard Output:\n'%s'\nStandard Error:\n%s", linter.cmd_name, cmd,
diff --git a/site_scons/site_tools/ccache.py b/site_scons/site_tools/ccache.py
index 2a894919..227f992b 100644
--- a/site_scons/site_tools/ccache.py
+++ b/site_scons/site_tools/ccache.py
@@ -26,7 +26,7 @@ import re
 import subprocess
 
 import SCons
-from pkg_resources import parse_version
+from packaging.version import parse as parse_version
 
 # This is the oldest version of ccache that offers support for -gsplit-dwarf
 _ccache_version_min = parse_version("3.2.3")
diff --git a/site_scons/site_tools/icecream.py b/site_scons/site_tools/icecream.py
index f9e436eb..df612f2a 100644
--- a/site_scons/site_tools/icecream.py
+++ b/site_scons/site_tools/icecream.py
@@ -25,7 +25,7 @@ import re
 import subprocess
 import urllib
 
-from pkg_resources import parse_version
+from packaging.version import parse as parse_version
 
 import SCons
 

Last edited by loqs (Yesterday 23:18:28)

Offline

Board footer

Powered by FluxBB