[Scons-users] "pip install scons" result in a broken installation that is unusable

Mats Wichmann mats at wichmann.us
Thu Oct 11 13:37:22 EDT 2018


On 10/11/2018 10:37 AM, Mats Wichmann wrote:
> On 10/11/2018 10:19 AM, Bill Deegan wrote:
>> It should work with recent pip.
>> Let me take a look today.
>> -Bill
> 
> IMO, some of the paths are ready as they are and should not be joined
> with further bits. a little reorg is needed there.

to be a little less cryptic, it seems that the very first place a path
could be added to prefs is here:

# - running from egg check
try:
    import pkg_resources
except ImportError:
    pass
else:
    # when running from an egg add the egg's directory
    try:
        d = pkg_resources.get_distribution('scons')
    except pkg_resources.DistributionNotFound:
        pass
    else:
        prefs.append(d.location)

This stanza succeeds on all kinds of installations, "running from egg"
does not seem precise; whatever get_distribution looks for is found both
in Linux distro packages and pip installed locations.  This gives you
back a path that does not want 'lib' or 'lib/pythonX.Y/site-packages'
appended. For example for a particular virtualenv that has pip-install'd
scons, that stanza yields:

/home/mats/.virtualenvs/py27+scons/lib/python2.7

Further down, after the appending that happens in the two list
comprehensions to all the paths in prefs, that expanded to these two:

/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/python2.7/site-packages

which are throwaways, engine will never be found in those after they are
expanded to these four locations on the final round:

/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/scons-3.0.1
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/python2.7/site-packages/scons-3.0.1
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/scons
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/python2.7/site-packages/scons

there is no site-packages/lib and definitely no
site-packages/lib/.../site-packages - really this is the problem Samuel
is seeing.

What we really wanted to generate from that original first path was:

/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/scons-3.0.1
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/scons



More information about the Scons-users mailing list