[Scons-users] scons 'v fails

Mats Wichmann mats at wichmann.us
Wed Mar 6 09:44:17 EST 2024


On 3/5/24 00:31, daggs via Scons-users wrote:
> pkg mgr, other users on the system use the same version without any issues
> 
> $ python -V
> Python 3.9.18
 >
 > rhel 9.3, kernel 5.14.0-362.18.1.el9_3.x86_64
 >
 > any other info needed?

Matches what I've got on Rocky/Alma, down to the kernel micro level 
(5.14.0-362.18.1.el9_3.0.1.x86_64).

> I've encountered a user on one of our systems where scons -v fails.
> this is the output:
> $ scons -v
> Traceback (most recent call last):
>      File "/usr/bin/scons", line 33, in <module>
>        sys.exit(load_entry_point('SCons==4.5.2', 'console_scripts', 'scons')())
>      File "/usr/bin/scons", line 25, in importlib_load_entry_point
>        return next(matches).load()
> StopIteration
>
> any ideas what can cause it?

If anyone else wants to think about it, here's the thing that gets 
installed as the scons command from Red Hat / Fedora packaging. Which, I 
checked, is identical to the one produced in current Debian / Ubuntu 
packaging (note this isn't a file from the SCons project itself, it's 
generated during packaging).

Not quite sure how this can break, especially for one user only. It 
basically means the generator expression had no results:

     matches = (
         entry_point
         for entry_point in distribution(dist_name).entry_points
         if entry_point.group == group and entry_point.name == name
     )
     return next(matches).load()

the values are the ones repeated in the early comment 
EASY-INSTALL-ENTRY-SCRIPT, so while it must have found a match for 
SCons==4.5.2 (or it would take a different exception), then group 
('console_scripts') and/or name ('scons') don't match.

*Maybe* check for whether that user has a "user" install of scons that's 
causing confusion.
A package installed with pip --user would end up in

~/.local/lib/python3.9/site-packages

Anybody else have any ideas?

====
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'SCons==4.5.2','console_scripts','scons'
import re
import sys

# for compatibility with easy_install; see #2198
__requires__ = 'SCons==4.5.2'

try:
     from importlib.metadata import distribution
except ImportError:
     try:
         from importlib_metadata import distribution
     except ImportError:
         from pkg_resources import load_entry_point


def importlib_load_entry_point(spec, group, name):
     dist_name, _, _ = spec.partition('==')
     matches = (
         entry_point
         for entry_point in distribution(dist_name).entry_points
         if entry_point.group == group and entry_point.name == name
     )
     return next(matches).load()


globals().setdefault('load_entry_point', importlib_load_entry_point)


if __name__ == '__main__':
     sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
     sys.exit(load_entry_point('SCons==4.5.2', 'console_scripts', 
'scons')())




More information about the Scons-users mailing list