1. pygame
  2. pygame
  3. pygame
  4. Pull requests

Pull requests

#9 Merged

Ensure local directories are specified last for precedence for Unix

  1. David Beitey

When installing pygame under Linux, I was attempting to specify a local library base using the LOCALBASE environment variable (which translates to the 'localbase' variable here). As the local directories get specified first before system directories, when dependencies are searched for, system libraries thus override a local libraries.

I feel this should be the other way around as if one is using a locally installed library, then they are wanting to use a specific version (eg a newer version, or something specific etc).

Comments (4)

  1. René Dudfield

    That does sound like a reasonable argument to me...

    However, in the previous code the local ones will be first in the list, followed by the other ones. This seems to make sense to me, in that the local ones will be used first if they exist, and not used if they are not. This is because they will be listed first in the list. So, if someone installs local libraries they will be used first.

    I need actually check this, because this is just from memory...

  2. David Beitey author

    Yes, the original code puts the local ones first in the list, but the configure process for dependencies leads to the last entry in the directory list being used due to the way directories are looped over:

    https://bitbucket.org/pygame/pygame/src/4a461123902123d8b9309b3841bb63520c09761b/config_unix.py?at=default#cl-96 https://bitbucket.org/pygame/pygame/src/4a461123902123d8b9309b3841bb63520c09761b/config_unix.py?at=default#cl-101

    Effectively, the loops go through all directories, and if the directory exists/passes the checks, then is set as the relevant option. However, the loop continues for each and every directory, so even though a local directory is first in the list, if a later system-level directory is present (in my case several were), then this is used instead.

    My answer to this probably isn't the best, but it was trying to avoid being invasive in the configuration code. The other potential solution I see now is to add a break to those loops mentioned when the first directory is found, thus using the first one in the list. This would produce the same result - using the local libraries - but do it in a more efficient manner as the loop stops on the first directory found.

  3. Thomas Kluyver

    If it's supposed to be the first one found, then adding break in those loops would probably do the trick.

    On the other hand, it looks like /usr/local goes after /usr in the list, and from what I know, it seems like /usr/local should take precedence out of those two. I'm not sure what order the components defined here should go in.