[Scons-dev] MacPorts vs Homebrew on MacOS

Bill Deegan bill at baddogconsulting.com
Sun Jun 18 12:49:43 EDT 2017


Rob,

Also I extended the logic as follows (in default branch currently, but not
in prior releases)

def generate(env):
    posix.generate(env)
    env['SHLIBSUFFIX'] = '.dylib'
    # put macports paths at front to override Apple's versions, fink
path is after
    # For now let people who want Macports or Fink tools specify it!
    # env['ENV']['PATH'] = '/opt/local/bin:/opt/local/sbin:' +
env['ENV']['PATH'] + ':/sw/bin'

    # Store extra system paths in env['ENV']['PATHOSX']

    filelist = ['/etc/paths',]
    # make sure this works on Macs with Tiger or earlier
    try:
        dirlist = os.listdir('/etc/paths.d')
    except:
        dirlist = []

    for file in dirlist:
        filelist.append('/etc/paths.d/'+file)

    for file in filelist:
        if os.path.isfile(file):
            f = open(file, 'r')
            lines = f.readlines()
            for line in lines:
                if line:
                    env.AppendENVPath('PATHOSX', line.strip('\n'))
            f.close()



*    # Not sure why this wasn't the case all along?    if
env['ENV'].get('PATHOSX', False) and
os.environ.get('SCONS_USE_MAC_PATHS', False):
env.AppendENVPath('PATH',env['ENV']['PATHOSX'])*

previously it would process /etc/paths.d but then not use them, now I've
added an environment variable:
SCONS_USE_MAC_PATHS

To enable using the paths in /etc/paths.d.  The code in red is the new
code..

Since one of SCons's goals is to prevent differences in machine or user
PATH or other environment from producing a different build without explicit
user or build script instruction, defaulting to off seems to be correct.

Though perhaps I should also allow setting this variable in Environment()?

-Bill




On Sun, Jun 18, 2017 at 11:13 AM, Managan, Rob <managan1 at llnl.gov> wrote:

> Going from memory here so I may get this slightly wrong.
> On OSX back in those versions I learned that the way the Latex
> installation was done was not in a standard directory but works since OSX
> adds directories to the standard that are in the file /etc/paths.d and also
> in files in /etc/paths/ .  We extended the darwin.py initialization routine
> to add these directories to the ones searched. Not sure if Detect uses
> those but pretty sure exists() does.
>
> Hope this helps
> Rob Managan
>
> Sent from my iPad
>
> > On Jun 17, 2017, at 6:53 AM, Russel Winder <russel at winder.org.uk> wrote:
> >
> > Well technically OSX since my MBP is still on El Capitan as Apple will
> > not upgrade it.
> >
> > Homebrew puts all it's stuff into (effectively) /usr/local.
> >
> > MacPorts puts all its stuff (definitely) into /opt/local.
> >
> > env.Detect() searches in /usr/local but not in /opt/local. SCons thus
> > discrimiates for Homebrew and against MacPorts. Is this acceptable?
> >
> > --
> > Russel.
> > ============================================================
> =================
> > Dr Russel Winder      t: +44 20 7585 2200   voip:
> sip:russel.winder at ekiga.net
> > 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
> > London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
> > _______________________________________________
> > Scons-dev mailing list
> > Scons-dev at scons.org
> > https://pairlist2.pair.net/mailman/listinfo/scons-dev
> _______________________________________________
> Scons-dev mailing list
> Scons-dev at scons.org
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20170618/6c33e616/attachment.html>


More information about the Scons-dev mailing list