diff --git a/ShellB3/sbin/re-l b/ShellB3/sbin/re-l
new file mode 100755
index 0000000000000000000000000000000000000000..884a5a631a3ee8735ddd81a5823d7e7a64a59be5
--- /dev/null
+++ b/ShellB3/sbin/re-l
@@ -0,0 +1,108 @@
+#!/usr/bin/env python
+
+# used in a script with shebang in 1 of 2 ways
+# #!/path/to/re-l relative_interpreter
+# #!/usr/bin/env re-l relative_interpreter
+# the latter requires support for more than 1 parameter to the intpreter (not on linux)
+#
+# will set SCRIPT_FILE and SCRIPT_PATH
+# example:
+# #!/usr/local/bin/re-l python
+# or, going with the form that just requires re-l be in the path
+# #!/usr/bin/env re-l python
+#
+# these assume the script is in the same folder as the python interpreter. other deeper locations are also valid, like:
+# #!/usr/bin/env re-l ../Resources/Python.app/Contents/MacOS/Python
+#
+# Many systems only allow 1 parameter with Shebang. On these systems, re-l
+# must be installed in a standard location, then the following syntax can be used
+# and it will use the interpreter re-lative to the script's path
+# #!/usr/bin/re-l python
+#
+# Alternatively, re-l can be used in a proprietary way as follows:
+# #!/usr/bin/env re-l
+# #:python
+#
+#
+#Created by jpgarcia.
+#Copyright (c) 2015-2017 University of Wisconsin SSEC. All rights reserved.
+#
+
+import os,sys
+import logging
+LOG = logging.debug
+PY2 = sys.version_info[0] == 2
+if not PY2:
+    ropenmode="r"
+    openkwargs=dict(newline=None,encoding="utf-8")
+else:
+    ropenmode="rU"
+    openkwargs=dict()
+
+def getLine(f,linenumber=1):#returns native string (ascii or unicode)
+    if not os.path.exists(f):
+        return None
+    fil=open(f,mode=ropenmode,**openkwargs)
+    v=''
+    for x in range(linenumber):
+        try:
+            v=fil.readline(512).strip()
+        except UnicodeDecodeError:
+            v=''
+    return v
+
+#deterimine if the script is a single-parameter env-based script file
+def isRelScript(filepath):
+    return getLine(filepath,linenumber=1)=='#!/usr/bin/env re-l'
+
+#extract the interpreter from a scriptfile
+def extractRelInterpreter(filepath):
+    if not isRelScript(filepath):
+        raise RuntimeError("Not a re-l script!")
+    for line in range(2,5):
+        l=getLine(filepath,linenumber=line)
+        if l.startswith('#re-l:') or l.startswith('#:'):
+            return l.split(':',1)[1].strip()
+    raise RuntimeError("Couldn't find re-lative interpreter line (starts with '#re-l:')")
+
+#executes a scriptfile using a relative interpreter with given commandline args
+def relexec(scriptrelativeinterpreter,scriptfile,*_args):
+    args=[None,None]+list(_args)
+    LOG('%s %s' % (scriptrelativeinterpreter,scriptfile))
+    scriptpath=os.path.dirname(os.path.realpath(scriptfile))
+    interpreter=os.path.normpath(os.path.join(scriptpath,scriptrelativeinterpreter))
+    LOG('%s %s' % (scriptpath,interpreter))
+    args[0]=interpreter
+    args[1]=scriptfile
+    #print replacements
+    LOG('running interpreter '+interpreter+' with parameters '+repr(args))
+    LOG('script_path=%s' % (scriptpath))
+    assert(os.path.exists(interpreter) and not os.path.isdir(interpreter))
+    assert(os.path.exists(scriptfile) and not os.path.isdir(scriptfile))
+    assert(os.path.exists(scriptpath) and os.path.isdir(scriptpath))
+    env=os.environ.copy()
+    env['SCRIPT_FILE']=scriptfile
+    env['SCRIPT_PATH']=scriptpath
+    os.execve(interpreter,args,env)
+    raise RuntimeError('Exec Failed')
+
+def main():
+    if len(sys.argv)<2 or (len(sys.argv)<3 and not isRelScript(sys.argv[1])):
+        print('re-l relative interpreter proxy script')
+        print('Usage: with re-l anywhere in the path modify any script shebang to be:')
+        if 'darwin' in sys.platform:
+            print('\t#!/usr/bin/env re-l relative/path/to/interpeter')
+        else:
+            print('\t#!/usr/bin/env re-l')
+            print('and then for the second or third line, add the line:')
+            print('\t#re-l:relative/path/to/interpeter')
+        print('where the interpreter is identified relative to the script file itself')
+        sys.exit(0)
+    if len(sys.argv)==2 or isRelScript(sys.argv[1]):
+        assert(isRelScript(sys.argv[1]))
+        relexec(extractRelInterpreter(sys.argv[1]),sys.argv[1],*sys.argv[2:])
+    else:
+        relexec(sys.argv[1],sys.argv[2],*sys.argv[3:])
+
+if __name__ == '__main__':
+    main()
diff --git a/ShellB3/sbin/rel b/ShellB3/sbin/rel
deleted file mode 100755
index fee13545795c8d3690b66240c20f7da739d32bd6..0000000000000000000000000000000000000000
--- a/ShellB3/sbin/rel
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-
-# used in a script with shebang in 1 of 2 ways
-# #!/path/to/rel relative_interpreter
-# #!/usr/bin/env rel relative_interpreter
-# the latter requires support for more than 1 parameter to the intpreter (not on linux)
-#
-# will set SCRIPT_FILE and SCRIPT_PATH
-# example:
-# #!/usr/local/bin/rel python
-# or, going with the form that just requires rel be in the path
-# #!/usr/bin/env rel python
-#
-# these assume the script is in the same folder as the python interpreter. other deeper locations are also valid, like:
-# #!/usr/bin/env rel ../Resources/Python.app/Contents/MacOS/Python
-#
-# Many systems only allow 1 parameter with Shebang. On these systems, rel
-# must be installed in a standard location, then the following syntax can be used
-# and it will use the interpreter relative to the script's path
-# #!/usr/bin/rel python
-#
-
-import os,sys
-import logging
-LOG = logging.debug
-
-def main():
-    interpreter=sys.argv[1]
-    scriptfile=sys.argv[2]
-    args=[None]+sys.argv[2:]
-    LOG('%s %s' % (interpreter,scriptfile))
-    scriptpath=os.path.dirname(os.path.realpath(scriptfile))
-    interpreter=os.path.normpath(os.path.join(scriptpath,interpreter))
-    LOG('%s %s' % (scriptpath,interpreter))
-    args[0]=interpreter
-    #print replacements
-    LOG('running interpreter '+interpreter+' with parameters '+repr(args))
-    LOG('script_path=%s' % (scriptpath))
-    assert(os.path.exists(interpreter) and not os.path.isdir(interpreter))
-    assert(os.path.exists(scriptfile) and not os.path.isdir(scriptfile))
-    assert(os.path.exists(scriptpath) and os.path.isdir(scriptpath))
-    env=os.environ.copy()
-    env['SCRIPT_FILE']=scriptfile
-    env['SCRIPT_PATH']=scriptpath
-    os.execve(interpreter,args,env)
-    raise RuntimeError('Exec Failed')
-
-if __name__ == '__main__':
-    main()
diff --git a/ShellB3/sbin/shellscrape b/ShellB3/sbin/shellscrape
index 1a32de0ad0341d5900a8e6ad60ee47e681ad7e40..443a96d3bb362b1b9519a8b395e600887498b504 100755
--- a/ShellB3/sbin/shellscrape
+++ b/ShellB3/sbin/shellscrape
@@ -2,59 +2,59 @@
 import os,sys
 
 def getfunction(scriptname,funct,onlyDocumentation=False):
-	findstring=funct+'()'
-	fl=file(scriptname).read()
-	lines=fl.splitlines()
-	extraOpen=0
-	ret=None
-	foundFunc=False
-	for l in lines:
-		if foundFunc:
-			extraOpen=l.count('{')-l.count('}')
-			if onlyDocumentation:
-				l=l.strip()
-				if len(l)==0 or l[0]!='#':
-					if len(ret)>0 and ret[-1]=='\n':
-						ret=ret[:-1]
-					break
-				l=l[1:]
-			elif '}' in l and extraOpen<=0:
-				idx=l.rfind('}')
-				while extraOpen<0:
-					idx=l.rfind('}',0,idx)
-					extraOpen=extraOpen+1
-				l=l[:idx]
-				if len(l.strip())>0:
-					ret+=l+'\n'
-				break
-			ret+=l+'\n'
-		elif l.startswith(findstring):
-			ret=''
-			if '{' in l:
-				ret+=l.split('{',1)[1].strip()
-				if len(ret)>0:
-					ret+='\n'
-			foundFunc=True
-	return ret
+    findstring=funct+'()'
+    fl=file(scriptname).read()
+    lines=fl.splitlines()
+    extraOpen=0
+    ret=None
+    foundFunc=False
+    for l in lines:
+        if foundFunc:
+            extraOpen=l.count('{')-l.count('}')
+            if onlyDocumentation:
+                l=l.strip()
+                if len(l)==0 or l[0]!='#':
+                    if len(ret)>0 and ret[-1]=='\n':
+                        ret=ret[:-1]
+                    break
+                l=l[1:]
+            elif '}' in l and extraOpen<=0:
+                idx=l.rfind('}')
+                while extraOpen<0:
+                    idx=l.rfind('}',0,idx)
+                    extraOpen=extraOpen+1
+                l=l[:idx]
+                if len(l.strip())>0:
+                    ret+=l+'\n'
+                break
+            ret+=l+'\n'
+        elif l.startswith(findstring):
+            ret=''
+            if '{' in l:
+                ret+=l.split('{',1)[1].strip()
+                if len(ret)>0:
+                    ret+='\n'
+            foundFunc=True
+    return ret
 
 def listfunctions(scriptname):
-	fl=file(scriptname).read()
-	lines=fl.splitlines()
-	for l in lines:
-		if '()' in l and '{' in l and '}' not in l:
-			print l.split('()')[0].strip()
+    fl=open(scriptname).read()
+    lines=fl.splitlines()
+    for l in lines:
+        if '()' in l and '{' in l and '}' not in l:
+            print(l.split('()')[0].strip())
 
 def main():
-	onlyDocumentation=False
-	if len(sys.argv)==2:
-		listfunctions(sys.argv[1])
-		return
-	for f in sys.argv[2:]:
-		if f in ("-d","--documentation"):
-			onlyDocumentation=True
-		else:
-			print getfunction(sys.argv[1],f,onlyDocumentation=onlyDocumentation)
-			onlyDocumentation=False
+    onlyDocumentation=False
+    if len(sys.argv) == 2:
+        listfunctions(sys.argv[1])
+        return
+    for f in sys.argv[2:]:
+        if f in ("-d","--documentation"):
+            onlyDocumentation = True
+        else:
+            print(getfunction(sys.argv[1],f,onlyDocumentation=onlyDocumentation))
+            onlyDocumentation = False
 
 if __name__ == '__main__':
-	main()
\ No newline at end of file
+    main()
diff --git a/ShellB3/sbin/thosewhohuntelfs.py b/ShellB3/sbin/thosewhohuntelfs.py
index 2701bb9f24671b32f2b877a6e5587819559322af..fbfaea6259ff843e7c25023899685a3bfb334919 100755
--- a/ShellB3/sbin/thosewhohuntelfs.py
+++ b/ShellB3/sbin/thosewhohuntelfs.py
@@ -29,10 +29,7 @@ LOG = logging.getLogger(__name__)
 OPTS = None
 PY2 = sys.version_info[0] == 2
 if not PY2:
-    text_type = str
-    string_types = (str,)
-    unichr = chr
-    makestring = lambda x: x if isinstance(x,str) else x.decode("utf-8")
+    asUnicode = lambda x: x if isinstance(x,str) else x.decode("utf-8")
     def cmp(a,b): #FIXME
         if len(a)!=len(b):
             return 1
@@ -41,10 +38,7 @@ if not PY2:
                 return 1
         return 0 
 else:
-    text_type = unicode
-    string_types = (str, unicode)
-    unichr = unichr
-    makestring = lambda x: x
+    asUnicode = lambda x: x.decode('utf-8') if isinstance(x,str) else x
 
 if 'darwin' in sys.platform:
     import macholib.MachO
@@ -66,9 +60,9 @@ def rstrip_null_bytes(s):
     """Right-strip any null bytes at the end of the given string."""
     n_null = count_end_null_bytes(s) 
     if n_null > 0:
-        return makestring(s[:-n_null])
+        return asUnicode(s[:-n_null])
     else:
-        return makestring(s)
+        return asUnicode(s)
 
 def acceptableMachoHeaders(path=None,machoobj=None,includeall=False):
     if machoobj is None:
@@ -101,6 +95,9 @@ def ismacho(path):
             if h.filetype=='dylib_stub':
                 print (path+" is a stub. can't rpath it")
                 return False#suspected stub
+            if h.filetype=="dsym":
+                print (path+" is a DWARF symbol table. can't rpath it")
+                return False
         return True
     except:
         return False
@@ -111,13 +108,17 @@ def dump_macho_headers(path):
         print('Header '+repr(i))
         for k,v in vars(header).items():
             print(k+':'+repr(v))
-        if header.mach_header is not headerclass:
-            print('header class is '+repr(header.mach_header)+' not '+repr(headerclass))
-            continue
+        if header.mach_header is macholib.mach_o.mach_header_64:
+            print("Header 64 bit")
+        elif header.mach_header is macholib.mach_o.mach_header:
+            print("Header 32 bit")
+        else:
+            print("Header unknown {}".format(header.mach_header))
         print('commands:')
         hadProperHeader=True
-        for cmd in header.commands:
-            print(cmd)
+        if hasattr(header,'commands'):
+            for cmd in header.commands:
+                print(cmd)
 
 def macho_get_rpath(path):
     libs = []
@@ -146,12 +147,12 @@ def macho_get_rpath(path):
     #help(macholib.mach_o)
     return rpaths,libs
 
-def macho_print_rpath(path):
+def macho_printable_rpath(path):
     rpaths,libs = macho_get_rpath(path)
-    print(','.join(rpaths))
+    return ','.join(rpaths)
 
 def fullrealpath_single(path,rpath,loader_path,executable=None):
-    tmp=makestring(path).replace('@rpath',rpath)
+    tmp=asUnicode(path).replace('@rpath',rpath)
     if loader_path!=None:
         tmp=tmp.replace('@loader_path',loader_path)
     if executable!=None:
@@ -159,13 +160,13 @@ def fullrealpath_single(path,rpath,loader_path,executable=None):
     return os.path.realpath(os.path.abspath(tmp))
 
 def fullrealpath(path,rpaths,loader,executable=None):
-    if isinstance(rpaths,string_types):
+    if not isinstance(rpaths,list):
         raise RuntimeError('List needed')
         return fullrealpath_single(path,rpaths,os.path.dirname(loader),executable)
     if len(rpaths)==0:
         rpaths=[os.getcwd()]
     for p in rpaths+[os.getenv('SYSROOT','/'),os.getcwd()]:
-        r=fullrealpath_single(path,makestring(p),os.path.dirname(loader),executable)
+        r=fullrealpath_single(path,asUnicode(p),os.path.dirname(loader),executable)
         if os.path.exists(r):
             return r
     #print("ERROR couldn't find actual file",path,"in rpaths",rpaths,'loader',loader)
@@ -204,7 +205,7 @@ def macho_patch_rpath(exe_path, new_paths, old_loadpaths,new_loadpaths,base,sb3b
     have=False
     hasId=False
     for _lib in libs:
-        lib=makestring(_lib)
+        lib=asUnicode(_lib)
         repathlib=False
         resolvedname=fullrealpath(lib,rpaths,exe_path)#os.path.realpath(os.path.abspath(lib))
         if os.path.basename(resolvedname)==os.path.basename(exe_path) and os.path.basename(os.path.dirname(resolvedname))==os.path.basename(os.path.dirname(exe_path)): #FIXME this should include whole path, not just name
@@ -223,7 +224,7 @@ def macho_patch_rpath(exe_path, new_paths, old_loadpaths,new_loadpaths,base,sb3b
                 newload=None if pidx>=len(new_loadpaths) else new_loadpaths[pidx]
                 if newload==None:#not old_loadpaths[pidx].startswith(base):
                     for _apath in migrateAcceptableSources:
-                        apath=makestring(_apath)
+                        apath=asUnicode(_apath)
                         if True:#'@rpath' in apath:
                             checkfor=fullrealpath(lib.replace(old_loadpaths[pidx],apath),rpaths,exe_path)
                             if checkfor==None or not os.path.exists(checkfor):
@@ -305,7 +306,7 @@ def iself(path):
         return False
     except:
         pass
-    null = open(os.path.devnull, 'w')
+    null = open(os.path.devnull, 'wb')
     rc = sp.call([OPTS.patchelf, '--print-rpath', path], stdout=null, stderr=null)
     return rc==0 
 
@@ -319,14 +320,16 @@ def get_rpath(path):
     out, err = pip.communicate()
     rpaths=None
     if pip.returncode==0:
-        rpaths=makestring(out).strip().split(':') 
+        rpaths=asUnicode(out).strip().split(':') 
     return pip.returncode, rpaths
 
-def print_rpath(path):
+def printable_rpath(path):
+    if 'linux' not in sys.platform:
+        return macho_printable_rpath(path)
     rc,rpath = get_rpath(path)
     if rc==0:
-        print(':'.join(rpath))
-    return rc==0 
+        return ':'.join(rpath)
+    return None
 
 def patch_rpath(exe_path, new_rpath, skip_stripped=False):
     tmpexe_path=exe_path+'__'
@@ -374,14 +377,9 @@ def hunt_elfs(base, exclude_stripped=False, elvish=True):
 
 def scan(base):
     "print out existing RPATHs of all ELF files"
-    elvish=('linux' in sys.platform)
     for path in hunt_elfs(base,elvish=elvish):
-        print(path + " =>"),
+        print(path + " => {}".format(printable_rpath())),
         sys.stdout.flush()
-        if elvish:
-            print_rpath(path)
-        else:
-            macho_print_rpath(path)
 
 RE_NOTFOUND = re.compile(r'=> not found')
 
@@ -410,8 +408,8 @@ def ldd(path,elvish=True,forbiddenlibs=[]):
         else:
             pid = sp.Popen([path], env=clean_env_with(LD_TRACE_LOADED_OBJECTS='1',LD_BIND_NOW='1'), stdout=sp.PIPE, stderr=sp.PIPE)            
         out,err = pid.communicate()
+        out=asUnicode(out)
         print(out)
-        out=makestring(out)
         uhoh = list(RE_NOTFOUND.findall(out))
         for lib in forbiddenlibs:
             tmp = list(range(out.count(lib+'.')))
@@ -444,8 +442,7 @@ def probe(base,forbiddenlibs=''):
     sysroot=os.getenv('SYSROOT','')
     for path in hunt_elfs(base,elvish=elvish):
         if elvish:
-            print(path + " =>"),
-            print_rpath(path)
+            print(path + " => {}".format(printable_rpath(path))),
             rc = ldd(path,forbiddenlibs=forbiddenlibs)
         else:
             rpaths,libs = macho_get_rpath(path)
diff --git a/ShellB3/sbin/thosewhohuntpythons.py b/ShellB3/sbin/thosewhohuntpythons.py
index 49bc01c59e411c8afcbdafb6d381ec756619f870..b307e564b71ac62c83b50bdd18ab3f41151a89ad 100755
--- a/ShellB3/sbin/thosewhohuntpythons.py
+++ b/ShellB3/sbin/thosewhohuntpythons.py
@@ -7,37 +7,25 @@ $Id$
 
 Purpose: 
 Hunt down Python Script files. 
-relocate the interpreter to be env, or using a 'rel' script.
+relocate the interpreter to use 're-l', a proxy script for using an interpreter relative to the script calling for it.
 
 Created by jpgarcia on 1 Dec 2015.
-Copyright (c) 2015 University of Wisconsin SSEC. All rights reserved.
+Copyright (c) 2015-2017 University of Wisconsin SSEC. All rights reserved.
 """
 from __future__ import print_function,absolute_import,division,unicode_literals
 import sys,os,re,copy
 base=None
-hasRel=None
 isDarwin=None
 isLinux=None
 PY2 = sys.version_info[0] == 2
 if not PY2:
-    text_type = str
-    string_types = (str,)
-    unichr = chr
-    makestring = lambda x: x if isinstance(x,str) else x.decode("utf-8")
-    def cmp(a,b): #FIXME
-        if len(a)!=len(b):
-            return 1
-        for x in range(len(a)):
-            if a[x]!=b[x]:
-                return 1
-        return 0 
-    asuni = lambda x: text_type( x.decode('utf-8') if hasattr(x,'decode') else x)
+    ropenmode="r"
+    openkwargs=dict(newline=None,encoding="utf-8")
+    asUnicode= lambda x:x #should already be
 else:
-    text_type = unicode
-    string_types = (str, unicode)
-    unichr = unichr
-    makestring = lambda x: x
-    asuni = lambda x: text_type( x.decode('utf-8') if hasattr(x,'decode') else x)
+    ropenmode="rU"
+    openkwargs=dict()
+    asUnicode= lambda x: x.decode('utf-8') if isinstance(x,str) else x
 
 def getenv(envvar,default=None):
   if envvar not in os.environ or len(os.environ[envvar])==0:
@@ -45,7 +33,7 @@ def getenv(envvar,default=None):
   return os.environ[envvar]
 
 def doSed(fil,*patterns):
-    f=asuni(open(fil,'r').read())
+    f=asUnicode(open(fil,ropenmode,**openkwargs).read())
     dowrite=False
     for p in patterns:
       sp=p.split(p[1])
@@ -60,7 +48,7 @@ def doSed(fil,*patterns):
           break
     if dowrite:
       #print('writing!')
-      open(fil+'.tmp','w').write(makestring(f.encode('utf-8')))
+      open(fil+'.tmp','wb').write(f.encode('utf-8'))
       perm=os.stat(fil).st_mode
       os.unlink(fil)
       os.rename(fil+'.tmp',fil)
@@ -73,25 +61,17 @@ def _relpath(p1,p2):
 def de_env_script(basedir,scr):
     doSed(scr,'s,^#!.*/env python,#!'+basedir+'/bin/python,')
 
-def repair_with_rel_in_env(interp,scr):  #this calls the interpreter relative to the script, rel in env
-    print("relocating entry script "+scr+" to use /usr/bin/env rel of "+interp)
+def repair_with_rel_in_env_single_parameter_np(interp,scr):  #this calls the interpreter relative to the script, re-l in env
+    print("relocating entry script "+scr+" to use /usr/bin/env re-l (using single parameter) of "+interp)
     de_env_script(base,scr)
     myrpath=_relpath(interp,scr)
-    doSed(scr,"s,^#!"+interp+",#!/usr/bin/env rel "+myrpath+",")
+    doSed(scr,"s,^#!"+interp+",#!/usr/bin/env re-l\n#:"+myrpath+",")
 
-def repair_with_rel(interp,scr): #only support 1 parameter with shebang
-    RELINSTALLPATH=getenv("RELINSTALLPATH")
-    PYFSVER=getenv("PYFSVER")
-    if not hasRel:
-      raise RuntimeError("rel isn't installed at "+RELINSTALLPATH)
-    print ("relocating entry script "+scr+" to use "+RELINSTALLPATH+" of "+interp)
+def repair_with_rel_in_env(interp,scr):  #this calls the interpreter relative to the script, re-l in env
+    print("relocating entry script "+scr+" to use /usr/bin/env re-l of "+interp)
     de_env_script(base,scr)
     myrpath=_relpath(interp,scr)
-    doSed(scr,"s,^#!.*/python"+PYFSVER+",#!"+RELINSTALLPATH+" python"+PYFSVER+"," \
-             ,"s,^#!.*/python,#!"+RELINSTALLPATH+" python"+PYFSVER+"," \
-             ,"s,^#!.*/rel python(?!"+PYFSVER+"),#!"+RELINSTALLPATH+" python"+PYFSVER+"," \
-             ,"s,^#!.*/rel python$,#!"+RELINSTALLPATH+" python"+PYFSVER+"," \
-          )
+    doSed(scr,"s,^#!"+interp+",#!/usr/bin/env re-l "+myrpath+",")
 
 def repair_with_env(interp,scr):  #only support 1 parameter with shebang
     print("relocating entry script "+scr+" to use /usr/bin/env")
@@ -103,13 +83,15 @@ def repair_with_env(interp,scr):  #only support 1 parameter with shebang
              ,"s,^#!.*/python,#!/usr/bin/env python"+PYFSVER+"," \
           )
 
-def firstLine(f):
-  try:
-    v=open(f,mode='rU').readline(512)
-    v=asuni(v)
-    return v
-  except UnicodeDecodeError:
-    return asuni('')
+def firstLine(f,number=1):
+  fil=open(f,mode=ropenmode,**openkwargs)
+  v=''
+  for x in range(number):
+    try:
+      v=asUnicode(fil.readline(512))
+    except UnicodeDecodeError:
+      v=""
+  return v
 
 def is_python_script(f):
   if not is_script(f):
@@ -123,18 +105,11 @@ def needs_repair_env(fn):
   PYFSVER=getenv("PYFSVER")
   return "#!/usr/bin/env python"+PYFSVER not in firstLine(fn)
 
-def needs_repair_rel(fn):
-  if not is_python_script(fn):
-    return False
-  RELINSTALLPATH=getenv("RELINSTALLPATH")
-  PYFSVER=getenv("PYFSVER")
-  return "#!"+RELINSTALLPATH+" python"+PYFSVER not in firstLine(fn)
-
 def needs_repair_rel_in_env(fn):
   if not is_python_script(fn):
     return False
   firstline=firstLine(fn)
-  if not "#!/usr/bin/env rel " in firstline:
+  if not "#!/usr/bin/env re-l " in firstline:
     return True
   relpath=firstline.split(' ')[2].strip()
   pathdir=os.path.dirname(fn)
@@ -143,6 +118,23 @@ def needs_repair_rel_in_env(fn):
     print(fn+" doesn't have an exsting interpreter:"+interp)
   return not os.path.exists(interp)
 
+def needs_repair_rel_in_env_single_parameter_np(fn):
+  if not is_python_script(fn):
+    return False
+  firstline=firstLine(fn).strip()
+  if "#!/usr/bin/env re-l" != firstline:
+    return True
+  secondline=firstLine(fn,number=2).strip()
+  if not secondline.startswith('#:'):
+    print(fn+" set up for single parameter re-l, but doesn't have the interpreter")
+    return True
+  relpath=secondline.split(':',1)[1].strip()
+  pathdir=os.path.dirname(fn)
+  interp=os.path.join(pathdir,relpath)
+  if not os.path.exists(interp):
+    print(fn+" doesn't have an exsting interpreter:"+interp)
+  return not os.path.exists(interp)
+
 needs_repair_python=None
 repair_python=None
 
@@ -153,7 +145,7 @@ def is_script(fn):
     return False
   if not os.path.isfile(fn):
     return False
-  if fn in ["bin/rel"]:#don't touch scripts named here. they're fine.
+  if fn in ["bin/rel","bin/re-l"]:#don't touch scripts named here. they're fine.
     return False
   if firstLine(fn)[:2]!='#!':
     return False
@@ -179,36 +171,23 @@ def relocateScript(fn,doRepair):
       return needs_repair_python(fn),fn
     return False,fn
 
-def checkRel():
-  if getenv("IGNORE_REL") is not None:
-    return False
-  x=getenv("RELINSTALLPATH")
-  return x is not None and os.path.exists(x)
-
 def main():
   global base
   global isLinux
   global isDarwin
-  global hasRel
   global needs_repair_python
   global repair_python
   isLinux=('linux' in sys.platform)
   isDarwin=not isLinux
-  hasRel= checkRel()
 
   if isDarwin:
-    print('python hunting using env rel method (requires rel in path and >1 parameter shebang support)')
+    print('python hunting using env re-l method (requires re-l in path and >1 parameter shebang support)')
     needs_repair_python=needs_repair_rel_in_env
     repair_python=repair_with_rel_in_env
   elif isLinux:
-    if hasRel:
-      print('using '+getenv("RELINSTALLPATH")+' (requires exact installed path)')
-      needs_repair_python=needs_repair_rel
-      repair_python=repair_with_rel
-    else:
-      print('using env (requires first in path)')
-      needs_repair_python=needs_repair_env
-      repair_python=repair_with_env
+    print('using env re-l, single parameter method')
+    needs_repair_python=needs_repair_rel_in_env_single_parameter_np
+    repair_python=repair_with_rel_in_env_single_parameter_np
 
   doscan='scan'==sys.argv[1]
   if not doscan:
diff --git a/ShellB3/shallbethree.sh b/ShellB3/shallbethree.sh
index afaba2901bc69a39406db3b9915a4db76c91b51a..f2d07e88fe72822462839e609390d40d9249b9ee 100755
--- a/ShellB3/shallbethree.sh
+++ b/ShellB3/shallbethree.sh
@@ -1,23 +1,33 @@
 #!/bin/bash
-# $Id$ 
+# $Id$
 # shallbethree.sh
-# 
+#
 # Build Python with numpy, gribapi, other necessary packages for NPPDB
 # Includes "patchelf" static binary in case of rehosting.
 # Uses $ORIGIN in RPATH (via LD_RUN_PATH) to avoid that possibility as much as we can.
 #
-# "First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less. 
-#  Three shall be the number thou shalt count, and the number of the counting shall be three. 
-#  Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. 
-#  Five is right out. Once the number three, being the third number, be reached, 
-#  then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, 
+# "First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less.
+#  Three shall be the number thou shalt count, and the number of the counting shall be three.
+#  Four shalt thou not count, neither count thou two, excepting that thou then proceed to three.
+#  Five is right out. Once the number three, being the third number, be reached,
+#  then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,
 #  who being naughty in My sight, shall snuff it."
 #  - Monty Python and the Holy Grail
 
 #to change platforms, export MACOSX_DEPLOYMENT_TARGET (mac only) and/or CPUTYPE
 
+# Environment variable scheme:
+#   boolean values: true can be Y,YES,y,yes,true,1   false can be N,NO,n,no,false,0
+#   USE_SYS_* = set USE_SYS_XX to true to use a system-provided version of module XX instead of building one.
+#               These are ususally set in this script based on detected platform. these all become false if
+#               a portable build is configured.
+#   USE_PORTABLE_* = similar to USE_SYS_*, but is considered portable and thus not set false for portable builds
+#   FORBIDDENLIBS = set to a comma-separated list of libraries that will trigger an error if found during a binary scan.
+#                   these are set to deprecated or non-portable libraries that shouldn't be linked. does not impact actual
+#                   building, as those functions need to consider libraries in their own ways
+
 export BASE=$PWD
-export ANYPYTHON="/usr/bin/env python"
+export ANYPYTHON="/usr/bin/python"
 
 ID="$Id$"
 if [ -d ../.git ] ; then
@@ -53,7 +63,7 @@ export http_proxy="http://${preferred_proxy}/" https_proxy="https://${preferred_
 PIP_PARAMETERS="--no-allow-external --no-index --no-binary --proxy=${preferred_proxy} --timeout=5 \
       --disable-pip-version-check $( for f in ${PYTHON_OPTIMIZATION} ; do echo  --install-option=$f ; done)"
 
-BUILDENV_CHECKED=0
+export BUILDENV_CHECKED=0
 ENVVERSIONJSON=build/.build_env.json
 
 _write_build_env(){
@@ -73,15 +83,14 @@ for v in sys.argv[2:]:
   else:
     buildenv[v]=None
 json.dump(buildenv,open(sys.argv[1],'w'),indent=4,separators=(',', ': '))
-sys.exit(0)  
+sys.exit(0)
 PYSCRIPT
 }
 
 _check_build_env(){
   #echo BUILDENV_CHECKED is $BUILDENV_CHECKED "$*"
-  if [ "${BUILDENV_CHECKED}" -ne 0 ] ; then
-    if [ -n "$*" ] ; then
-      if [ -f "${ENVVERSIONJSON}" ] ; then
+  if [ -n "$1" ] ; then #parameter given to clear and reload a variable
+    if [ -f "${ENVVERSIONJSON}" ] ; then
       ${ANYPYTHON} - ${ENVVERSIONJSON} $* <<PYSCRIPT || oops "Failed to filter version"
 import os,sys
 try:
@@ -98,16 +107,15 @@ for v in sys.argv[2:]:
 json.dump(buildenv,open(sys.argv[1],'w'),indent=4,separators=(',', ': '))
 sys.exit(0)
 PYSCRIPT
-      fi
-      . ./shallbethree.sh _write_build_env
-      #_write_build_env
-    else
-      return
     fi
-    #return
+    export BUILDENV_CHECKED=0
+    . ${BASH_SOURCE[0]} noop #this reloads the local variables
+  fi
+  if [ "${BUILDENV_CHECKED}" -ne 0 ] ; then
+    return
   fi
   echo "Checking build environment for consistency..."
-  ENVVERSIONKEYS="MAKE_STACKLESS MAKE_PYTHON3 PYTHON PYFSVER CC CXX FC CPP CPUTYPE SYSROOT LANG QT4DIR RELINSTALLPATH IGNORE_REL PORTABLESHELLB3"
+  ENVVERSIONKEYS="MAKE_STACKLESS MAKE_PYTHON3 PYTHON PYFSVER CC CXX FC CPP CPUTYPE SYSROOT LANG QT4DIR PORTABLESHELLB3"
   if isDarwin ; then
     ENVVERSIONKEYS="${ENVVERSIONKEYS} MACOSX_DEPLOYMENT_TARGET"
   elif isLinux ; then
@@ -123,7 +131,7 @@ except ImportError:
   subprocess.call(["tar","xf","src/sys/simplejson-1.7.3.tar.gz","-C","build"])
   sys.path.append("build/simplejson-1.7.3")
   import simplejson as json
-  
+
 envdesc=dict(
   MAKE_STACKLESS="Stackless Python Select",
   MAKE_PYTHON3="Python 2/3 Select",
@@ -174,7 +182,7 @@ sys.exit(0)
 PYSCRIPT
   fi
   _write_build_env
-  BUILDENV_CHECKED=1
+  export BUILDENV_CHECKED=1
   echo "Verified consistent."
 }
 
@@ -217,7 +225,7 @@ _get_resume_stack() {
     x=0
     for s in $(head -n 1 ${RESUMERECEIPT}) ; do
       case "${s}" in
-        mk_*|resume_tracker)
+        _mk_*|mk_*|resume_tracker)
           RESUMEARRAY[${x}]=${s}
           x=$(( x+1 ))
           ;;
@@ -295,10 +303,10 @@ if [ \$# -eq 1 -a "\$1" == destruct ] ; then
         mv -f sysbin/_${BINNAME} sysbin/${BINNAME}
      else
         rm -f sysbin/${BINNAME}
-     fi      
+     fi
      exit
 fi
-exec $( _envval $VAL ) "\$@"
+exec $( _envval $VAL | sed s,sysbin/${BINNAME},sysbin/_${BINNAME},g ) "\$@"
 EOF
      chmod +x sysbin/${BINNAME}
      unset $VAL
@@ -339,7 +347,7 @@ _get_jump_stack() {
           ;;
       esac
     done
-    ALLPARAMS="${RESUMEARRAY[$((${#RESUMEARRAY[@]} - 1))]}"  
+    ALLPARAMS="${RESUMEARRAY[$((${#RESUMEARRAY[@]} - 1))]}"
 }
 
 # jump - continue immedately from a location in the script without a resume receipt
@@ -352,7 +360,7 @@ jump() {
     #find the bottom stack function to run and run it
     r=${RESUMEARRAY[$((${#RESUMEARRAY[@]} - 1))]}
     echo "Jumping into call to ${r}"
-    _do_resume_call  
+    _do_resume_call
     ret=$?
     return $ret
 }
@@ -390,7 +398,7 @@ assert(){
     fi
   elif [ "$( printenv ${_tmp} )" != "${_tval}" ] ; then
       oops "${_tmp} doesn't equal ${_tval}!"
-  fi    
+  fi
 }
 
 is64Bit(){
@@ -423,6 +431,16 @@ isNotLinux(){
   return $?
 }
 
+isPython3(){
+  test "${PYFSVERMAJOR}" == "3"
+  return $?
+}
+
+isPython2(){
+  test "${PYFSVERMAJOR}" == "2"
+  return $?
+}
+
 isTrue(){
   # explicitly true
   ${ANYPYTHON} - $1 <<PYTHON
@@ -518,14 +536,15 @@ LinuxDistroRelease(){
   fi
   if [ -e /usr/bin/lsb_release ] ; then
     /usr/bin/lsb_release -s -r
+    return 0
   elif [ -e /etc/centos-release ] ; then
-    cat /etc/centos-release | awk '{print $3}'
+    awk '{print $3}' /etc/centos-release
     return 0
   elif [ -e /etc/redhat-release ] ; then
-    cat /etc/redhat-release | awk '{print $3}'
+    awk '{print $3}' /etc/redhat-release
     return 0
   elif [ -e /etc/fedora-release ] ; then
-    cat /etc/fedora-release | awk '{print $3}'
+    awk '{print $3}' /etc/fedora-release
     return 0
   elif [ -e /etc/os-release ] ; then
     . /etc/os-release ; echo $VERSION_ID
@@ -541,7 +560,7 @@ LinuxDistroRelease(){
 }
 
 LinuxDistroRel(){
-  echo $( LinuxDistroRelease ) | awk -F . '{print $1}'
+ LinuxDistroRelease | awk -F . '{print $1}'
 }
 
 isDebianLinux(){
@@ -549,7 +568,7 @@ isDebianLinux(){
     return 1
   fi
   test "$(LinuxDistroName)" == "Debian" -o "$(LinuxDistroName)" == "Raspbian"
-  return $?  
+  return $?
 }
 
 isUbuntuLinux(){
@@ -557,7 +576,7 @@ isUbuntuLinux(){
     return 1
   fi
   test "$(LinuxDistroName)" == "Ubuntu"
-  return $?  
+  return $?
 }
 
 isCentOSLinux(){
@@ -578,19 +597,6 @@ isFedoraLinux(){
 
 test -n "$DEBUG" && set -x
 
-if [ -z "${RELINSTALLPATH}" ] ; then
-  export RELINSTALLPATH=/usr/local/bin/rel
-fi
-
-hasRel(){
-  if [ -n "${IGNORE_REL}" ] ; then
-    return 1
-  fi
-  test -e "${RELINSTALLPATH}"
-  RET=$?
-  return $RET
-}
-
 # currently only HDF5 and ZLIB are checked for in $COTS_HOME
 
 # link binaries so that they search relative to the installation location using LD_LIBRARY_PATH
@@ -602,7 +608,7 @@ hasRel(){
 # furthermore, relative RPATH breaks virtualenv for fixed-location development environment installs (e.g. mk_hhg)
 # LD_RUN_PATH on incoming should show relative location of COTS to SB3 location
 # e.g. export LD_RUN_PATH="\$ORIGIN/../../local/lib"
-if [ -z "$LD_RUN_PATH" ]; then 
+if [ -z "$LD_RUN_PATH" ]; then
   export LD_RUN_PATH="$BASE/lib"
 else
   echo "INFO: appending prior LD_RUN_PATH=$LD_RUN_PATH"
@@ -632,7 +638,7 @@ export LIBELFVER=0.8.13
 export PATCHELFVER=0.9
 
 export ZLIBVER=1.2.11     # this may come in from system or $COTS_HOME
-export SQLITEVER=3180000
+export SQLITEVER=3190300
 export LIBXMLVER=2.9.4
 
 export PYPY2VER=5.6.0
@@ -681,7 +687,7 @@ fi
 export BLASVER=3.6.0
 export OPENBLASVER=0.2.19
 export LAPACKVER=3.7.0
-export NUMPYVER=1.12.1
+export NUMPYVER=1.13.1
 
 export JASPERVER=1.900.1
 export GRIBAPIVER=1.20.0-Source
@@ -689,24 +695,28 @@ export PYGRIBVER=2.0.2
 
 export PYPROJVER=1.9.5.1
 export SZIPVER=2.1.1
-export HDF5VER=1.8.18    # also may come in from system or $COTS_HOME
+export HDF5VER=1.8.19   # also may come in from system or $COTS_HOME
 export H5PYVER=2.7.0
 
 export CYTHONVER=0.25.2
 export NUMEXPRVER=2.6.2
-export BLOSCVER=1.5.1
+export CBLOSCVER=1.12.1
+export PYBLOSCVER=1.5.1
 export PYTABLESVER=3.4.2
 
 export PLYVER=3.10
 
+export GNUREADLINEVER=6.3.3
+
 export SWIGVER=3.0.12
 export SUITESPARSEVER=4.5.4
-export SCIPYVER=0.19.0
+export METISVER=5.1.0
+export SCIPYVER=0.19.1
 
-# optional packages 
+# optional packages
 export DISTRIBUTEVER=0.6.28
-export SETUPTOOLSVER=35.0.1
-export SETUPTOOLSSCMVER=1.15.5
+export SETUPTOOLSVER=36.0.1
+export SETUPTOOLSSCMVER=1.15.6
 export ATLASVER=3.10.3
 export EUGENEVER=4.9.2
 export HARFBUZZVER=1.4.6
@@ -714,7 +724,7 @@ export GETTEXTVER=0.19.8.1
 export GLIBVER=2.50.3
 export ICUVER=59_1
 export FREETYPEVER=2.7
-export PCREVER=8.40
+export PCREVER=8.41
 export JPEGVER=9b
 export PNGVER=1.5.28
 export TIFFVER=4.0.7
@@ -723,23 +733,28 @@ export CAIROVER=1.12.18
 export PY2CAIROVER=1.10.0
 export PYCAIROVER=1.10.0
 export MOCKVER=2.0.0
-export MATPLOTLIBVER=2.0.0
+export MATPLOTLIBVER=2.0.2
+export MPLD3VER=0.3
+export MPLH5CANVASVER=0.7
 export GEOSVER=3.5.0
 export BASEMAPVER=1.0.7
+export PYSHPVER=1.2.11
+export CARTOPYVER=0.15.1
 export CDF4VER=4.4.1.1
 export CDF4CXXVER=4.3.0
 export CDF4FORVER=4.4.4
 export PYCDFVER=0.6-3b
-export NETCDF4PYVER=1.2.7
+export NETCDF4PYVER=1.2.9
 export SIPVER=4.19.1
 export PYQT4VER=4.11.4 #can't go any newer than this. older qt4's commonly seen aren't compatible
 export PYSIDEVER=1.2.4
 export QTPYVER=1.2.1
-export BOTTLENECKVER=1.2.0
-export HDF4VER=4.2.12
+export BOTTLENECKVER=1.2.1
+export HDF4VER=4.2.13
 export PYHDFVER=0.9
-export PYKDTREEVER=1.2.1
-export PYRESAMPLEVER=1.4.1
+export PYYAMLVER=3.12
+export PYKDTREEVER=1.2.2
+export PYRESAMPLEVER=1.5.0
 export PYINOTIFYVER=0.9.4
 export SHAPELYVER=1.6b4
 export PILVER=1.1.7
@@ -747,24 +762,29 @@ export PYLIBTIFFVER=r91
 export CONFIGOBJVER=5.0.6
 export ZEROMQVER=4.2.1
 export PYZMQVER=16.0.2
-export GDALVER=2.1.3
+export GDALVER=2.2.1
 export SODIUMVER=1.0.12
 
 export ASTROPYVER=1.2.1
 export BLISTVER=1.3.6
 export BITARRAYVER=0.8.1
 export UPDATESVER=0.1.7.1
+export GEOPYVER=1.11.0
+
+export PINTVER=0.8.1
+export METPYVER=0.5.1
 
 export SUBPROCESS32VER=3.2.7
 
-export LLVMVER=4.0.0
-export LLVMLITEVER=0.17.1
-export NUMBAVER=0.32.0
+export LLVMVER=4.0.1
+export DRAGONEGGVER=3.6.2.src
+export LLVMLITEVER=0.19.0
+export NUMBAVER=0.34.0
 export ENUM34VER=1.1.6
-export POCLVER=0.13-838-g82d7cc9e #git version on master branch from after 0.14
-export REQUESTSVER=2.13.0
+export POCLVER=0.13-863-g2b5cc9a7 #git version on master branch from after 0.14
+export REQUESTSVER=2.18.1
 export PIPVER=9.0.1
-export DATEUTILVER=2.6.0
+export DATEUTILVER=2.6.1
 export PYPARSINGVER=2.2.0
 export CERTIFIVER=2017.4.17
 export TORNADOVER=4.5.1
@@ -778,18 +798,21 @@ export SINGLEDISPATCHVER=3.4.0.3
 export VIRTVER=15.1.0
 export PYOPENGLVER=3.1.1a1
 export LIBFFIVER=3.2.1
-export PYCPARSERVER=2.17
+export PYCPARSERVER=2.18
 export CFFIVER=1.10.0
 export OLEFILEVER=0.44
-export PILLOWVER=4.1.0
+export PILLOWVER=4.2.1
+
+export IPYTHONVER=6.1.0
+export PY2IPYTHONVER=5.4.1 #last supported version for Python 2.x
 
 export MINIPGVER=0.5.6
 export NODEJSVER=7.6.0
 
 export ASTRALVER=1.4
 
-export MODULEGRAPHVER=0.14
-export ALTGRAPHVER=0.13
+export MODULEGRAPHVER=0.15
+export ALTGRAPHVER=0.14
 export MACHOLIBVER=1.8
 
 export OPENMPIVER=2.0.1
@@ -816,9 +839,9 @@ export AUTOCONFVER=2.69
 export AUTOMAKEVER=1.15
 export CURLVER=7.50.3
 
-export PYLINTVER=1.7.1
+export PYLINTVER=1.7.2
 
-export SPHINXVER=1.6b1
+export SPHINXVER=1.6.3
 
 #IDL bits
 export LIBREADLINEVER=6.3
@@ -829,7 +852,7 @@ export OCTAVEVER=4.2.0
 #20150804-0cba44413bf62f78cb058ed881dc6aef983dcd75
 #4.0.0
 export WXWIDGETSVER=3.1.0
-export UDUNITSVER=2.2.24
+export UDUNITSVER=2.2.25
 export FFTWVER=3.3.6-pl1
 export GPERFVER=3.0.4
 export ICOUTILSVER=0.31.0
@@ -838,7 +861,7 @@ export PLPLOTVER=5.12.0
 export EIGENVER=eigen-da9b4e14c255
 export MAGICKVER=7.0.3-4
 export GDLVER=0.9.7
-export CMAKEVER=3.7.2
+export CMAKEVER=3.9.0
 
 export LZOVER=2.10
 export XZVER=5.2.3
@@ -855,8 +878,8 @@ export JASPER_DIR=$BASE
 # export HDF5_DIR=$BASE
 
 # used by numba and other LLVM clients
-export LLVM_CONFIG_PATH=${BASE}/bin/llvm-config
-export LLVM_CONFIG=${BASE}/bin/llvm-config
+export LLVM_CONFIG_PATH=${BASE}/sysbin/llvm-config
+export LLVM_CONFIG=${BASE}/sysbin/llvm-config
 
 # reference blas and lapack
 if [ -z "$ATLAS" ]; then
@@ -878,7 +901,7 @@ mkdir -p build sysbin
 
 _tmpenvset() {
   varn=$1
-  tmpvarn=_oo${varn}  
+  tmpvarn=_oo${varn}
   export ${tmpvarn}="$( printenv ${varn} )"
   #echo stored \"$(printenv ${tmpvarn})\" to ${tmpvarn}
   #echo was ${varn} as \"$(printenv ${varn})\"
@@ -920,7 +943,7 @@ PYSCRIPT
 ################################################
 #
 # tool routines which are basically macros for common cases
-# 
+#
 
 _assert_script(){
   if [ -n "$scriptfile" -a "$scriptfile" != "." ] ; then
@@ -1007,35 +1030,51 @@ _try_patch(){
   return 0
 }
 
-# _cmake_make name tarball_path build_directory cmake_options
-_cmake_make() {
-	name=$1
-		tarball=$2
-		buildir=$3
-		shift 3
-
+have_cmake() {
   if useSysCheck USE_SYS_CMAKE ; then
-    CMAKE="cmake"
+    export CMAKE="cmake"
   else
-    CMAKE="${BASE}/bin/cmake"
+    export CMAKE="${BASE}/bin/cmake"
   fi
 
+  which "${CMAKE}" >&/dev/null
+
+  return $?
+}
+
+# _cmake_make name tarball_path build_directory cmake_options
+_cmake_make() {
+  name=$1
+  tarball=$2
+  buildir=$3
+  shift 3
+
   CMAKEEXTRA=""
   isDarwin && CMAKEEXTRA="${CMAKEEXTRA} -DCMAKE_OSX_SYSROOT=${SYSROOT} "
 
-		rm -rf build/${buildir}
-	  echo unpacking ${name}...
-		tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
+  rm -rf build/${buildir}
+  echo unpacking ${name}...
+  tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
 
-    touch build/${buildir}
-    pushd build/${buildir} && _try_patch ${name} && _try_script ${name} "$@"
-    popd
+  touch build/${buildir}
+  pushd build/${buildir} && _try_patch ${name} && _try_script ${name} "$@"
+  popd
+
+  have_cmake || oops "Can't build ${name} without ${CMAKE}"
+
+  if [ -z "`echo ${buildir} | grep /`" ] ; then
+    buildir=${buildir}/sb3_build
+    prefpath=".."
+    mkdir -p build/${buildir}
+  else
+    prefpath="."
+  fi
 
-		echo "building ${name} for $BASE"
-		(cd build/${buildir}  \
-		 && mkdir build && cd build && ${CMAKE} -DCMAKE_INSTALL_PREFIX:PATH=${BASE} ${CMAKEEXTRA} "$@" .. \
-		 && make ) \
-		|| oops "${name} build failed"
+  echo "building ${name} for $BASE"
+  (cd build/${buildir}  \
+   && ${CMAKE} -DCMAKE_INSTALL_PREFIX:PATH=${BASE} ${CMAKEEXTRA} "$@" ${prefpath} \
+   && make ) \
+  || oops "${name} build failed"
 }
 
 # _cmake_make_install name tarball_path build_directory cmake_options
@@ -1044,8 +1083,16 @@ _cmake_make_install() {
   tarball=$2
   buildir=$3
 
-  _cmake_make "$@" && ( cd build/${buildir}/build \
-		 && MAKEFLAGS="" make install ) \
+  if [ -z "`echo ${buildir} | grep /`" ] ; then
+    buildir=${buildir}/sb3_build
+    prefpath=".."
+    mkdir -p build/${buildir}
+  else
+    prefpath="."
+  fi
+
+  _cmake_make "$@" && ( cd build/${buildir} \
+   && MAKEFLAGS="" make install ) \
    || oops "${name} build failed"
 }
 
@@ -1057,7 +1104,9 @@ _configure_make_install() {
   shift 3
   rm -rf build/${buildir}
   echo unpacking ${name}...
-  if [ -n "$(echo ${tarball} | egrep "(\.tar\.xz|\.txz)" )" ] ; then
+  if [ "$(basename "${tarball}" )" != "$(basename "${tarball}" .zip)" ] ; then
+    (cd build && unzip "../${tarball}" ) || oops "could not unzip ${name} from ${tarball}"
+  elif [ -n "$(echo ${tarball} | egrep "(\.tar\.xz|\.txz)" )" ] ; then
     xzcat ${tarball} | tar xf - -C build || oops "could not unpack xz-ed ${name} from ${tarball}"
   else
     tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
@@ -1082,7 +1131,7 @@ _configure_make_install() {
    || oops "${name} build failed"
    fixla
 }
-  
+
 
 # _setup_build_install name tarball_path build_dir setup_options...
 _setup_build_install() {
@@ -1097,7 +1146,7 @@ _setup_build_install() {
   else
     (cd build && unzip "../${tarball}" ) || oops "could not unzip ${name} from ${tarball}"
   fi
- 
+
   touch build/${buildir}
   pushd build/${buildir} && _try_patch ${name} && _try_script ${name} "$@"
   popd
@@ -1150,11 +1199,11 @@ _find_cots() {
     local varname=$1
     local marker=$2
     shift 2
-    # if variable is already set, use that 
+    # if variable is already set, use that
     test -n "${!varname}" && return
-    for dn in $*; do 
+    for dn in $*; do
         if [ -e "${dn}/${marker}" ]; then
-            echo "found $varname at $dn" 
+            echo "found $varname at $dn"
             export $varname=$dn
             return 0
         fi
@@ -1173,7 +1222,7 @@ _find_cots_lib() {
   for f in $* ; do
     for g in $( is64Bit && isLinux && echo lib64 ) lib $( isDarwin && echo Library/Frameworks/Python.framework/Versions/${PYFSVER}/lib ) $( is64Bit && isLinux && echo usr/lib64 ) usr/lib ; do
       if [ -e "${f}/${g}" ]; then
-        for h in $( isDarwin && echo .dylib .tbd ) .so .a ; do 
+        for h in $( isDarwin && echo .dylib .tbd ) .so .a ; do
           if [ -e "${f}/${g}/${libname}${h}" ]; then
               echo "found $varname at $f - ${f}/${g}/${libname}${h}"
               export $varname=$f
@@ -1187,7 +1236,7 @@ _find_cots_lib() {
               export $varname=$f
               export ${varname}LIBDIR="$(dirname "${TMP}")"
               export ${varname}LIBFILE="${TMP}"
-              return 0            
+              return 0
             fi
           fi
         done
@@ -1197,6 +1246,40 @@ _find_cots_lib() {
   return 1
 }
 
+# version_comparison 1.1 2.2
+# return order of version comparison
+# -2, -1, 0,  1, or 2
+# <, <=, ==, >=,   >
+_version_comparison(){
+  ${ANYPYTHON} - "$@" <<PYTHON
+
+def compare(v1,v2):
+  v1a=[int(x) for x in v1.strip().split(".")]
+  v2a=[int(x) for x in v2.strip().split(".")]
+  for i in range(min(len(v1a),len(v2a))):
+    if v1a[i]<v2a[i]:
+      return -2
+    if v1a[i]>v2a[i]:
+      return 2
+
+  if len(v1a)>len(v2a):
+    return 1
+  elif len(v1a)<len(v2a):
+    return -1
+  return 0
+
+if __name__ == '__main__':
+    import sys
+    sys.exit(compare(*sys.argv[1:]))
+
+PYTHON
+  RET=$?
+  if [ $RET == 127 ] ; then
+    oops "Error occurred"
+  fi
+  return $RET
+}
+
 # check_gcc_version version
 # check_gcc_version 4.8
 check_gcc_version(){
@@ -1209,44 +1292,34 @@ check_gcc_version(){
     local CC=gcc
   fi
   local GCCVER="$($CC --version | egrep \^gcc | awk -F\( '{print $2}' | awk -F\) '{print $2}')"
-  local A=$(echo $GCCVER | awk -F \. '{print $1}')
-  local B=$(echo $TARGETVER | awk -F \. '{print $1}')
-  if [ -z "$A" -o -z "$B" ] ; then
-    echo "$GCCVER >= $TARGETVER"
-    return 0
-  elif [ $A -gt $B ] ; then
-    echo "$GCCVER > $TARGETVER :)"
-    return 0
-  elif [ $A -lt $B ] ; then
+  _version_comparison $GCCVER $TARGETVER
+  RES=$?
+  case $RES in
+    254)
     echo "$GCCVER < $TARGETVER :("
     return 1
-  fi
-  local A=$(echo $GCCVER | awk -F \. '{print $2}')
-  local B=$(echo $TARGETVER | awk -F \. '{print $2}')
-  if [ -z "$A" -o -z "$B" ] ; then
-    echo "$GCCVER >= $TARGETVER"
+      ;;
+    255)
+    echo "$GCCVER <= $TARGETVER"
     return 0
-  elif [ $A -gt $B ] ; then
-    echo "$GCCVER > $TARGETVER :)"
+      ;;
+    0)
+    echo "$GCCVER == $TARGETVER"
     return 0
-  elif [ $A -lt $B ] ; then
-    echo "$GCCVER < $TARGETVER :("
-    return 1
-  fi
-  local A=$(echo $GCCVER | awk -F \. '{print $3}')
-  local B=$(echo $TARGETVER | awk -F \. '{print $3}')
-  if [ -z "$A" -o -z "$B" ] ; then
+      ;;
+    1)
     echo "$GCCVER >= $TARGETVER"
     return 0
-  elif [ $A -gt $B ] ; then
+      ;;
+    2)
     echo "$GCCVER > $TARGETVER :)"
     return 0
-  elif [ $A -lt $B ] ; then
-    echo "$GCCVER < $TARGETVER :("
+      ;;
+    *)
+    echo "Failed to compare $GCCVER to $TARGETVER"
     return 1
-  fi
-  echo "$GCCVER == $TARGETVER"
-  return 0
+      ;;
+    esac
 }
 
 #omitparameter parameter #param parameters
@@ -1269,6 +1342,7 @@ omitparameter() {
   echo
 }
 
+#fixla brute force fix libtool 'la' files
 fixla(){
   if isDarwin ; then
     ( find lib* -name "*.la" -type f | xargs sed -i.bak -e "s: =${BASE}: ${BASE}:g" -e "s: =${SYSROOT}/usr: ${SYSROOT}/usr:g" -e "s:-L=/:-L/:g" && find lib* -name "*.la.bak" -type f | xargs rm -f ) || oops "couldn't fix la files"
@@ -1296,7 +1370,7 @@ repackage() {
          echo "-change" /$(echo $lib| sed -e "s,//,/,g") $( echo "$lib" | sed -e "s,$1,$2,g" -e "s,//,/,g" ) ; \
          done  ) \
        $f || echo Nevermind
-    fi 
+    fi
   done
 }
 
@@ -1443,16 +1517,16 @@ install_macgfortran() {
       find * -name "*stdc++*" | xargs rm -rf
       find * -name "*ppc*" | xargs rm -rf
       find * -name "*powerpc*" | xargs rm -rf
-      find * -name "*libasan*" | xargs rm -f 
-      find * -name "*libubsan*" | xargs rm -f 
-      find * -name "*libcilkrts*" | xargs rm -f 
+      find * -name "*libasan*" | xargs rm -f
+      find * -name "*libubsan*" | xargs rm -f
+      find * -name "*libcilkrts*" | xargs rm -f
       rm -rf lib/libsql* lib/libxml*
       ;;
     *)
       oops "Unknown Mac OS X version: " ${MACOSX_SDK_VERSION}
       ;;
   esac
-  
+
   ##clean out libraries we dont need
   mkdir libsys
   mv lib/lib{mpc,mpfr,gmp,cc1}* libsys
@@ -1501,7 +1575,7 @@ install_macgfortran() {
     echo removing contents of $f
     rm -rf $f
   done
-  if [ ! -d sysbin ] ; then 
+  if [ ! -d sysbin ] ; then
     mkdir sysbin
   fi
   for f in bin/*gfortran* bin/cpp bin/g++* bin/gcov bin/gcc* ; do
@@ -1530,7 +1604,7 @@ if isDarwin ; then
   export NATIVEDARWINVERNUMBER=$( uname -r  | awk -F"." '{print $1}' )
   if [ -z "${MACOSX_DEPLOYMENT_TARGET}" ] ; then
     if [ ${NATIVEDARWINVERNUMBER} -gt ${DEFAULT_DARWINVERNUMBER} ] ; then
-      export MACOSX_DEPLOYMENT_TARGET=${DEFAULT_MACOSX_DEPLOYMENT_TARGET} 
+      export MACOSX_DEPLOYMENT_TARGET=${DEFAULT_MACOSX_DEPLOYMENT_TARGET}
       echo "Opting to default build for supported base of ${MACOSX_DEPLOYMENT_TARGET}"
     else
       export MACOSX_DEPLOYMENT_TARGET="10."$(( ${NATIVEDARWINVERNUMBER} - 4 ))
@@ -1625,8 +1699,8 @@ if isDarwin ; then
       ;;
     10.11|10.12)
       GFORTRANPLATFORM=x86_64-apple-darwin15.6.0
-      GFORTRANVERSION=6.3.0
-      GFORTRANVER=6.3
+      GFORTRANVERSION=7.1.0
+      GFORTRANVER=7.1
       ;;
     *)
       oops Unsupported Deployment Target ${MACOSX_SDK_VERSION}
@@ -1646,11 +1720,11 @@ if isDarwin ; then
       export SB3CPPFLAGS=" -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" #--sysroot=$SYSROOT"
       if [ ${NATIVEDARWINVERNUMBER} -gt ${DARWINVERNUMBER} ] ; then
         export SB3LDFLAGS="${SB3LDFLAGS} -stdlib=libstdc++" #newer build systems will default to libc++. older systems don't even know this parameter
-        export SB3CPPFLAGS="${SB3CPPFLAGS} -stdlib=libstdc++" 
+        export SB3CPPFLAGS="${SB3CPPFLAGS} -stdlib=libstdc++"
       fi
       export FORBIDDENLIBS="libc++"
       export DISABLE_ICU=YES WITH_HARFBUZZ=NO #harfbuzz is disabled even tho ICU is too because harfbuzz has cyclic linking. old macho no likey
-      export USE_SYS_ZLIB=YES 
+      export USE_SYS_ZLIB=YES
   export USE_SYS_SQLITE=YES # USE_SYS_CURL=YES
       ;;
     10.7|10.8|10.9|10.10)
@@ -1662,9 +1736,9 @@ if isDarwin ; then
       export SB3LDFLAGS="-isysroot ${SYSROOT} ${CPUFLAGS} -L${BASE}/lib/gcc/${GFORTRANPLATFORM}/${GFORTRANVERSION}/ -lc++ -lc++abi -headerpad_max_install_names -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" #--sysroot=$SYSROOT"
       export SB3CPPFLAGS="-stdlib=libc++ -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" #--sysroot=$SYSROOT"
       export FORBIDDENLIBS="libstdc++"
-      export USE_SYS_ZLIB=YES 
+      export USE_SYS_ZLIB=YES
       export USE_SYS_SQLITE=YES USE_SYS_CURL=YES
-      export USE_MAC_LIBTOOL=YES
+      export USE_PORTABLE_LIBTOOL=YES
       ;;
     10.11|10.12)
       # known issues with 10.11+:
@@ -1676,13 +1750,13 @@ if isDarwin ; then
       export SB3LDFLAGS="-isysroot ${SYSROOT} ${CPUFLAGS} -L${BASE}/lib/gcc/${GFORTRANPLATFORM}/${GFORTRANVERSION}/ -lc++ -lc++abi -headerpad_max_install_names -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" #--sysroot=$SYSROOT"
       export SB3CPPFLAGS="-stdlib=libc++ -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" #--sysroot=$SYSROOT"
       export FORBIDDENLIBS="libstdc++,libssl"
-      export USE_MAC_LIBTOOL=YES
-      export IGNORE_PIP=YES
+      export USE_PORTABLE_LIBTOOL=YES
+      export IGNORE_PIP=YES #PIP's expectation of ssl borks everything
       ;;
     *)
       oops "Untested deployment target Mac OS X $MACOSX_DEPLOYMENT_TARGET"
       ;;
-  esac  
+  esac
   _find_cots THINEFORTRAN gfortran $BASE/sysbin $SYSROOT/bin /usr/bin /opt/bin /sw/bin /usr/local/bin || echo gfortran not found
   if [ -z "$THINEFORTRAN" ] ; then
     echo "No Fortran found. Continuing without."
@@ -1704,13 +1778,14 @@ if isDarwin ; then
   export LDFLAGS="$SB3FLAGS $SB3LDFLAGS $LDFLAGS" LFLAGS="$SB3FLAGS $SB3LDFLAGS $LDFLAGS" FFLAGS="$SB3FLAGS ${SB3FFLAGS} $FFLAGS"
   export PATH=$BASE/sysbin:$BASE/sbin:$BASE/bin:${SYSROOT}/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
   export USE_SYS_OPENCL=YES USE_SYS_BLAS=YES USE_SYS_LAPACK=YES
-  export USE_MAC_OPENCL=YES USE_MAC_BLAS=YES USE_MAC_LAPACK=YES
+  export USE_PORTABLE_OPENCL=YES USE_PORTABLE_BLAS=YES USE_PORTABLE_LAPACK=YES
   export CC="/usr/bin/clang $SB3FLAGS" CXX="/usr/bin/clang++ $SB3CPPFLAGS $SB3CXXFLAGS $SB3FLAGS" CPP="cpp $SB3CPPFLAGS"
   if [ -n "$THINEFORTRAN" ] ; then
   export F77="${FC} $SB3FLAGS ${SB3FFLAGS}" F90="${FC} $SB3FLAGS ${SB3FFLAGS}"
   export F95="${FC} $SB3FLAGS ${SB3FFLAGS}" FC="${FC} $SB3FLAGS ${SB3FFLAGS}"
   fi
   export LINUXCPUFLAGS="-fPIC ${OPTIMIZEFLAGS}"
+  export WITHOUT_X11=YES
   if [ -z "${PORTABLESHELLB3}" ] ; then
     export PORTABLESHELLB3=YES
   fi
@@ -1725,17 +1800,55 @@ elif isLinux ; then
     export MACHTYPE=${CPUTYPE}
   fi
 
+  echo "Checking for bundled compilers"
+  _find_cots ACLANG clang $BASE/sysbin $BASE/bin || echo bundled clang not found
+  _find_cots AGCC gcc $BASE/sysbin $BASE/bin || echo bundled gcc not found
+  export BUNDLED_COMPILER=NO USING_CLANG=NO
+  if [ -n "$ACLANG" ]; then
+    export BUNDLED_COMPILER=YES USING_CLANG=YES
+    export CC=$ACLANG/clang
+    _find_cots ACLANGXX clang++ $ACLANG && export CXX=${ACLANGXX}/clang++
+    _find_cots ACLANGCPP clang-cpp $ACLANG && export CPP=${ACLANGCPP}/clang-cpp
+  elif [ -n "$AGCC" ]; then
+    export BUNDLED_COMPILER=YES
+    export CC=$AGCC/gcc
+    _find_cots AGXX g++ $AGCC && export CXX=${AGXX}/g++
+    _find_cots ACPP cpp $AGCC && export CPP=${ACPP}/cpp
+  fi
+  if isTrue BUNDLED_COMPILER ; then
+    _find_cots AGFORTRAN gfortran $BASE/sysbin $BASE/bin && export FC=${AGFORTRAN}/gfortran
+    _find_cots ALD ld $BASE/sysbin $BASE/bin && export LD=${ALD}/ld
+  fi
+
+  if [ -z "$FC" ] ; then
+    export FC=gfortran
+  fi
+
+  if [ -n "$( find lib* -name dragonegg.so 2> /dev/null )" ] ; then
+    if [ $( find lib* -name dragonegg.so | grep . -c ) -ne 1 ] ; then
+      oops "Too many DragonEggs to figure out sanity"
+    else
+      export FC="$FC -fplugin=$(find ${BASE}/*ib* -name dragonegg.so)"
+      echo "Using DragonEgg (GCC + LLVM) for Fortran compilation!"
+      export F77="${FC}" F90="${FC}" F95="${FC}"
+    fi
+  fi
+
   if [ -n "$( echo "x86_64 i386 i686" | grep "${CPUTYPE}" )" ] ; then
     export LINUXCPUFLAGS="-fPIC -msse4a"
   else
     export LINUXCPUFLAGS="-fPIC"
   fi
-  export CFLAGS="$LINUXCPUFLAGS -fno-strict-aliasing"
+  export CFLAGS="$CFLAGS -I${BASE}/include  $LINUXCPUFLAGS -fno-strict-aliasing ${SB3FLAGS}"
+  if isTrue USING_CLANG ; then
+  export CXXFLAGS="$CXXFLAGS -I${BASE}/include $LINUXCPUFLAGS -fno-strict-aliasing ${SB3FLAGS}"
+  export FCFLAGS="$FCFLAGS -I${BASE}/include ${SB3FLAGS}"
+  fi
   export PATH=$BASE/sysbin:$BASE/bin:${SYSROOT}/usr/bin:$PATH
   export USE_SYS_ZLIB=YES USE_SYS_JPEG=YES
   export USE_SYS_PKGCONFIG=NO
   export USE_SYS_TIFF=YES
-  export BUILD_CLANG=YES
+  export BUILD_CLANG=YES #if a trim wants to build LLVM, this will tell it to also build clang
   if isDebianLinux ; then
     export USE_SYS_OPENCL=YES USE_SYS_ICU=YES #USE_SYS_BOOST=YES
     export USE_SYS_FFI=YES USE_SYS_CURL=YES
@@ -1787,7 +1900,7 @@ if buildPortable ; then
   _find_cots BZ2LIB include/bzlib.h $BASE $COTS_HOME ${SYSROOT}/usr && oops "Portability requires bzlib headers be uninstalled"
   _find_cots SSLLIB include/openssl/ssl.h $BASE $COTS_HOME ${SYSROOT}/usr && oops "Portability requires openssl headers be uninstalled"
   _find_cots NCURSES include/ncurses.h $BASE $COTS_HOME ${SYSROOT}/usr && oops 'Portability requires ncurses headers be uninstalled'
-  export FORBIDDENLIBS="libssl,libbz2,libncurses"
+  export FORBIDDENLIBS="$FORBIDDENLIBS,libssl,libbz2,libncurses"
   fi
 fi
 
@@ -1800,7 +1913,7 @@ _get_library_from_name() {
         oops "could not find $2 library from $1"
       else
         echo $lddout
-      fi      
+      fi
   elif isLinux ; then
       local lddout=$(ldd $1 |awk "/$2/"' { print $3; }')
       if [ "$lddout" == "not" ]; then
@@ -1809,14 +1922,14 @@ _get_library_from_name() {
         echo $lddout
       fi
   else
-      oops "Unknown binary system for " ${SYSNAME}     
+      oops "Unknown binary system for " ${SYSNAME}
   fi
 }
 
 # find the non-/lib* DLLs used by a binary
 # _pydling stdcxx depends
 # T~T paain
-_pydling_elf() { 
+_pydling_elf() {
 ldd "$1" >/tmp/.tmp.$$ || oops "could not ldd $1"
 ${PYTHON} - /tmp/.tmp.$$ "$2" <<SOSAYWEALL || echo "missing library dependency for $1"
 from __future__ import print_function,absolute_import,division,unicode_literals
@@ -1830,7 +1943,7 @@ for line in open(sys.argv[1], 'rt'):
         if s=='not':
             print("ERROR: %s" % line)
             raise ValueError
-        if s.startswith('/lib'): 
+        if s.startswith('/lib'):
             continue
         fpo.write(s+'\n')
 SOSAYWEALL
@@ -1851,7 +1964,7 @@ for line in open(sys.argv[1], 'rt'):
         if s=='not':
             print("ERROR: %s" % line)
             raise ValueError
-        if s.startswith('/lib'): 
+        if s.startswith('/lib'):
             continue
         fpo.write(s+'/n')
 SOSAYWEALL
@@ -1864,7 +1977,7 @@ _pydling() {
   elif isLinux ; then
       _pydling_elf $*
   else
-      oops "Unknown binary system for " ${SYSNAME}     
+      oops "Unknown binary system for " ${SYSNAME}
   fi
 }
 
@@ -1880,14 +1993,15 @@ int main(int argc, char *argv[])
 }
 EOF
     if [ -z "$CC" ] ; then
-      _tmpenvset CC gcc
+      MYCC=gcc
     else
-      _tmpenvset CC "$CC"
+      MYCC="$CC"
     fi
-    $CC $CFLAGS $LDFLAGS "$@" -o libcver libcver.c >/dev/null 2>/dev/null || oops "could not compile C library probe"
+
+    $MYCC $CFLAGS $LDFLAGS "$@" -o libcver libcver.c >/dev/null 2>/dev/null || oops "could not compile C library probe"
     export LIBCVER=$( ./libcver )
     echo $LIBCVER
-    _tmpenvres CC
+
     rm -fr libcver libcver.c
 }
 
@@ -1901,13 +2015,14 @@ int main(int argc, char *argv[])
 }
 EOF
     if [ -z "$CXX" ] ; then
-      _tmpenvset CXX g++
+      MYCXX=g++
     else
-      _tmpenvset CXX "$CXX"
+      MYCXX="$CXX"
     fi
-    $CXX $CXXFLAGS "$@" -o stdcxx stdcxx.cc -lstdc++ >/dev/null 2>/dev/null || oops "could not compile C++ library probe"
+
+    $MYCXX $CXXFLAGS "$@" -o stdcxx stdcxx.cc -lstdc++ >/dev/null 2>/dev/null || oops "could not compile C++ library probe"
     _pydling stdcxx requires || oops "could not discover C++ runtime libraries"
-    _tmpenvres CXX
+
     rm -fr stdcxx stdcxx.cc
 }
 
@@ -1916,21 +2031,22 @@ _find_libgfortran() {
   cat >stdf9x.f90 <<EOF
 program HelloWorld
     write(*,*) "Oh no, not again."
-end program 
+end program
 EOF
     if [ -z "$F90" ] ; then
       if [ -z "$FC" ] ; then
-        _tmpenvset F90 gfortran
+        MYF90=gfortran
       else
-        _tmpenvset F90 "$FC"
+        MYF90="$FC"
       fi    
     else
-      _tmpenvset F90 "$F90"
+      MYF90="$F90"
     fi    
-    $F90 $FFLAGS $F90FLAGS "$@" -o stdf9x stdf9x.f90 >/dev/null 2>/dev/null || oops "could not compile fortran library probe"
+
+    $MYF90 $FFLAGS $F90FLAGS "$@" -o stdf9x stdf9x.f90 >/dev/null 2>/dev/null || oops "could not compile fortran library probe"
     _pydling stdf9x requires || oops "could not discover gfortran runtime libraries"
-    _tmpenvres F90
-    rm -f stdf9x stdf9x.f90 
+
+    rm -f stdf9x stdf9x.f90
 }
 
 reid() {
@@ -1958,11 +2074,11 @@ reid_all() {
 
 mk_zlib() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_ZLIB && return 0 
+  useSysCheck USE_SYS_ZLIB && return 0
   #_find_cots ZLIB lib/zlib.h $COTS_HOME && return 0
   #_configure_make_install zlib src/zlib-${ZLIBVER}.tar.* zlib-${ZLIBVER}/
   name=zlib
-  tarball=src/zlib-${ZLIBVER}.tar.* 
+  tarball=src/zlib-${ZLIBVER}.tar.*
   buildir=zlib-${ZLIBVER}/
 
   rm -rf build/${buildir}
@@ -1997,15 +2113,15 @@ mk_zlib() {
 
 mk_libxml() { # libxml2-2.7.8.tar.gz
   resume_tracker && return 0
-  useSysCheck USE_SYS_XML && return 0 
+  useSysCheck USE_SYS_XML && return 0
   _find_cots ZLIB include/zlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "need ZLIB"
   _configure_make_install libxml2 src/libxml2-${LIBXMLVER}.tar.* libxml2-${LIBXMLVER} --with-zlib=$ZLIB --without-python --with-lzma=${BASE}
-}  
+}
 
 mk_xz() {
   resume_tracker && return 0
   _configure_make_install xz src/xz-${XZVER}.tar.* xz-${XZVER}
-}  
+}
 
 mk_nodejs() {
   resume_tracker && return 0
@@ -2015,7 +2131,7 @@ mk_nodejs() {
 mk_lzo() {
   resume_tracker && return 0
   _configure_make_install lzo src/lzo-${LZOVER}.tar.* lzo-${LZOVER} --enable-shared
-}  
+}
 
 mk_db48() {
   resume_tracker && return 0
@@ -2061,19 +2177,19 @@ SOSAYWEALL
   _configure_make_install db48 src/db-${DB48VER}.tar.* db-${DB48VER}/build_unix --enable-cxx ${DBPARMS} \
     --includedir=${BASE}/include/db48
   chmod +w bin/db_*
-}  
+}
 
 mk_sqlite() { # sqlite-autoconf-3071200.tar.gz
   resume_tracker && return 0
-  useSysCheck USE_SYS_SQLITE && return 0 
+  useSysCheck USE_SYS_SQLITE && return 0
   if [ -z "$CC" ] ; then
     MYCC=gcc
   else
     MYCC=$CC
   fi
-  _tmpenvset CC "${MYCC} ${CFLAGS}"
-  _configure_make_install sqlite src/sqlite-autoconf-${SQLITEVER}.tar.* sqlite-autoconf-${SQLITEVER}
-  _tmpenvres CC
+
+  CC="${MYCC} ${CFLAGS}" _configure_make_install sqlite src/sqlite-autoconf-${SQLITEVER}.tar.* sqlite-autoconf-${SQLITEVER}
+
 }
 
 mk_jpeg() {
@@ -2090,7 +2206,7 @@ mk_tiff() {
   _find_cots ZLIB include/zlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "TIFF requires zlib"
   _find_cots JPEG include/jpeglib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "TIFF needs JPEG"
   ADDITIONALFLAGS=""
-  isDarwin && ADDITIONALFLAGS="--without-x"
+  isTrue WITHOUT_X11 && ADDITIONALFLAGS="--without-x"
   _configure_make_install libtiff src/tiff-${TIFFVER}.tar.gz tiff-${TIFFVER} \
     --with-zlib-include-dir=$ZLIB/include --with-zlib-lib-dir=$ZLIB/lib \
     --with-jpeg-include-dir=$JPEG/include --with-jpeg-lib-dir=$JPEG/lib $ADDITIONALFLAGS
@@ -2098,40 +2214,35 @@ mk_tiff() {
 
 mk_png() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_PNG && return 0 
+  useSysCheck USE_SYS_PNG && return 0
   #_find_cots PNG bin/libpng-config $BASE $COTS_HOME && return 0
   _find_cots ZLIB include/zlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "PNG requires zlib"
+  _find_cots_lib ZLIB libz $ZLIB || oops "PNG requires zlib"
   # PNGlib, you are a yutz.
-  name=libpng
-  tarball=src/optional/libpng-${PNGVER}.tar.gz
-  buildir=libpng-${PNGVER}
-  echo unpacking ${name}...
-  tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
-  [ -e ${ZLIB}/lib/libz.a ] && sed -i.bak -e "s:-lz:${ZLIB}/lib/libz.a:g" build/${buildir}/configure
-  echo "building ${name} for $BASE"
-  (cd build/${buildir} \
-   && export CFLAGS="-I$ZLIB/include -L$ZLIB/lib $CFLAGS" \
-   && ./configure --prefix=$BASE ${SB3BUILDFLAGS} --with-pic --with-pkgconfigdir=${BASE}/lib/pkgconfig --with-zlib-prefix=$ZLIB "$@" \
-   && make \
-   && MAKEFLAGS="" make install ) \
-   || oops "${name} build failed"   
+
+  make_script libpng <<SCRIPT
+if [ "$(basename ${ZLIBLIBFILE})" == "libz.a" ] ; then
+sed -i.bak -e "s:-lz:${ZLIBLIBFILE}:g" configure
+fi
+SCRIPT
+
+  CFLAGS="-I$ZLIB/include -L$ZLIBLIBDIR $CFLAGS" \
+    _configure_make_install libpng src/optional/libpng-${PNGVER}.tar.gz libpng-${PNGVER} \
+    --with-pic --with-pkgconfigdir=${BASE}/lib/pkgconfig --with-zlib-prefix=$ZLIB "$@"
 }
 
-mk_harfbuzz() {
+_mk_harfbuzz() {
   resume_tracker && return 0
   #make harfbuzz and remake freetype
   isTrue WITH_HARFBUZZ || return 0
   ( mk_glib && mk__harfbuzz && mk_freetype --with-harfbuzz=yes ) || oops "HARFBUZZ FAIL"
 }
 
-mk_icu() { 
+mk_icu() {
   resume_tracker && return 0
   _find_cots ICU bin/icu-config $BASE && return 0
   useSysCheck USE_SYS_ICU && return 0
-  useSysCheck DISABLE_ICU && return 0
-  if ( isLinux && _exists clang ) ; then
-    oops "building with clang in the path on linux is not supported"
-  fi
+  isTrue DISABLE_ICU && return 0
   fixla
   _configure_make_install ICU src/optional/icu4c-${ICUVER}-src.* icu/source --sbindir=${BASE}/sysbin
   if isDarwin ; then
@@ -2146,12 +2257,15 @@ mk_icu() {
   fi
   reid lib/libicu*
   return 0
-}  
+}
 
-mk__glib() { 
+mk__glib() {
   resume_tracker && return 0
   isDarwin && return 0
   fixla
+  
+  _find_cots_lib PCRE libpcre $BASE ${SYSROOT}/usr || oops "glib needs pcre" 
+  _find_cots PCREINC include/pcre.h $PCRE || oops "glib needs pcre headers" 
 
   make_patch glib <<PATCH
 diff -ru gmessages.c glib/gmessages.c
@@ -2180,7 +2294,7 @@ diff -ru gmessages.c glib/gmessages.c
      {
 PATCH
 
-  _configure_make_install glib src/optional/glib-${GLIBVER}.tar.* glib-${GLIBVER} --disable-dtrace --disable-libmount
+  PCRE_CFLAGS="-I${PCRE}/include" PCRE_LIBS="-L${PCRELIBDIR} -lpcre" _configure_make_install glib src/optional/glib-${GLIBVER}.tar.* glib-${GLIBVER} --disable-dtrace --disable-libmount
   return 0
 }
 
@@ -2192,7 +2306,7 @@ mk_gettext() {
   return 0
 }
 
-mk__harfbuzz() { 
+mk__harfbuzz() {
   resume_tracker && return 0
   _find_cots FFI ffi.h $BASE/include $BASE/include/ffi ${SYSROOT}/usr/include ${SYSROOT}/usr/include/ffi || _find_pkgconfig libffi || oops 'harfbuzz needs ffi'
   _find_cots FREETYPE bin/freetype-config $BASE $COTS_HOME || oops "harfbuzz needs freetype"
@@ -2202,7 +2316,7 @@ mk__harfbuzz() {
     --with-freetype=yes --with-cairo=yes \
     $( isTrue DISABLE_ICU && echo "--with-icu=no" ) 
   return 0
-}  
+}
 
 mk_freetype() {
   resume_tracker && return 0
@@ -2210,14 +2324,18 @@ mk_freetype() {
   _configure_make_install freetype src/optional/freetype-${FREETYPEVER}.tar.* freetype-${FREETYPEVER} \
        --with-harfbuzz=no "$@"
   return 0
-}  
+}
 
 mk_pcre() {
   resume_tracker && return 0
   fixla
-  _configure_make_install pcre src/optional/pcre-${PCREVER}.tar.* pcre-${PCREVER} --enable-unicode-properties "$@"
+  if have_cmake ; then
+    _cmake_make_install pcre src/optional/pcre-${PCREVER}.tar.* pcre-${PCREVER} -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON "$@"
+  else
+    _configure_make_install pcre src/optional/pcre-${PCREVER}.tar.* pcre-${PCREVER} --enable-unicode-properties "$@"
+  fi
   return 0
-}  
+}
 
 mk_stackless3(){
   resume_tracker && return 0
@@ -2228,7 +2346,7 @@ mk_stackless3(){
 @@ -624,8 +624,6 @@
      return PyStackless_CallCMethod_Main(&def, (PyObject *) self, "OO", klass, args);
  }
- 
+
 -static CHANNEL_SEND_EXCEPTION_HEAD(impl_channel_send_exception);
 -
  static PyObject *
@@ -2290,7 +2408,7 @@ _mk_pypy(){
   rm -rf build/${buildir}
 
   tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
-  
+
   make_patch ${name} <<PATCH
 diff -ru rpython/translator/platform/darwin.py rpython/translator/platform/darwin.py
 --- rpython/translator/platform/darwin.py  2016-03-27 10:25:31.000000000 -0500
@@ -2301,44 +2419,44 @@ diff -ru rpython/translator/platform/darwin.py rpython/translator/platform/darwi
  #
 -DARWIN_VERSION_MIN = '-mmacosx-version-min=10.6'
 +DARWIN_VERSION_MIN = '-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}'
- 
+
  class Darwin(posix.BasePosix):
      name = "darwin"
- 
+
      standalone_only = ('-mdynamic-no-pic',)
      shared_only = ()
- 
+
 -    link_flags = (DARWIN_VERSION_MIN,)
 -    cflags = ('-O3', '-fomit-frame-pointer', DARWIN_VERSION_MIN)
 +    link_flags = (DARWIN_VERSION_MIN,'-isysroot','${SYSROOT}')
 +    cflags = ('-O3', '-fomit-frame-pointer', DARWIN_VERSION_MIN,'-isysroot','${SYSROOT}')
- 
+
      so_ext = 'dylib'
 @@ -37,11 +37,11 @@
- 
+
      def _include_dirs_for_libffi(self):
          return self._pkg_config("libffi", "--cflags-only-I",
 -                                ['/usr/include/ffi'],
 +                                ['${FFI}'],
                                  check_result_dir=True)
- 
+
      def _library_dirs_for_libffi(self):
          return self._pkg_config("libffi", "--libs-only-L",
 -                                ['/usr/lib'],
 +                                ['${FFILLIBDIR}'],
                                  check_result_dir=True)
- 
+
 diff -ru rpython/translator/platform/linux.py rpython/translator/platform/linux.py
 --- rpython/translator/platform/linux.py  2016-03-27 10:25:31.000000000 -0500
 +++ rpython/translator/platform/linux.py  2016-04-17 16:50:33.000000000 -0500
 @@ -30,10 +30,10 @@
- 
+
      def _include_dirs_for_libffi(self):
          return self._pkg_config("libffi", "--cflags-only-I",
 -                                ['/usr/include/libffi'],
 +                                ['${FFI}'],
                                  check_result_dir=True)
- 
+
      def _library_dirs_for_libffi(self):
          return self._pkg_config("libffi", "--libs-only-L",
 -                                ['/usr/lib/libffi'],
@@ -2370,7 +2488,7 @@ PATCH
   else
     ( rsync -av build/${buildir}/target/pypy-nightly/ . && ./bin/pypy -c "import os; print 'Is good'" ) || oops "PyPy wouldn't run"
   fi
-  
+
   if isLinux ; then
     _tmpenvres LD_LIBRARY_PATH
   fi
@@ -2386,19 +2504,19 @@ PATCH
 
 mk_py() {
   resume_tracker && return 0
-  if [ -n "${MAKE_STACKLESS}" ] ; then
-    if [ -n "${MAKE_PYTHON3}" ] ; then
+  if isTrue MAKE_STACKLESS ; then
+    if isTrue MAKE_PYTHON3 ; then
       mk_stackless3 "$@"
     else
       mk_stackless2 "$@"
     fi
   else
-    if [ -n "${MAKE_PYTHON3}" ] ; then
+    if isTrue MAKE_PYTHON3 ; then
       mk_py3 "$@"
     else
       mk_py2 "$@"
     fi
-  fi     
+  fi
 }
 
 _mk_py() {
@@ -2442,9 +2560,13 @@ _mk_py() {
 }
 
 mk_atlas() { # FIXME: this does not complete
-  #oops "ATLAS build is nonfunctional" 
+  #oops "ATLAS build is nonfunctional"
   resume_tracker && return 0
-  #test -f $BASE/build/lapack-${LAPACKVER}/liblapack.a || oops "need to run mk_lapack prior to mk_atlas" 
+  #test -f $BASE/build/lapack-${LAPACKVER}/liblapack.a || oops "need to run mk_lapack prior to mk_atlas"
+
+  DESTDIR=$BASE _configure_make_install ATLAS src/optional/atlas${ATLASVER}.tar.bz2 ATLAS  -Fa alg -fPIC
+  return $?
+
   echo unpacking ATLAS...
   rm -rf build/ATLAS
   tar jxf src/optional/atlas${ATLASVER}.tar.bz2 -C build || oops "could not unpack ATLAS"
@@ -2462,26 +2584,21 @@ mk_atlas() { # FIXME: this does not complete
 mk_blas() {
   resume_tracker && return 0
   useSysCheck USE_SYS_BLAS && return 0 # mac has blas
-  isTrue USE_MAC_BLAS && return 0
+  isTrue USE_PORTABLE_BLAS && return 0
   echo unpacking blas...
   tar zxf src/blas-${BLASVER}.tgz -C build || oops "could not unpack blas"
 
-  if [ -z "$FC" ] ; then
-    _tmpenvset FC gfortran
-  else
-    _tmpenvset FC "$FC"
-  fi
   ${PYTHON} <<EOF
-import sys, fileinput
+import sys, fileinput, os
 for line in fileinput.input('build/BLAS-${BLASVER}/make.inc', inplace=1):
   if line.startswith('OPTS') or line.startswith('NOOPT'):
     sys.stdout.write(line.replace('=', '= $LINUXCPUFLAGS $SB3FLAGS'))
-  elif line.startswith('FORTRAN') or line.startswith('LOADER'):
-    sys.stdout.write(line.replace('gfortran', '$FC'))
+  elif (line.startswith('FORTRAN') or line.startswith('LOADER')) and 'FC' in os.environ:
+    sys.stdout.write(line.replace('gfortran', os.environ['FC']))
   else:
     sys.stdout.write(line)
 EOF
-  _tmpenvres FC
+
   echo "building blas..."
   (cd build/BLAS-${BLASVER} \
    && make \
@@ -2491,34 +2608,24 @@ EOF
 mk_cblas() {
   resume_tracker && return 0
   useSysCheck USE_SYS_BLAS && return 0 # mac has cblas
-  isTrue USE_MAC_BLAS && return 0
+  isTrue USE_PORTABLE_BLAS && return 0
   echo unpacking cblas...
   tar zxf src/cblas.tgz -C build || oops "could not unpack cblas"
   cp -f build/CBLAS/Makefile.LINUX build/CBLAS/Makefile.in 
-  if [ -z "$FC" ] ; then
-    _tmpenvset FC gfortran
-  else
-    _tmpenvset FC "$FC"
-  fi
-  if [ -z "$CC" ] ; then
-    _tmpenvset CC gcc
-  else
-    _tmpenvset CC "$CC"
-  fi
+
   ${PYTHON} <<EOF
-import sys, fileinput
+import sys, fileinput, os
 for line in fileinput.input('build/CBLAS/Makefile.in', inplace=1):
-  if line[:6] in ('CFLAGS', 'FFLAGS'): 
+  if line[:6] in ('CFLAGS', 'FFLAGS'):
     sys.stdout.write(line.replace('=', '= $LINUXCPUFLAGS $SB3FLAGS'))
-  elif line.startswith('FC'):
-    sys.stdout.write(line.replace('gfortran', '$FC'))
-  elif line.startswith('CC'):
-    sys.stdout.write(line.replace('gcc', '$CC'))
+  elif line.startswith('FC') and 'FC' in os.environ:
+    sys.stdout.write(line.replace('gfortran', os.environ['FC']))
+  elif line.startswith('CC') and 'CC' in os.environ:
+    sys.stdout.write(line.replace('gcc', os.environ['CC']))
   else:
     sys.stdout.write(line)
 EOF
-  _tmpenvres CC
-  _tmpenvres FC
+
   echo "building cblas..."
   (cd build/CBLAS \
    && make alllib \
@@ -2542,37 +2649,28 @@ mk_openblas() {
 mk_lapack() {
   resume_tracker && return 0
   useSysCheck USE_SYS_LAPACK && return 0 # mac has lapack
-  isTrue USE_MAC_LAPACK && return 0
+  isTrue USE_PORTABLE_LAPACK && return 0
   _find_cots_lib BLAS libblas $BASE $COTS_HOME ${SYSROOT}/usr || oops "lapack requires blas"
   echo unpacking lapack...
   tar zxf src/lapack-${LAPACKVER}.tgz -C build || oops "could not unpack lapack"
-  if [ -z "$FC" ] ; then
-    _tmpenvset FC gfortran
-  else
-    _tmpenvset FC "$FC"
-  fi
-  if [ -z "$CC" ] ; then
-    _tmpenvset CC gcc
-  else
-    _tmpenvset CC "$CC"
-  fi
+
   cp build/lapack-${LAPACKVER}/INSTALL/make.inc.gfortran build/lapack-${LAPACKVER}/make.inc 
+
   ${PYTHON} <<EOF
-import sys, fileinput
+import sys, fileinput, os
 for line in fileinput.input('build/lapack-${LAPACKVER}/make.inc', inplace=1):
   if line.startswith('OPTS') or line.startswith('NOOPT'):
     sys.stdout.write(line.replace('=', '= $LINUXCPUFLAGS $SB3FLAGS'))
   elif line.startswith('BLASLIB'):
     sys.stdout.write('BLASLIB = ${BLASLIBFILE}\n')
-  elif line.startswith('FC') or line.startswith('FORTRAN') or line.startswith('LOADER'):
-    sys.stdout.write(line.replace('gfortran', '$FC'))
-  elif line.startswith('CC'):
-    sys.stdout.write(line.replace('gcc', '$CC'))
+  elif (line.startswith('FC') or line.startswith('FORTRAN') or line.startswith('LOADER')) and 'FC' in os.environ:
+    sys.stdout.write(line.replace('gfortran', os.environ['FC']))
+  elif line.startswith('CC') and 'CC' in os.environ:
+    sys.stdout.write(line.replace('gcc', os.environ['CC']))
   else:
     sys.stdout.write(line)
 EOF
-  _tmpenvres CC
-  _tmpenvres FC
+
   sed -i.bak -e 's, -frecursive,,g' `find build/lapack-${LAPACKVER}/ -name "make.inc*"`
   echo building lapack...
   (cd build/lapack-${LAPACKVER} \
@@ -2582,7 +2680,7 @@ EOF
 
 mk_numpy() {
   resume_tracker && return 0
-  echo unpacking numpy... 
+  echo unpacking numpy...
   _find_cots_lib BLAS libblas $BASE $COTS_HOME ${SYSROOT}/usr ||  oops "numpy requires blas"
   _find_cots_lib CBLAS libcblas $BASE $COTS_HOME ${SYSROOT}/usr ||  oops "numpy requires cblas"
   _find_cots_lib LAPACK liblapack $BASE $COTS_HOME ${SYSROOT}/usr ||  oops "numpy requires lapack"
@@ -2640,7 +2738,7 @@ diff -ru numpy/distutils/system_info.py numpy/distutils/system_info.py
 -        if sys.platform == 'darwin':
 -            exts.append('.dylib')
          return exts
- 
+
      def check_libs(self, lib_dirs, libs, opt_libs=[]):
 @@ -1666,6 +1666,7 @@
      def calc_info(self):
@@ -2666,7 +2764,7 @@ diff -ru numpy/distutils/system_info.py numpy/distutils/system_info.py
 +            elif 'cblas' in info['libraries']:
 +                info['define_macros'] = [('HAVE_CBLAS', None)]
          self.set_info(**info)
- 
+
      def has_cblas(self, info):
 PATCH
   _setup_build_install numpy src/numpy-${NUMPYVER}.* numpy-${NUMPYVER} --fcompiler=gnu95 || oops "numpy build failed"
@@ -2677,40 +2775,31 @@ PATCH
 mk_pyproj() {
   resume_tracker && return 0
 
+  export PROJ_DIR=$BASE
+
   _setup_build_install numpy src/pyproj-${PYPROJVER}.tar.gz pyproj-${PYPROJVER} || oops "pyproj build failed"
 }
 
 
 mk_jasper() {
   resume_tracker && return 0
-  rm -rf build/jasper-${JASPERVER}
-  echo unpacking jasper...
-  (cd build && unzip ../src/jasper-${JASPERVER}*.zip) \
-   || oops "could not unpack jasper from src/"
-  echo "building jasper for $BASE"
-  (cd build/jasper-${JASPERVER} \
-   && ./configure --prefix=$BASE --disable-libjpeg ${SB3BUILDFLAGS} \
-   && make \
-   && MAKEFLAGS="" make install ) \
-   || oops "jasper build failed"
+
+  _configure_make_install jasper src/jasper-${JASPERVER}*.zip jasper-${JASPERVER} --disable-libjpeg
 }
 
 mk_gribapi() {
   resume_tracker && return 0
-  echo unpacking grib_api...
-  tar zxf src/grib_api-${GRIBAPIVER}.tar.gz -C build || oops "could not unpack grib_api from src/"
-  echo "building grib_api for $BASE"
+ 
+  #FOR SOME REASON, python must be configured and semi-work, even tho we don't want it. unset PYTHON to let it use the system's
+
   if [ -z "$CC" ] ; then
     MYCC=gcc
   else
     MYCC=$CC
-  fi #FOR SOME REASON, python must be configured and semi-work, even tho we don't want it. unset PYTHON to let it use the system's
-  (cd build/grib_api-${GRIBAPIVER} \
-   && export CC="${MYCC} ${CFLAGS}" && unset PYTHON \
-   && ./configure --disable-fortran --disable-python ${SB3BUILDFLAGS}  --prefix=$BASE --with-jasper=$BASE \
-   && make \
-   && MAKEFLAGS="" make install ) \
-   || oops "gribapi build failed"
+  fi
+
+  CC="${MYCC} ${CFLAGS}" PYTHON="" _configure_make_install grib_api src/grib_api-${GRIBAPIVER}.tar.gz grib_api-${GRIBAPIVER}/ \
+      --disable-python --with-jasper=$BASE
 }
 
 mk_pygrib() {
@@ -2720,10 +2809,10 @@ mk_pygrib() {
   _find_cots ZLIB include/zlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "PYGRIB needs ZLIB"
   _find_cots JPEG include/jpeglib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "PYGRIB needs JPEG"
   _find_cots JASPER include/jasper/jas_image.h $BASE $COTS_HOME || oops "PYGRIB needs JASPER"
-  echo extracting pygrib...
-  tar zxf src/pygrib-${PYGRIBVER}.tar.gz -C build || oops "could not unpack pygrib source from src/"
+
+  make_script pygrib <<SCRIPT
   echo making setup.cfg
-  cat > build/pygrib-${PYGRIBVER}/setup.cfg <<SOSAYWEALL
+  cat > setup.cfg <<SETUPCFG
 [directories]
 grib_api_dir = ${GRIB}
 jasper_dir = ${JASPER}
@@ -2731,14 +2820,15 @@ jasper_dir = ${JASPER}
 png_dir = ${PNG}
 zlib_dir = ${ZLIB}
 #man_dir = /usr/local/man
-SOSAYWEALL
+SETUPCFG
+
   echo patching pygrib
-  ( cd build/pygrib-${PYGRIBVER} && cp pygrib.pyx pygrib.pyx_ORIG && patch -l -p0 && cython -o pygrib.c pygrib.pyx ) <<SOSAYWEALL || oops "could not patch pygrib"
+  ( cp pygrib.pyx pygrib.pyx_ORIG && patch -l -p0 && ${PYTHON} ${BASE}/bin/cython -o pygrib.c pygrib.pyx ) <<PATCH || oops "could not patch pygrib"
 diff -ru pygrib.pyx pygrib.pyx
 --- pygrib.pyx  2014-12-29 15:26:30.000000000 -0600
 +++ pygrib.pyx  2015-03-06 12:49:36.447780380 -0600
 @@ -173,4 +173,16 @@
- 
+
 +
 +# use relative paths for gribapi libraries
 +# RKG 2011.09
@@ -2757,41 +2847,34 @@ diff -ru pygrib.pyx pygrib.pyx
 @@ -698,6 +710,8 @@
      grb._set_projparams() # set projection parameter dict.
      return setdates(grb)
- 
+
 +cdef class gribmessage
 +
  def setdates(gribmessage grb):
      """
      setdates(grb)
-SOSAYWEALL
-  echo "building pygrib for $BASE..."
-  (cd build/pygrib-${PYGRIBVER} \
-   && ${PYTHON} setup.py build \
-   && ${PYTHON} setup.py install ${PYTHON_OPTIMIZATION} ) \
-   || oops "pygrib build failed"
+PATCH
+SCRIPT
+
+  _setup_build_install pygrib src/pygrib-${PYGRIBVER}.tar.gz pygrib-${PYGRIBVER}/
+
   isDarwin && if [ -e Library/Frameworks/Python.framework/Versions/${PYFSVER}/Resources/Python.app/Contents/share ] ; then echo -n ; else \
     ln -s ../../../../../../../../share Library/Frameworks/Python.framework/Versions/${PYFSVER}/Resources/Python.app/Contents/share ; fi
+
   return 0
 }
 
 mk_szip() {
   resume_tracker && return 0
   _find_cots SZLIB include/szlib.h $COTS_HOME /usr && return 0
-  echo unpacking szip...
-  tar zxf src/szip-${SZIPVER}.tar.gz -C build || oops "could not unpack szip from src/"
-  echo "building szip for $BASE"
+
   if [ -z "$CC" ] ; then
     MYCC=gcc
   else
     MYCC=$CC
   fi
-  (cd build/szip-${SZIPVER} \
-   && export CC="${MYCC} ${CFLAGS}" \
-   && ./configure --prefix=$BASE ${SB3BUILDFLAGS} --enable-shared --with-pic\
-   && make \
-   && MAKEFLAGS="" make install ) \
-   || oops "szip build failed"
-   fixla
+
+  CC="${MYCC} ${CFLAGS}" _configure_make_install szip  src/szip-${SZIPVER}.tar.gz szip-${SZIPVER}/ --enable-shared --with-pic
 }
 
 mk_hdf5() {
@@ -2800,7 +2883,7 @@ mk_hdf5() {
   _find_cots SZLIB include/szlib.h $BASE $COTS_HOME ${SYSROOT}/usr || echo "WARING: HDF5 is building without szip"
   _find_cots ZLIB include/zlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "HDF5 requires zlib"
 
-  LDFLAGS="-L${SYSROOT}/usr/lib/system" _configure_make_install hdf5 src/hdf5-${HDF5VER}.tar.bz2 hdf5-${HDF5VER} \
+  _configure_make_install hdf5 src/hdf5-${HDF5VER}.tar.bz2 hdf5-${HDF5VER} \
       --enable-shared $( isDarwin && echo "--build=${PLATFORM}" ) --with-pic \
       --with-zlib=$ZLIB --enable-cxx --enable-fortran --with-pthread $( test -n "$SZLIB" && echo --with-szlib=$SZLIB )
 }
@@ -2821,8 +2904,8 @@ diff -ru setup.py setup.py
  # RUN_REQUIRES can be removed when setup.py test is removed
 -SETUP_REQUIRES = RUN_REQUIRES + [NUMPY_DEP, 'Cython>=0.19', 'pkgconfig']
 +SETUP_REQUIRES = RUN_REQUIRES + [NUMPY_DEP, 'Cython>=0.19']
- 
- 
+
+
  # --- Custom Distutils commands -----------------------------------------------
 diff -ru setup_build.py setup_build.py
 --- setup_build.py  2015-04-07 11:07:29.000000000 -0500
@@ -2832,9 +2915,9 @@ diff -ru setup_build.py setup_build.py
          """
          import numpy
 -        import pkgconfig
- 
+
          settings = COMPILER_SETTINGS.copy()
- 
+
          try:
 +            import pkgconfig
              if pkgconfig.exists('hdf5'):
@@ -2846,7 +2929,7 @@ diff -ru setup_build.py setup_build.py
              pass
 +        except ImportError:
 +            pass
- 
+
          settings['include_dirs'] += [numpy.get_include()]
          if config.mpi:
 diff -ru setup_configure.py setup_configure.py
@@ -2855,18 +2938,18 @@ diff -ru setup_configure.py setup_configure.py
 @@ -194,8 +194,6 @@
      import ctypes
      from ctypes import byref
- 
+
 -    import pkgconfig
--    
+-
      if sys.platform.startswith('darwin'):
          regexp = re.compile(r'^libhdf5.dylib')
      else:
 @@ -203,10 +201,14 @@
-         
+
      libdirs = ['/usr/local/lib', '/opt/local/lib']
      try:
 +        import pkgconfig
-+    
++
          if pkgconfig.exists("hdf5"):
             libdirs.extend(pkgconfig.parse("hdf5")['library_dirs'])
      except EnvironmentError:
@@ -2875,7 +2958,7 @@ diff -ru setup_configure.py setup_configure.py
 +        pass
      if hdf5_dir is not None:
          libdirs.insert(0, op.join(hdf5_dir, 'lib'))
- 
+
 SOSAYWEALL
   _setup_build_install h5py src/h5py-${H5PYVER}.tar.gz h5py-${H5PYVER}
 }
@@ -2896,7 +2979,27 @@ mk_numexpr() {
   _setup_build_install numexpr src/numexpr-${NUMEXPRVER}.tar.gz numexpr-${NUMEXPRVER}
 }
 
-mk_blosc() {
+mk_cblosc() {
+  resume_tracker && return 0
+
+  make_script c-blosc <<SCRIPT
+mkdir sb3_build 
+echo -n > sb3_build/CMakeCache.txt
+echo BUILD_TESTS:BOOL=OFF >> sb3_build/CMakeCache.txt
+if isLinux ; then
+  #this should take a -DDEACTIVATE_AVX2:BOOL=ON , but it sucks
+echo DEACTIVATE_AVX2:BOOL=ON >> sb3_build/CMakeCache.txt
+fi
+SCRIPT
+
+  _cmake_make_install c-blosc src/optional/c-blosc-${CBLOSCVER}.tar.* c-blosc-${CBLOSCVER}
+
+  reid lib*/libblosc*
+
+  return 0
+}
+
+mk_pyblosc() {
   resume_tracker && return 0
   _find_cots BLOSC include/blosc.h  $BASE $COTS_HOME
   if [ -n "${BLOSC}" ] ; then
@@ -2918,29 +3021,42 @@ diff -ru setup.py setup.py
          sources += [f for f in glob('c-blosc/blosc/*.c') if 'avx2' in f]
 PATCH
 
-  _setup_build_install blosc src/optional/blosc-${BLOSCVER}.tar.gz blosc-${BLOSCVER}
+  _setup_build_install blosc src/optional/blosc-${PYBLOSCVER}.tar.gz blosc-${PYBLOSCVER}
 }
 
 mk_pytables() {
   resume_tracker && return 0
+
+  PYTABLESEXTRA=""
+
   if notBuildPortable ; then
-    _find_cots BZIP2_DIR include/bzlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "need BZIP2 for pytables"  
-  fi
-  _find_cots HDF5 include/hdf5.h $BASE $COTS_HOME || oops "need HDF5 for pytables"  
-  export HDF5_DIR=$HDF5
-  _find_cots BLOSC include/blosc.h  $BASE $COTS_HOME
-  if [ -n "${BLOSC}" ] ; then
-    export BLOSC_DIR=${BLOSC}
+    _find_cots BZIP2 include/bzlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "need BZIP2 for pytables"
+    PYTABLESEXTRA="${PYTABLESEXTRA} --bzip2=${BZIP2}"
   fi
-  isDarwin && _tmpenvset LDFLAGS "$LDFLAGS -L${SYSROOT}/usr/lib"
-  echo extracting pytables...
-  tar zxf src/tables-${PYTABLESVER}.tar.gz -C build || oops "could not unpack pytables source from src/"
-  echo "building tables for $BASE..."
-  (cd build/tables-${PYTABLESVER} \
-   && ${PYTHON} setup.py build \
-   && ${PYTHON} setup.py install ${PYTHON_OPTIMIZATION} ) \
-   || oops "pytables build failed"
-  isDarwin && _tmpenvres LDFLAGS
+
+  make_patch pytables<<PATCH
+diff -ru setup.py setup.py
+--- setup.py  2017-07-20 16:09:10.000000000 -0500
++++ setup.py  2017-07-20 16:09:53.000000000 -0500
+@@ -139,7 +139,7 @@
+ 
+ 
+ if os.name == 'posix':
+-    prefixes = ('/usr/local', '/sw', '/opt', '/opt/local', '/usr', '/')
++    prefixes = ('${BASE}', '/usr', '/')
+ 
+     default_header_dirs = []
+     add_from_path("CPATH", default_header_dirs)
+PATCH
+
+  _find_cots HDF5 include/hdf5.h $BASE $COTS_HOME || oops "need HDF5 for pytables"
+  _find_cots BLOSC include/blosc.h  $BASE $COTS_HOME || oops "need cblosc for pytables"
+  _find_cots LZO include/lzo/lzoconf.h  $BASE $COTS_HOME || oops "need lzo for pytables"
+
+  USE_PKGCONFIG=FALSE _setup_build_install pytables src/tables-${PYTABLESVER}.tar.gz tables-${PYTABLESVER} \
+    ${PYTABLESEXTRA} --hdf5=${HDF5} --blosc=${BLOSC} --lzo=${LZO} \
+     --no-conda
+
   return 0
 }
 
@@ -2950,11 +3066,36 @@ mk_swig() {
   _configure_make_install swig src/swig-${SWIGVER}.tar.gz swig-${SWIGVER} --without-pcre -without-alllang --with-python
 }
 
+mk_metis() {
+  resume_tracker && return 0
+
+  have_cmake || return 0
+
+  make_script metis <<SCRIPT
+  echo make config shared=1 prefix=${BASE} >> configure
+  chmod +x configure
+SCRIPT
+
+  _configure_make_install metis src/metis-${METISVER}.tar.gz metis-${METISVER}/ || oops "metis did not build"
+
+  METISINSTALLED=$( find ${BASE}/*ib* -type f -name libmetis* )
+
+  reid ${METISINSTALLED}
+
+  if isDarwin ; then
+    for f in bin/*metis* bin/cmpfillin bin/graphchk ; do
+      install_name_tool -change libmetis.dylib ${METISINSTALLED} $f
+    done
+  fi
+  return 0
+
+}
+
 __ssmk() {
   resume_tracker && return 0
   ( cd build/SuiteSparse && make config \
    && make library \
-   && MAKEFLAGS="" make install ) || oops "BORK"
+   && MAKEFLAGS="" make install ) || return $?
 }
 
 mk_suitesparse() {
@@ -2962,21 +3103,23 @@ mk_suitesparse() {
   echo unpacking suitesparse...
   _find_cots_lib BLAS libblas $BASE $COTS_HOME ${SYSROOT}/usr ||  oops "suitesparse requires blas"
   _find_cots_lib LAPACK liblapack $BASE $COTS_HOME ${SYSROOT}/usr  || oops "suitesparse requires lapack"
+  _find_cots_lib METIS libmetis $BASE $COTS_HOME ${SYSROOT}/usr || export METISLIBFILE="/dev/null"
+  _find_cots_lib METISINC metislib.h $BASE/include $COTS_HOME/include ${SYSROOT}/usr/include || export METISLIBFILE="/dev/null"
 
   rm -rf build/SuiteSparse
   tar zxf src/SuiteSparse-${SUITESPARSEVER}.tar.gz -C build || oops "could not unpack suitesparse from src"
   if [ -z "$CC" ] ; then
-    _tmpenvset CC gcc
+    MYCC=gcc
   else
-    _tmpenvset CC "$CC"
+    MYCC="$CC"
   fi
 
   echo "building suitesparse for $BASE"
-  MY_METIS_LIB="/dev/null" GPU_CONFIG=-DNPARTITION CFLAGS="-fPIC $SB3FLAGS" CHOLMOD_CONFIG=-DNPARTITION CF="${CFLAGS} -O3 -fexceptions ${LINUXCPUFLAGS}" INSTALL="${BASE}" BLAS="-L${BLASLIBDIR} ${LDFLAGS} -lblas -lgfortran" LAPACK="-L${LAPACKLIBDIR} ${LDFLAGS} -llapack" __ssmk \
+  CC="$MYCC" MY_METIS_LIB="${METISLIBFILE}" MY_METIS_INC="${METISINC}" GPU_CONFIG=-DNPARTITION CFLAGS="-fPIC $SB3FLAGS" CHOLMOD_CONFIG=-DNPARTITION \
+    CF="${CFLAGS} -O3 -fexceptions ${LINUXCPUFLAGS}" INSTALL="${BASE}" CFOPENMP=" -fexceptions " \
+    BLAS="-L${BLASLIBDIR} ${LDFLAGS} -lblas -lgfortran" LAPACK="-L${LAPACKLIBDIR} ${LDFLAGS} -llapack" __ssmk \
    || oops "suitesparse build failed"
 
-  _tmpenvres CC
-
   return 0
 }
 
@@ -2986,11 +3129,9 @@ mk_scipy() {
   _find_cots_lib BLAS libblas $BASE $COTS_HOME ${SYSROOT}/usr || oops "scipy requires blas"
   _find_cots_lib LAPACK liblapack $BASE $COTS_HOME ${SYSROOT}/usr ||oops "scipy requires lapack"
 
-  isDarwin && _tmpenvset LDFLAGS "$LDFLAGS -bundle -undefined dynamic_lookup --sysroot=${SYSROOT}"
-  
-  _setup_build_install scipy src/scipy-${SCIPYVER}.* scipy-${SCIPYVER}
-  
-  isDarwin && _tmpenvres LDFLAGS
+  LDFLAGS="$LDFLAGS $( isDarwin && echo "-bundle -undefined dynamic_lookup --sysroot=${SYSROOT}" ) $( isLinux && echo " -shared -fPIC ")" \
+    _setup_build_install scipy src/scipy-${SCIPYVER}.* scipy-${SCIPYVER}
+
   isDarwin && for f in $( find Library/Frameworks/Python.framework/Versions/${PYFSVER}/lib/python${PYFSVER}/site-packages/scipy -type f -name "*.so" ) ; do \
         if [ -f $f -a -n "$(file $f | grep -i mach-o)" ] ; then install_name_tool -change /usr/local/lib/libgcc_s.1.dylib ${BASE}/lib/libgcc_s.1.dylib -change /usr/local/gfortran/lib/libgcc_s.1.dylib ${BASE}/lib/libgcc_s.1.dylib "$f" ; fi; \
       done
@@ -3004,10 +3145,6 @@ mk_scipy() {
 
 mk_eugene() {
   resume_tracker && return 0
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
-    #broken on py3
-    return 0
-  fi
 
   make_patch eugene <<SOSAYWEALL || oops "could not patch eugene"
 --- src/epsnodes.cpp  2010-02-02 06:14:38.000000000 -0600
@@ -3020,7 +3157,7 @@ mk_eugene() {
 + DataT::ascii_store(file,pos+32,v,BaseClass::length, true);
   file->write(pos+32+BaseClass::length, label+32, 1);
  }
- 
+
 @@ -131,14 +131,14 @@
  Variant EPSTextFieldNode<DataT>::retrieve(BinaryFile* file, off_t pos,
                       ArrayPositions* last_array_pos)
@@ -3028,7 +3165,7 @@ mk_eugene() {
 - return ascii_retrieve(file, pos+32, BaseClass::length);
 + return DataT::ascii_retrieve(file, pos+32, BaseClass::length);
  }
- 
+
  #ifdef PYEUGENE
  template <class DataT>
  PyObject* EPSTextFieldNode<DataT>::make_pyobject(BinaryFile* file, off_t pos, ArrayPositions* last_array_pos)
@@ -3037,26 +3174,146 @@ mk_eugene() {
 + return DataT::ascii_make_pyobject(file,pos+32,BaseClass::length);
  }
  #endif
- 
+
 --- src/pyeugene.cpp  2010-02-02 07:07:20.000000000 -0600
 +++ src/pyeugene.cpp 2013-11-11 14:47:34.000000000 -0600
-@@ -1184,7 +1184,7 @@
+@@ -457,7 +457,7 @@
+    Py_DECREF(*iter);
+     }
+     self->childs.~PyObjectList();
+-    self->ob_type->tp_free((PyObject*)self);
++    Py_TYPE(self)->tp_free((PyObject*)self);
+ }
+ 
+ extern "C" PyObject* PySection_str(PySection* self)
+@@ -526,7 +526,9 @@
+ 
+ static PyTypeObject PySectionType = {
+     PyObject_HEAD_INIT(NULL)
++#if PY_MAJOR_VERSION < 3
+     0,                             /*ob_size*/
++#endif
+     "pyeugene.Section",            /*tp_name*/
+     sizeof(PySection),             /*tp_basicsize*/
+     0,                             /*tp_itemsize*/
+@@ -644,7 +646,7 @@
+    delete self->file;
+    self->filename.~string();
+     }
+-    self->ob_type->tp_free((PyObject*)self);
++    Py_TYPE(self)->tp_free((PyObject*)self);
+ 
+ #ifdef INSTANCE_COUNT
+     obj_count--;
+@@ -1119,7 +1121,9 @@
+ 
+ static PyTypeObject PyProductType = {
+     PyObject_HEAD_INIT(NULL)
++#if PY_MAJOR_VERSION < 3
+     0,                             /*ob_size*/
++#endif
+     "pyeugene.Product",            /*tp_name*/
+     sizeof(PyProduct),             /*tp_basicsize*/
+     0,                             /*tp_itemsize*/
+@@ -1180,20 +1184,42 @@
+ 
+ PyDoc_STRVAR(pyeugene_doc, "Read and write access to binary files including EPS products\n\n");
+ 
++#if PY_MAJOR_VERSION >= 3
++static struct PyModuleDef __pyx_moduledef = {
++    PyModuleDef_HEAD_INIT,
++    "pyeugene",
++    pyeugene_doc, /* m_doc */
++    -1, /* m_size */
++    PyEugeneMethods /* m_methods */,
++    NULL, /* m_reload */
++    NULL, /* m_traverse */
++    NULL, /* m_clear */
++    NULL /* m_free */
++};
++#endif
++
+ //
  // Entry point from Python interpreter
  //
- 
+
 -extern "C" PyMODINIT_FUNC initpyeugene(void)
++#if PY_MAJOR_VERSION >= 3
++PyMODINIT_FUNC PyInit_pyeugene(void)
++#else
 +PyMODINIT_FUNC initpyeugene(void)
++#endif
  {
      putenv((char*)"TZ=UTC");
      tzset();
+ 
++#if PY_MAJOR_VERSION >= 3
++    PyObject* m = PyModule_Create(&__pyx_moduledef);
++#else
+     PyObject* m = Py_InitModule4("pyeugene",
+                 PyEugeneMethods,
+                 pyeugene_doc,
+                 NULL,
+                 PYTHON_API_VERSION);
++#endif
+ 
+     PyObject* md = PyModule_GetDict(m);
+     // version string, major, minor, trivial, svn info, build date
+@@ -1232,11 +1254,19 @@
+ 
+     if (PyType_Ready(&PyProductType) < 0)
+     {
++#if PY_MAJOR_VERSION >= 3
++    return m;
++#else
+    return;
++#endif
+     }
+     if (PyType_Ready(&PySectionType) < 0)
+     {
++#if PY_MAJOR_VERSION >= 3
++    return m;
++#else
+    return;
++#endif
+     }
+ //    if (PyType_Ready(&PyEPSArrayType) < 0)
+ //    {
+@@ -1254,7 +1276,9 @@
+  //cout << "About to cause memory leak\n";
+  //char* leaker = new char[10000];
+  //cout << "Leaker address " << (unsigned int)leaker << endl;
+-
++#if PY_MAJOR_VERSION >= 3
++    return m;
++#endif
+ }
+ 
+ PyObject* make_pyobject(const string& s)
 SOSAYWEALL
-  CPPFLAGS="-I${BASE}/include $SB3CPPFLAGS" LDFLAGS="-L${BASE}/lib $SB3LDFLAGS" EXTRA_INCS="${SB3CFLAGS}" \
+
+  if [ -e ${BASE}/bin/python${PYFSVER}m-config ] ; then
+    PCONFIG=${BASE}/bin/python${PYFSVER}m-config
+  else
+    PCONFIG=${BASE}/bin/python${PYFSVER}-config
+  fi
+  EUGENEEXTRAFLAGS="$( ${PCONFIG} --cflags )"
+  if isPython3 ; then
+    EUGENEEXTRAFLAGS="${EUGENEEXTRAFLAGS} -DPyString_AsString=PyBytes_AsString -DPyString_FromString=PyUnicode_FromString"
+    EUGENEEXTRAFLAGS="${EUGENEEXTRAFLAGS} -DPyInt_FromLong=PyLong_FromLong -DPyInt_AsLong=PyLong_AsLong -DPyInt_Check=PyLong_Check"
+    EUGENEEXTRAFLAGS="${EUGENEEXTRAFLAGS} -DPyString_Check=PyUnicode_Check -D_Py_ZeroStruct=_Py_FalseStruct"
+  fi
+
+  CPPFLAGS="-I${BASE}/include $SB3CPPFLAGS" CXXFLAGS="-I${BASE}/include $SB3CPPFLAGS ${EUGENEEXTRAFLAGS}" \
+    LDFLAGS="-L${BASE}/lib $SB3LDFLAGS" EXTRA_INCS="${SB3CFLAGS}" \
    EXTRA_DEFS="${SB3FLAGS}" PATH=${BASE}/bin:$PATH \
    _configure_make_install eugene src/optional/eugene-${EUGENEVER}.tar.gz eugene-${EUGENEVER}/ --with-pic --enable-python
 
+  PYFSVERT=$( echo lib/python* | sed s,lib/python,,g)
+
   patch -p0 <<SOSAYWEALL || oops "could not patch eugene to use run directory instead of absolute path"
---- lib/python${PYFSVER}/site-packages/eugene/__init__.py.orig 2011-09-21 14:44:02.000000000 -0500
-+++ lib/python${PYFSVER}/site-packages/eugene/__init__.py      2011-09-21 14:56:22.000000000 -0500
+--- lib/python${PYFSVERT}/site-packages/eugene/__init__.py.orig 2011-09-21 14:44:02.000000000 -0500
++++ lib/python${PYFSVERT}/site-packages/eugene/__init__.py      2011-09-21 14:56:22.000000000 -0500
 @@ -1 +1,7 @@
 +import os,sys
 +ops = os.path.split
@@ -3067,6 +3324,20 @@ SOSAYWEALL
  from eugene.pyeugene import *
 SOSAYWEALL
 
+  if isDarwin ; then
+    rsync -av lib/python*/site-packages/* Library/Frameworks/Python.framework/Versions/${PYFSVER}/lib/python${PYFSVER}/site-packages
+    rm -rf lib/python*/site-packages
+  fi
+
+  if isPython3 ; then
+    for f in $(grep -l eugene bin/*) ; do
+      if [ -n "$(file "$f" | grep -i python)" ] ; then
+        sed -i.bak -e "s,/python ,/python${PYFSVER} ,g"  -e "s, python , python${PYFSVER} ,g"  -e "s, python\$, python${PYFSVER},g"  -e "s,/python\$,/python${PYFSVER},g" "$f"
+        diff -u "$f".bak "$f" | less
+        rm -f "$f".bak
+      fi
+    done
+  fi
   return 0
 }
 
@@ -3100,17 +3371,11 @@ mk_netcdf4cxx() {
   _find_cots HDF4 include/hdf.h $BASE $COTS_HOME || echo "WARNING: netcdf4cxx will build without HDF4"
   _find_cots NETCDF4 include/netcdf.h $BASE $COTS_HOME || oops "netcdf4cxx requires netcdf4"
   _find_cots ZLIB include/zlib.h $BASE $COTS_HOME /usr || oops "netcdf4cxx requires zlib"
-  echo "unpacking netcdf4cxx..."
-  tar xf src/optional/netcdf-cxx4-${CDF4CXXVER}.tar* -C build || oops "could not unpack netcdf4 from src/"
-  echo "building netcdf4 for $BASE"
-  (set -x ; cd build/netcdf-cxx4-${CDF4CXXVER} \
-   && export CPPFLAGS="-I${HDF5}/include -I${ZLIB}/include -I${SZLIB}/include -I${JPEG}/include -I${NETCDF4}/include -I${HDF4}/include -fno-strict-aliasing" \
-   && export LDFLAGS="-L${HDF5}/lib -L${ZLIB}/lib -L${HDF4}/lib -L${NETCDF4}/lib -L${SZLIB}/lib -L${JPEG}/lib $SB3FLAGS" \
-   && ./configure --prefix=$BASE --enable-static --enable-shared --disable-doxygen --with-pic \
-   && make \
-   && MAKEFLAGS="" make install ) \
-   || oops "netcdf4cxx build failed"
-  # fix RPATH forcing issue
+
+  CPPFLAGS="-I${HDF5}/include -I${ZLIB}/include -I${SZLIB}/include -I${JPEG}/include -I${NETCDF4}/include -I${HDF4}/include -fno-strict-aliasing" \
+    LDFLAGS="-L${HDF5}/lib -L${ZLIB}/lib -L${HDF4}/lib -L${NETCDF4}/lib -L${SZLIB}/lib -L${JPEG}/lib $SB3FLAGS" \
+    _configure_make_install netcdf-cxx4 src/optional/netcdf-cxx4-${CDF4CXXVER}.tar* netcdf-cxx4-${CDF4CXXVER} /
+     --enable-static --enable-shared --disable-doxygen --with-pic
 }
 
 mk_netcdf4fortran() {
@@ -3122,52 +3387,42 @@ mk_netcdf4fortran() {
   _find_cots HDF4 include/hdf.h $BASE $COTS_HOME || echo "WARNING: netcdf4fortran building without HDF4"
   _find_cots NETCDF4 include/netcdf.h $BASE $COTS_HOME || oops "netcdf4fortran requires netcdf4"
   _find_cots ZLIB include/zlib.h $BASE $COTS_HOME /usr || oops "netcdf4fortran requires zlib"
-  echo "unpacking netcdf4fortran..."
-  tar xf src/optional/netcdf-fortran-v${CDF4FORVER}.tar* -C build || oops "could not unpack netcdf4 from src/"
-  echo "building netcdf4 for $BASE"
-  (set -x ; cd build/netcdf-fortran-${CDF4FORVER} \
-   && export CPPFLAGS="-I${HDF5}/include -I${ZLIB}/include -I${SZLIB}/include -I${JPEG}/include -I${NETCDF4}/include -I${HDF4}/include -fno-strict-aliasing" \
-   && export LDFLAGS="-L${HDF5}/lib -L${ZLIB}/lib -L${HDF4}/lib -L${NETCDF4}/lib -L${SZLIB}/lib -L${JPEG}/lib $SB3FLAGS" \
-   && ./configure --prefix=$BASE --enable-static --enable-shared --disable-doxygen --with-pic \
-   && make \
-   && MAKEFLAGS="" make install ) \
-   || oops "netcdf4fortran build failed"
-  # fix RPATH forcing issue
+
+  CPPFLAGS="-I${HDF5}/include -I${ZLIB}/include -I${SZLIB}/include -I${JPEG}/include -I${NETCDF4}/include -I${HDF4}/include -fno-strict-aliasing" \
+  LDFLAGS="-L${HDF5}/lib -L${ZLIB}/lib -L${HDF4}/lib -L${NETCDF4}/lib -L${SZLIB}/lib -L${JPEG}/lib $SB3FLAGS" \
+    _configure_make_install netcdf-fortran src/optional/netcdf-fortran-v${CDF4FORVER}.tar* netcdf-fortran-${CDF4FORVER}/ \
+      --enable-static --enable-shared --disable-doxygen --with-pic || oops "netcdf4fortran build failed"
 }
 
 
 mk_pycdf() {
   resume_tracker && return 0
-  # _setup_build_install pycdf src/optional/pycdf-${PYCDFVER}.tar.gz pycdf-${PYCDFVER}
-  name=pycdf
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
+
+  if isPython3 ; then
     tarball=src/optional/py3cdf-${PYCDFVER}.tar.gz #run with new swig
   else
     tarball=src/optional/pycdf-${PYCDFVER}.tar.gz
   fi
-  buildir=pycdf-${PYCDFVER}
-  shift 3
-  echo "unpacking ${name}..."
-  tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
-(cd build/${buildir}; patch -p0 -l) <<EOF || oops "could not patch setup.py in pycdf"
+
+  make_patch pycdf <<PATCH
 --- setup.py.orig	2012-01-13 11:29:21.000000000 -0600
 +++ setup.py	2012-01-13 11:30:20.000000000 -0600
 @@ -50,7 +50,7 @@
  from distutils.core import setup, Extension
- 
+
  if not USE in nameDir:
 -    print "USE set to an illegal value; set to one of: NUMPY (default), NUMERIC, NUMARRAY"
 +    print("USE set to an illegal value; set to one of: NUMPY (default), NUMERIC, NUMARRAY")
      sys.exit(1)
-           
+
  extName = "pycdf._pycdfext"
 @@ -73,7 +73,7 @@
      from numpy.distutils.misc_util import get_numpy_include_dirs
-     _pycdf_ext = Extension(extName, 
+     _pycdf_ext = Extension(extName,
                             sources   = CCode,
 -                           #library_dirs=["non standard path where libs live"],
 +                           library_dirs=["${BASE}/lib"],
-                            include_dirs = get_numpy_include_dirs(), 
+                            include_dirs = get_numpy_include_dirs(),
                             libraries = ["netcdf"])
 
 @@ -95,6 +95,7 @@
@@ -3176,7 +3431,7 @@ mk_pycdf() {
        packages     = ['pycdf'],
 +      use_2to3 = True,
        ext_modules  = [_pycdf_ext]
- 
+
        )
 --- pycdf/pycdf.py.orig	2007-02-12 20:36:42.000000000 +0000
 +++ pycdf/pycdf.py	2010-01-22 21:26:42.000000000 +0000
@@ -3203,40 +3458,31 @@ mk_pycdf() {
 -                raise CDFError("CDF", 0, "no such file")
 +#            else:
 +#                raise CDFError("CDF", 0, "no such file")
-                 
+
          status, id = fct(path, mode)
          _checkCDFErr('CDF', status)
 
-EOF
-  echo "building ${name} for $BASE"
-  (cd build/${buildir} \
-   && ${PYTHON} setup.py build "$@" \
-   && ${PYTHON} setup.py install ${PYTHON_OPTIMIZATION} ) \
-   || oops "${name} build failed"
+PATCH
+  
+  _setup_build_install pycdf $tarball pycdf-${PYCDFVER} || oops "pycdf didn't install"
 }
 
 # more up-to-date than pycdf
 mk_netcdf4py() {
   resume_tracker && return 0
-  _find_cots HDF5 include/hdf5.h $BASE $COTS_HOME || oops "need HDF5 for netcdf4py"  
+  _find_cots HDF5 include/hdf5.h $BASE $COTS_HOME || oops "need HDF5 for netcdf4py"
   # _find_cots SZLIB include/szlib.h $BASE $COTS_HOME || oops "netcdf4py needs SZIP"
   _find_cots NETCDF4 include/netcdf.h $BASE $COTS_HOME || oops "netcdf4py needs netcdf4"
   export HDF5_DIR=$HDF5
   # export SZIP_DIR=$SZLIB
   export NETCDF4_DIR=$NETCDF4
-  name=netcdf4py
-  tarball=src/optional/netCDF4-${NETCDF4PYVER}.tar.gz
-  buildir=netCDF4-${NETCDF4PYVER}
 
-  echo unpacking ${name}...
-  tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
-  rm -f build/${buildir}/setup.cfg
-  echo "building ${name} for $BASE"
-  (cd build/${buildir} \
-   && ${PYTHON} setup.py build "$@" \
-   && ${PYTHON} setup.py install ${PYTHON_OPTIMIZATION} ) \
-   || oops "${name} build failed"  
-  #_setup_build_install netcdf4py src/optional/netCDF4-${NETCDF4PYVER}.tar.gz netCDF4-${NETCDF4PYVER}
+  make_script netcdf4py <<SCRIPT
+rm -f setup.cfg
+SCRIPT
+
+  _setup_build_install netcdf4py src/optional/netCDF4-${NETCDF4PYVER}.tar.gz netCDF4-${NETCDF4PYVER} "$@" || oops "netcdf4py wouldn't install"
+
 }
 
 mk_hdf4() {
@@ -3245,7 +3491,7 @@ mk_hdf4() {
   _find_cots JPEG include/jpeglib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "HDF4 needs JPEG"
   _find_cots SZLIB include/szlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "HDF4 needs SZIP"
 
-  make_patch hdf4 <<SOSAYWEALL 
+  make_patch hdf4 <<SOSAYWEALL
 diff -r -U 3 -p hdf/src/hconv.h hdf/src/hconv.h
 --- hdf/src/hconv.h  2012-02-06 09:02:43.000000000 -0500
 +++ hdf/src/hconv.h 2012-03-07 01:58:21.713088567 -0500
@@ -3266,13 +3512,13 @@ diff -r -U 3 -p hdf/src/hdfi.h hdf/src/hdfi.h
  #define     DFMT_LINUX64        0x4441
  #define     DFMT_POWERPC64      0x1111
 +#define     DFMT_LINUXARM       0x4441
- 
+
  /* I/O library constants */
  #define UNIXUNBUFIO 1
 @@ -1111,6 +1112,57 @@
- 
+
  #endif /* IA64 */
- 
+
 +/* Linux ARM */
 +#if defined __arm__
 +
@@ -3332,24 +3578,18 @@ SOSAYWEALL
      CXXFLAGS="-fPIC -DHAVE_NETCDF -DFALSE=0 -DTRUE=1 -fno-strict-aliasing $SB3FLAGS" \
      LIBS="-lm" \
      _configure_make_install hdf4 src/optional/hdf-${HDF4VER}.tar* hdf-${HDF4VER} \
-      --disable-netcdf --disable-fortran --enable-shared --with-zlib=$ZLIB --with-szlib=$SZLIB --with-jpeg=$JPEG
+      --disable-netcdf --disable-fortran --enable-shared --with-zlib=$ZLIB --with-szlib=$SZLIB --with-jpeg=$JPEG \
+      || oops "hdf4 didn't build"
 #  export F77=
 }
 
 
 mk_pyhdf() {
   resume_tracker && return 0
-  echo "unpacking pyhdf..."
-  tarball=src/optional/python-hdf4-${PYHDFVER}.tar.gz
-  builddir=python-hdf4-${PYHDFVER}
-  tar zxf ${tarball} -C build || oops "could not unpack pyhdf from src/"
-  echo "building pyhdf for $BASE"
-  (cd build/${builddir} \
-   && export INCLUDE_DIRS=$BASE/include LIBRARY_DIRS=$BASE/lib \
-   && ${PYTHON} setup.py build \
-   && ${PYTHON} setup.py install ${PYTHON_OPTIMIZATION} ) \
+
+  INCLUDE_DIRS=$BASE/include LIBRARY_DIRS=$BASE/lib \
+    _setup_build_install pyhdf src/optional/python-hdf4-${PYHDFVER}.tar.gz python-hdf4-${PYHDFVER}/ \
    || oops "pyhdf build failed"
-  # blank out so these don't muck up other builds
 }
 
 mk_gdal() {
@@ -3363,14 +3603,24 @@ mk_gdal() {
   _find_cots HDF5 include/hdf5.h $BASE $COTS_HOME || oops "GDAL needs HDF5"
   _find_cots JASPER include/jasper/jas_image.h $BASE $COTS_HOME || oops "GDAL needs JASPER"
   _find_cots NETCDF include/netcdf.h $BASE $COTS_HOME || oops "GDAL needs NETCDF"
-  _find_cots EXPAT include/expat.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "GDAL needs EXPAT"
-  _find_cots_lib EXPAT libexpat ${EXPAT} || oops "GDAL needs EXPAT lib"
+  if useSysCheck USE_SYS_EXPAT ; then
+    _find_cots EXPAT include/expat.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "GDAL wants EXPAT"
+    _find_cots_lib EXPAT libexpat ${EXPAT} || oops "GDAL needs EXPAT lib"
+  else
+    unset EXPAT
+  fi
   _find_cots CURL bin/curl-config $BASE $COTS_HOME ${SYSROOT}/usr || oops "GDAL needs CURL"
   _find_cots ICONV include/iconv.h /sw $BASE $COTS_HOME ${SYSROOT}/usr || oops "GDAL needs ICONV"
   [ "$ICONV" == "/sw" ] && oops "It is strongly recommended that you uninstall Fink's libiconv-dev package for GDAL to compile"
   EXTRAPARMS=""
   # OpenCL framework standard on 10.6 and later. Neener neener.
   isDarwin && EXTRAPARMS="${EXTRAPARMS} --without-pg --with-opencl --build=${PLATFORM} --with-macosx-framework"
+  isDarwin && [ $DARWINVERNUMBER -le 10 ] && EXTRAPARMS="${EXTRAPARMS} --without-cpp11"
+  if [ -n "$EXPAT" ] ; then
+    EXTRAPARMS="${EXTRAPARMS} --with-expat=\"$EXPAT\" --with-expat-lib=\"-L${EXPATLIBDIR} -lexpat\""
+  else
+    EXTRAPARMS="${EXTRAPARMS} --with-expat=no"
+  fi
 
   fixla
   make_script gdal <<SOSAYWEALL
@@ -3384,7 +3634,7 @@ case "${MACOSX_DEPLOYMENT_TARGET}"x in
 esac
 sed -i.bak3 -e "s:/Library/Frameworks/GDAL:${BASE}/Library/Frameworks/GDAL:g" *.in configure frmts/pdf/GNUmakefile
 sed -i.bak4 -e 's:*.lo) func_lo2o :*) func_lo2o :g' lt*
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
+  if isPython3 ; then
     sed -i.bak \
                -e "s,bin/python(?!${PYFSVERMAJOR}),bin/python${PYFSVERMAJOR}," \
                -e "s,bin/python\$,bin/python${PYFSVERMAJOR}," \
@@ -3418,12 +3668,33 @@ diff -ru swig/python/setup.py swig/python/setup.py
 @@ -201,7 +201,7 @@
  extra_link_args = []
  extra_compile_args = []
- 
+
 -if sys.platform == 'darwin' and [int(x) for x in os.uname()[2].split('.')] >= [11, 0, 0]:
 +if sys.platform == 'darwin' and [int(x) for x in os.uname()[2].split('.')] >= [11, 0, 0] and False:
      # since MacOS X 10.9, clang no longer accepts -mno-fused-madd
      #extra_compile_args.append('-Qunused-arguments')
      os.environ['ARCHFLAGS'] = '-Wno-error=unused-command-line-argument-hard-error-in-future'
+diff -ru port/cpl_port.h port/cpl_port.h
+--- port/cpl_port.h 2017-04-28 11:15:24.000000000 -0500
++++ port/cpl_port.h 2017-06-24 22:17:23.000000000 -0500
+@@ -670,6 +670,17 @@
+ #  define CPLIsNan(x)    __builtin_isnan(x)
+ #  define CPLIsInf(x)    __builtin_isinf(x)
+ #  define CPLIsFinite(x) __builtin_isfinite(x)
++#elif defined(__cplusplus)
++/* Hack */
++extern "C++" {
++#include <cmath>
++static inline int CPLIsNan(float f) { return std::isnan(f); }
++static inline int CPLIsNan(double f) { return std::isnan(f); }
++static inline int CPLIsInf(float f) { return std::isinf(f); }
++static inline int CPLIsInf(double f) { return std::isinf(f); }
++static inline int CPLIsFinite(float f) { return std::isfinite(f); }
++static inline int CPLIsFinite(double f) { return std::isfinite(f); }
++}
+ #else
+ /** Return whether a floating-pointer number is NaN */
+ #if defined(__cplusplus) && defined(__GNUC__) && defined(__linux) && !defined(__ANDROID__)
 SOSAYWEALL
 
   _configure_make_install gdal src/optional/gdal-${GDALVER}.tar.gz gdal-${GDALVER}/ ${EXTRAPARMS} \
@@ -3433,10 +3704,9 @@ SOSAYWEALL
         --with-hdf5=$HDF5 \
         --with-png=$PNG \
         --with-netcdf=$NETCDF \
-        --with-jasper=$JASPER \
         --with-sqlite3=$SQLITE \
+        --with-jasper=$JASPER \
         --with-geos=yes \
-        --with-expat="$EXPAT" --with-expat-lib="-L${EXPATLIBDIR} -lexpat" \
         --with-curl=$CURL \
         --with-libiconv-prefix=$ICONV \
         --with-python --with-liblzma=${BASE}
@@ -3445,21 +3715,21 @@ SOSAYWEALL
   _compiler_proxy_end CXX g++
 
   isDarwin && make_frameworklinks
-  
+
   return 0
 }
 
 mk_hwloc() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_HWLOC && return 0 
+  useSysCheck USE_SYS_HWLOC && return 0
   ADDITIONALFLAGS=""
-  isDarwin && ADDITIONALFLAGS="--without-x"
+  isTrue WITHOUT_X11 && ADDITIONALFLAGS="--without-x"
   _configure_make_install hwloc src/experimental/hwloc-${HWLOCVER}.tar.* hwloc-${HWLOCVER} ${ADDITIONALFLAGS}
 }
 
 mk_m4() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_M4 && return 0 
+  useSysCheck USE_SYS_M4 && return 0
   _find_cots M4_BASE m4 $BASE/bin $BASE/sysbin && return 0
   _configure_make_install m4 src/sys/m4-${M4VER}.tar.gz m4-${M4VER} --bindir=${BASE}/sysbin
 }
@@ -3481,6 +3751,7 @@ mk_isl14() {
 }
 
 mk_gmpy() {
+  #python bindings for GMP
   resume_tracker && return 0
   mk_gmp && mk_mpfr && mk_mpc && \
   CFLAGS="$CFLAGS -I ${BASE}/include" _setup_build_install gmpy src/optional/gmpy2-${GMPYVER}.zip gmpy2-${GMPYVER}
@@ -3516,7 +3787,6 @@ mk_mpc() {
 
 mk_libelf() {
   resume_tracker && return 0
-  isDarwin && return 0
   _configure_make_install libelf src/sys/libelf-${LIBELFVER}.tar.* libelf-${LIBELFVER} --bindir=${BASE}/sysbin
 }
 
@@ -3530,7 +3800,7 @@ mk_fftw() {
   _configure_make_install fftwf src/optional/IDL/fftw-${FFTWVER}.tar.gz fftw-${FFTWVER} --enable-single --enable-threads --enable-shared ${FFTWEXTRA} ${FFTWSDEXTRA}
   _configure_make_install fftw src/optional/IDL/fftw-${FFTWVER}.tar.gz fftw-${FFTWVER} --enable-threads --enable-shared ${FFTWEXTRA} ${FFTWLDEXTRA}
   _configure_make_install fftwl src/optional/IDL/fftw-${FFTWVER}.tar.gz fftw-${FFTWVER} --enable-long-double --enable-threads --enable-shared ${FFTWEXTRA}
-  #quad requires gcc 4.6 or better... 
+  #quad requires gcc 4.6 or better...
   if ( isLinux && check_gcc_version 4.6 ) ; then
     #_configure_make_install fftwq src/optional/IDL/fftw-${FFTWVER}.tar.gz fftw-${FFTWVER}  --enable-quad-precision --enable-threads --enable-shared ${FFTWEXTRA}
     echo -n
@@ -3557,18 +3827,21 @@ mk__gcc48() {
 
   _configure_make_install gcc48 src/sys/gcc-${GCC4VER}.tar.bz2 gcc-${GCC4VER} --with-gmp=${BASE} --with-mpfr=${BASE} \
       --with-mpc=${BASE} $( isLinux && echo \--with-libelf=${BASE} ) --bindir=${BASE}/sysbin --disable-libgcj \
-      --enable-languages=c,c++,fortran --with-isl=${BASE} --enable-checking=release 
+      --enable-languages=c,c++,fortran --with-isl=${BASE} --enable-checking=release
 
   for f in lib64/* ; do
     if [ -f $f -o -d $f ] ; then
       file32=`echo $f | sed s,lib64/,lib/,g`
       if [ -e "${file32}" ] ; then
-         rm -f "${file32}" 
+         rm -f "${file32}"
       fi
       ln -s ../$f ${file32}
     fi
   done
   ln -s gcc sysbin/cc
+
+  _check_build_env CC CXX CPP FC LD
+
   return 0
 }
 
@@ -3577,18 +3850,21 @@ mk__gcc5() {
 
   _configure_make_install gcc5 src/sys/gcc-${GCC5VER}.tar.* gcc-${GCC5VER} --with-gmp=${BASE} --with-mpfr=${BASE} \
       --with-mpc=${BASE} $( isLinux && echo \--with-libelf=${BASE} ) --bindir=${BASE}/sysbin --disable-libgcj \
-      --enable-languages=c,c++,fortran --with-isl=${BASE} --disable-multilib --enable-checking=release 
+      --enable-languages=c,c++,fortran --with-isl=${BASE} --disable-multilib --enable-checking=release
 
   for f in lib64/* ; do
     if [ -f $f -o -d $f ] ; then
       file32=`echo $f | sed s,lib64/,lib/,g`
       if [ -e "${file32}" ] ; then
-         rm -f "${file32}" 
+         rm -f "${file32}"
       fi
       ln -s ../$f ${file32}
     fi
   done
   ln -s gcc sysbin/cc
+
+  _check_build_env CC CXX CPP FC LD
+
   return 0
 }
 
@@ -3597,18 +3873,21 @@ mk__gcc6() {
 
   _configure_make_install gcc6 src/sys/gcc-${GCC6VER}.tar.* gcc-${GCC6VER} --with-gmp=${BASE} --with-mpfr=${BASE} \
       --with-mpc=${BASE} $( isLinux && echo \--with-libelf=${BASE} ) --bindir=${BASE}/sysbin --disable-libgcj \
-      --enable-languages=c,c++,fortran --with-isl=${BASE} --disable-multilib --enable-checking=release 
+      --enable-languages=c,c++,fortran --with-isl=${BASE} --disable-multilib --enable-checking=release
 
   for f in lib64/* ; do
     if [ -f $f -o -d $f ] ; then
       file32=`echo $f | sed s,lib64/,lib/,g`
       if [ -e "${file32}" ] ; then
-         rm -f "${file32}" 
+         rm -f "${file32}"
       fi
       ln -s ../$f ${file32}
     fi
   done
   ln -s gcc sysbin/cc
+
+  _check_build_env CC CXX CPP FC LD
+
   return 0
 }
 
@@ -3629,6 +3908,9 @@ mk__gcc7() {
     fi
   done
   ln -s gcc sysbin/cc
+
+  _check_build_env CC CXX CPP FC LD
+
   return 0
 }
 
@@ -3637,9 +3919,11 @@ mk_gcc48() {
   resume_tracker && return 0
 
   _find_cots GCC48_BASE gcc $BASE/bin $BASE/sysbin && return 0
-  mk_m4 && mk_autoconf && mk_automake && mk_gmp4 && mk_mpfr && mk_mpc \
-  && mk_libelf && mk_isl14 && mk__gcc48 && echo gcc48 >>trim \
+  mk_zlib && mk_m4 && mk_autoconf && mk_automake && mk_gmp4 && mk_mpfr && mk_mpc \
+  && ( isDarwin || mk_libelf ) && mk_isl14 && mk__gcc48 && echo gcc${GCC4VER} >>trim \
   || oops GCC 4.8 support failed
+  cleanup
+  return 0
 }
 
 mk_gcc5() {
@@ -3647,9 +3931,11 @@ mk_gcc5() {
   resume_tracker && return 0
 
   _find_cots GCC5_BASE gcc $BASE/bin $BASE/sysbin && return 0
-  mk_m4 && mk_autoconf && mk_automake && mk_gmp && mk_mpfr && mk_mpc \
-  && mk_libelf && mk_isl && mk__gcc5 && echo gcc5 >>trim \
+  mk_zlib && mk_m4 && mk_autoconf && mk_automake && mk_gmp && mk_mpfr && mk_mpc \
+  && mk_libelf && mk_isl && mk__gcc5 && echo gcc${GCC5VER} >>trim \
   || oops GCC 5.x support failed
+  cleanup
+  return 0
 }
 
 mk_gcc6() {
@@ -3657,9 +3943,11 @@ mk_gcc6() {
   resume_tracker && return 0
 
   _find_cots GCC6_BASE gcc $BASE/bin $BASE/sysbin && return 0
-  mk_m4 && mk_autoconf && mk_automake && mk_gmp && mk_mpfr && mk_mpc \
-  && mk_libelf && mk_isl && mk__gcc6 && echo gcc6 >>trim \
+  mk_zlib && mk_m4 && mk_autoconf && mk_automake && mk_gmp && mk_mpfr && mk_mpc \
+  && mk_libelf && mk_isl && mk__gcc6 && echo gcc${GCC6VER} >>trim \
   || oops GCC 6.x support failed
+  cleanup
+  return 0
 }
 
 mk_gcc7() {
@@ -3667,21 +3955,23 @@ mk_gcc7() {
   resume_tracker && return 0
 
   _find_cots GCC7_BASE gcc $BASE/bin $BASE/sysbin && return 0
-  mk_m4 && mk_autoconf && mk_automake && mk_gmp && mk_mpfr && mk_mpc \
-  && mk_libelf && mk_isl && mk__gcc7 && echo gcc7 >>trim \
+  mk_zlib && mk_m4 && mk_autoconf && mk_automake && mk_gmp && mk_mpfr && mk_mpc \
+  && mk_libelf && mk_isl && mk__gcc7 && echo gcc${GCC7VER} >>trim \
   || oops GCC 7.x support failed
+  cleanup
+  return 0
 }
 
 mk_autoconf() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_AUTOCONF && return 0 
+  useSysCheck USE_SYS_AUTOCONF && return 0
   _find_cots AUTOCONF_BASE autoconf $BASE/bin $BASE/sysbin && return 0
   _configure_make_install autoconf src/sys/autoconf-${AUTOCONFVER}.tar.gz autoconf-${AUTOCONFVER} --bindir=${BASE}/sysbin
 }
 
 mk_automake() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_AUTOMAKE && return 0 
+  useSysCheck USE_SYS_AUTOMAKE && return 0
   _find_cots AUTOMAKE_BASE automake $BASE/bin $BASE/sysbin && return 0
   oldPATH=$PATH
   export PATH=$BASE/bin:$PATH
@@ -3691,29 +3981,37 @@ mk_automake() {
 
 mk_curl() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_CURL && return 0 
+  useSysCheck USE_SYS_CURL && return 0
   _find_cots CURL_BASE curl $BASE/bin $BASE/sysbin && return 0
   _find_cots ZLIB include/zlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "need ZLIB"
   _configure_make_install curl src/sys/curl-${CURLVER}.tar.* curl-${CURLVER} --with-zlib=$ZLIB --without-ssl --without-libidn
 }
 
-mk_pkgconfig() {
+mk__pkgconfig() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_PKGCONFIG && return 0 
+  useSysCheck USE_SYS_PKGCONFIG && return 0
   _find_cots PKG_CONFIG_BASE pkg-config $BASE/bin $BASE/sysbin && return 0
 
   if isDarwin ; then
     EXTRA_PKG="--with-internal-glib"
   else
     EXTRA_PKG="--without-internal-glib"
+    _find_cots_lib GLIB2 libglib-2.0 $BASE ${SYSROOT}/usr || oops "pkgconfig needs glib" 
+    _find_cots GLIB2INC include/glib-2.0/glib.h $GLIB2 || oops "pkgconfig needs glib headers" 
+    _find_cots GLIB2CONFINC glibconfig.h ${GLIB2LIBDIR}/glib-2.0/include ${GLIB2INC}include/glib-2.0 || oops "pkgconfig needs glib headers" 
+    export GLIB_CFLAGS="-I${GLIB2}/include/glib-2.0 -I${GLIB2CONFINC}" GLIB_LIBS="-L${GLIB2LIBDIR} -lglib-2.0"
   fi
   _configure_make_install pkgconfig src/sys/pkg-config-${PKGCONFIGVER}.tar.gz pkg-config-${PKGCONFIGVER} ${EXTRA_PKG} --bindir=${BASE}/sysbin
+
+  unset GLIB_CFLAGS GLIB_LIBS
+
+  return 0
 }
 
 mk_libtool() {
   resume_tracker && return 0
   useSysCheck USE_SYS_LIBTOOL && return 0 
-  isTrue USE_MAC_LIBTOOL && return 0 
+  isTrue USE_PORTABLE_LIBTOOL && return 0 
   _find_cots LIBTOOL_BASE libtool $BASE/bin $BASE/sysbin && return 0
   _configure_make_install libtool src/sys/libtool-${LIBTOOLVER}.tar.gz libtool-${LIBTOOLVER} --bindir=${BASE}/sysbin
   ln -s libtoolize sysbin/glibtoolize
@@ -3729,7 +4027,7 @@ mk_pixman() {
 
 mk_cairo() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_CAIRO && return 0 
+  useSysCheck USE_SYS_CAIRO && return 0
   _find_cots ZLIB include/zlib.h $BASE $COTS_HOME ${SYSROOT}/usr || oops "cairo needs ZLIB"
   _find_cots_lib ZLIB libz $BASE $COTS_HOME ${SYSROOT}/usr || oops "cairo needs ZLIB"
   _find_cots PNG bin/libpng-config $BASE $COTS_HOME ${SYSROOT}/usr || oops 'cairo needs PNG'
@@ -3737,13 +4035,13 @@ mk_cairo() {
   CAIROADDITIONALFLAGS="--enable-pthread=yes"
   isDarwin && CAIROADDITIONALFLAGS="${CAIROADDITIONALFLAGS} --enable-xlib=no --enable-quartz-image"
   CFLAGS="$CFLAGS -I$ZLIB/include" CXXFLAGS="$CXXFLAGS -I$ZLIB/include" CPPFLAGS="$CPPFLAGS -I$ZLIB/include" LDFLAGS="$LDFLAGS -L$ZLIBLIBDIR" \
-    _configure_make_install cairo src/optional/cairo-${CAIROVER}.tar.* cairo-${CAIROVER} ${CAIROADDITIONALFLAGS} 
+    _configure_make_install cairo src/optional/cairo-${CAIROVER}.tar.* cairo-${CAIROVER} ${CAIROADDITIONALFLAGS}
 }
 
 mk_pycairo() {
   resume_tracker && return 0
   name=pycairo
-  if [ ${PYFSVERMAJOR} -le 2 ] ; then
+  if isPython2 ; then
     tarball=src/optional/py2cairo-${PY2CAIROVER}.tar.bz2
     buildir=py2cairo-${PY2CAIROVER}
   else
@@ -3764,13 +4062,13 @@ mk_pycairo() {
    return 0
 }
 
-mk_mock(){
+_mk_mock(){
   resume_tracker && return 0
   mk_pip || oops "pip did not install"
   pip_install src/optional/imagesize-* || oops "imagesize did not install"
   pip_install src/optional/pbr-*.tar.gz || oops 'pbr did not install'
   pip_install src/optional/funcsigs-*.tar.gz || oops 'funcsigs did not install'
-  _setup_build_install mock src/optional/mock-${MOCKVER}.tar.gz mock-${MOCKVER}  
+  _setup_build_install mock src/optional/mock-${MOCKVER}.tar.gz mock-${MOCKVER}
 }
 
 mk_wheel(){
@@ -3787,8 +4085,8 @@ mk_cartopy(){
 
 mk_process32(){
   resume_tracker && return 0
-  if [ ${PYFSVERMAJOR} -gt 2 ] ; then
-    return 0
+  if isPython3 ; then
+    return 0 #not needed
   fi
 
   make_patch subprocess32 <<PATCH
@@ -3827,7 +4125,7 @@ mk_cycler(){
 
 mk_matplotlib_batch() { # batch matplotlib - no GUI
   resume_tracker && return 0
-  
+
   make_script matplotlib <<SOSAYWEALL
   if isDarwin ; then 
     export MACSTATE=True
@@ -3863,8 +4161,8 @@ SOSAYWEALL
 
 mk_sip() {
   resume_tracker && return 0
-  name=sip 
-  tarball=src/optional/sip-${SIPVER}.tar.gz 
+  name=sip
+  tarball=src/optional/sip-${SIPVER}.tar.gz
   buildir=sip-${SIPVER}
   echo "unpacking ${name}..."
   tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
@@ -3877,7 +4175,7 @@ mk_sip() {
 }
 
 
-mk_pyqt4() { 
+mk_pyqt4() {
   resume_tracker && return 0
   if buildPortable ; then
     isDarwin && echo "Skipping QT4 Compatibility because of portability flag" && return 0
@@ -3888,7 +4186,7 @@ mk_pyqt4() {
   [ -z "${QT4DIR}" ] && return 0 #this should have failed on the prior line if we wanted this
   [ ${CPUTYPE} != ${REALCPUTYPE} ] && unset QT4DIR && return 0
   name=PyQt4
-  tarball=src/optional/PyQt-x11-gpl-${PYQT4VER}.tar.gz 
+  tarball=src/optional/PyQt-x11-gpl-${PYQT4VER}.tar.gz
   buildir=PyQt-x11-gpl-${PYQT4VER}
   echo "unpacking ${name}..."
   tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
@@ -3898,7 +4196,7 @@ index 15e25e4..85542d8 100644
 --- a/PyQt-x11-gpl-4.11.3.orig/sip/QtGui/qabstractprintdialog.sip
 +++ b/PyQt-x11-gpl-4.11.3/sip/QtGui/qabstractprintdialog.sip
 @@ -76,13 +76,19 @@ public:
- 
+
  enum PrintDialogOption {
      None,
 -    None /PyName=None_/,
@@ -4047,30 +4345,90 @@ PATCH
   SYSROOT="" _setup_build_install matplotlib src/optional/matplotlib-${MATPLOTLIBVER}.tar.gz matplotlib-${MATPLOTLIBVER}
 }
 
+mk_pint() { 
+  resume_tracker && return 0
+
+  _setup_build_install Pint src/optional/Pint-${PINTVER}.tar.* Pint-${PINTVER} 
+}
+
+mk_metpy() { 
+  resume_tracker && return 0
+
+  _setup_build_install MetPy src/optional/MetPy-${METPYVER}.tar.* MetPy-${METPYVER} 
+}
+
+mk_geopy() { 
+  resume_tracker && return 0
+
+  make_patch geopy <<PATCH
+--- geopy/geocoders/base.py 2015-08-31 09:23:49.000000000 -0500
++++ geopy/geocoders/base.py 2017-05-18 12:40:02.000000000 -0500
+@@ -2,7 +2,15 @@
+ :class:`.GeoCoder` base object from which other geocoders are templated.
+ """
+ 
+-from ssl import SSLError
++try:
++    from ssl import SSLError
++    schemes=('http','https')
++    DEFAULT_SCHEME='https'
++except ImportError:
++    SSLError=None
++    schemes=('http',)
++    DEFAULT_SCHEME='http'
++
+ from socket import timeout as SocketTimeout
+ import json
+ 
+@@ -42,7 +50,6 @@
+ 
+ 
+ DEFAULT_FORMAT_STRING = '%s'
+-DEFAULT_SCHEME = 'https'
+ DEFAULT_TIMEOUT = 1
+ DEFAULT_WKID = 4326
+ DEFAULT_USER_AGENT = "geopy/%s" % __version__
+@@ -82,9 +89,9 @@
+         """
+         self.format_string = format_string
+         self.scheme = scheme
+-        if self.scheme not in ('http', 'https'): # pragma: no cover
++        if self.scheme not in schemes: # pragma: no cover
+             raise ConfigurationError(
+-                'Supported schemes are \`http\` and \`https\`.'
++                'Supported schemes are: {}.'.format(', '.join(schemes))
+             )
+         self.proxies = proxies
+         self.timeout = timeout
+PATCH
+
+  _setup_build_install geopy src/optional/geopy-${GEOPYVER}.tar.* geopy-${GEOPYVER} 
+}
+
 mk_geos() { 
   resume_tracker && return 0
-  _configure_make_install geos src/optional/geos-${GEOSVER}.tar.bz2 geos-${GEOSVER} 
+  _configure_make_install geos src/optional/geos-${GEOSVER}.tar.bz2 geos-${GEOSVER}
 }
 
-mk_astropy() { 
+mk_astropy() {
   resume_tracker && return 0
   pip_install src/optional/astropy-helpers*z || oops "astropy-helpers failed to install"
-  _setup_build_install astropy src/optional/astropy-${ASTROPYVER}.tar.gz astropy-${ASTROPYVER} 
+  _setup_build_install astropy src/optional/astropy-${ASTROPYVER}.tar.gz astropy-${ASTROPYVER}
 }
 
-mk_bitarray() { 
+mk_bitarray() {
   resume_tracker && return 0
-  _setup_build_install bitarray src/optional/bitarray-${BITARRAYVER}.tar.gz bitarray-${BITARRAYVER} 
+  _setup_build_install bitarray src/optional/bitarray-${BITARRAYVER}.tar.gz bitarray-${BITARRAYVER}
 }
 
-mk_blist() { 
+mk_blist() {
   resume_tracker && return 0
-  _setup_build_install blist src/optional/blist-${BLISTVER}.tar.gz blist-${BLISTVER} 
+  _setup_build_install blist src/optional/blist-${BLISTVER}.tar.gz blist-${BLISTVER}
 }
 
-mk_updates() { 
+mk_updates() {
   resume_tracker && return 0
-  _setup_build_install updates src/optional/updates-${UPDATESVER}.tar.gz updates-${UPDATESVER} 
+  _setup_build_install updates src/optional/updates-${UPDATESVER}.tar.gz updates-${UPDATESVER}
   isDarwin && make_frameworklinks
   return 0
 }
@@ -4078,15 +4436,92 @@ mk_updates() {
 mk_basemap() {
   resume_tracker && return 0
   export GEOS_DIR=$BASE
+  export PROJ_DIR=$BASE
+
+  make_patch basemap <<PATCH
+diff -ru setup.py setup.py
+--- setup.py 2013-08-17 15:41:53.000000000 -0500
++++ setup.py 2017-07-07 16:20:39.000000000 -0500
+@@ -22,6 +22,31 @@
+             geos_version = line.split()[2]
+     return geos_version
+ 
++def checkpjversion(PROJ_dir):
++    """check geos C-API header file (proj_api.h)"""
++    try:
++        f = open(os.path.join(PROJ_dir,'include/proj_api.h'))
++    except IOError:
++        return None
++    proj4_version = None
++    for line in f:
++        if line.startswith('#define PJ_VERSION'):
++            proj4_version = line.split()[2]
++    return proj4_version
++
++# get location of proj.4 lib from environment variable if it is set.
++if 'PROJ_DIR' in os.environ:
++    PROJ_dir = os.environ.get('PROJ_DIR')
++else:
++# set PROJ_dir manually here if automatic detection fails.
++    PROJ_dir = None
++
++if PROJ_dir is not None:
++    proj4_version = checkpjversion(PROJ_dir)
++    assert(proj4_version is not None)
++    proj4_include_dirs=[os.path.join(PROJ_dir,'include')]
++    proj4_library_dirs=[os.path.join(PROJ_dir,'lib'),os.path.join(PROJ_dir,'lib64')]
++
+ # get location of geos lib from environment variable if it is set.
+ if 'GEOS_DIR' in os.environ:
+     GEOS_dir = os.environ.get('GEOS_DIR')
+@@ -44,6 +69,7 @@
+             break
+ else:
+     geos_version = checkversion(GEOS_dir)
++assert(geos_version is not None)
+ 
+ if GEOS_dir is None:
+     raise SystemExit("""
+@@ -66,7 +92,15 @@
+ packages          = ['mpl_toolkits','mpl_toolkits.basemap']
+ namespace_packages = ['mpl_toolkits']
+ package_dirs       = {'':'lib'}
+-extensions = [Extension("mpl_toolkits.basemap._proj",deps+['src/_proj.c'],include_dirs = ['src'],)]
++extensions = []
++if PROJ_dir is None:
++  extensions.append(Extension("mpl_toolkits.basemap._proj",deps+['src/_proj.c'],include_dirs = ['src'],))
++else:
++  extensions.append(Extension("mpl_toolkits.basemap._proj",['src/_proj.c'],
++                                library_dirs=proj4_library_dirs,
++                                include_dirs=proj4_include_dirs,
++                                libraries=['proj']))
++
+ # can't install _geoslib in mpl_toolkits.basemap namespace,
+ # or Basemap objects won't be pickleable.
+ if sys.platform == 'win32':
+PATCH
+
   _setup_build_install basemap src/optional/basemap-${BASEMAPVER}.tar.gz basemap-${BASEMAPVER}
 }
 
+mk_cartopy() {
+  resume_tracker && return 0
+
+  _setup_build_install cartopy src/optional/cartopy-${CARTOPYVER}.tar.* cartopy-${CARTOPYVER}
+}
+
+mk_pyshp() {
+  resume_tracker && return 0
+
+  _setup_build_install pyshp src/optional/pyshp-${PYSHPVER}.tar.* pyshp-${PYSHPVER}
+}
+
 mk_setuptools() {
   resume_tracker && return 0
-  PATH=$BASE/bin:$PATH sh src/optional/setuptools*egg 
+  PATH=$BASE/bin:$PATH sh src/optional/setuptools*egg
   echo "WARNING: setuptools bin/easy_install scripts are NOT relocatable without editing!"
   echo "INFO: You can use 'ShellB3/bin/python${PYFSVER} -m easy_install' instead however"
-  #_setup_build_install distribute src/optional/distribute-${DISTRIBUTEVER}.tar.gz distribute-${DISTRIBUTEVER}  
+  #_setup_build_install distribute src/optional/distribute-${DISTRIBUTEVER}.tar.gz distribute-${DISTRIBUTEVER}
 
   _setup_build_install setuptools src/optional/setuptools-${SETUPTOOLSVER}.* setuptools-${SETUPTOOLSVER}  
   isDarwin && make_frameworklinks
@@ -4104,41 +4539,17 @@ mk_setuptools_scm() {
 mk_bottleneck() {
   resume_tracker && return 0
 
-  make_patch bottleneck <<PATCH
-diff -ru bottleneck/src/move_median/move_median.h bottleneck/src/move_median/move_median.h
---- bottleneck/src/move_median/move_median.h        2016-10-13 11:52:06.000000000 -0500
-+++ bottleneck/src/move_median/move_median.h     2017-01-18 14:36:16.000000000 -0600
-@@ -14,7 +14,7 @@
-     #define NUM_CHILDREN 8
- #endif
- 
--#if defined(_MSC_VER) && (_MSC_VER < 1900)
-+#if ( defined(_MSC_VER) && (_MSC_VER < 1900) ) || !defined(NAN) 
-     #define inline __inline
-     static __inline ai_t __NAN() {
-       ai_t value;
-PATCH
-
   _setup_build_install bottleneck src/optional/Bottleneck-${BOTTLENECKVER}.tar.gz Bottleneck-${BOTTLENECKVER}
 }
 
 mk_configobj() { # needed by pyresample
   resume_tracker && return 0
- # ${PYTHON} -m easy_install src/optional/configobj-${CONFIGOBJVER}.tar.*
-  name=configobj
-  tarball=src/optional/configobj-${CONFIGOBJVER}.tar.*
-  buildir=configobj-${CONFIGOBJVER}
-  
-  echo unpacking ${name}...
-  tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
 
-  sed -i.bak 's:six==:six>=:g' build/${buildir}/setup.py
+  make_script configobj <<SCRIPT
+sed -i.bak 's:six==:six>=:g' setup.py
+SCRIPT
 
-  echo "building ${name} for $BASE"
-  (cd build/${buildir} \
-   && ${PYTHON} setup.py build "$@" \
-   && ${PYTHON} setup.py install ${PYTHON_OPTIMIZATION} ) \
-   || oops "${name} build failed"
+  _setup_build_install configobj src/optional/configobj-${CONFIGOBJVER}.tar.* configobj-${CONFIGOBJVER} "$@" || oops "configobj install failed"
 }
 
 mk_openmpi() {
@@ -4146,7 +4557,8 @@ mk_openmpi() {
   is64Bit || return 0 
   isFalse BUILD_OPENMPI && return 0
   ADDITIONALFLAGS=""
-  isDarwin && ADDITIONALFLAGS="${ADDITIONALFLAGS} --without-x --enable-osx-builtin-atomics"
+  isDarwin && ADDITIONALFLAGS="${ADDITIONALFLAGS} --enable-osx-builtin-atomics"
+  isTrue WITHOUT_X11 && ADDITIONALFLAGS="${ADDITIONALFLAGS} --without-x"
   _configure_make_install openmpi src/experimental/openmpi-${OPENMPIVER}.tar.* openmpi-${OPENMPIVER} \
      --enable-mpi-fortran=no ${ADDITIONALFLAGS}
 }
@@ -4167,6 +4579,11 @@ mk_pykdtree() {
   USE_OMP=0 _setup_build_install pykdtree src/optional/pykdtree-${PYKDTREEVER}.tar.gz pykdtree-${PYKDTREEVER}
 }
 
+mk_pyyaml() {
+  resume_tracker && return 0
+  _setup_build_install pyyaml src/optional/PyYAML-${PYYAMLVER}.tar.gz PyYAML-${PYYAMLVER}
+}
+
 mk_pyresample() {
   resume_tracker && return 0
   _setup_build_install pyresample src/optional/pyresample-${PYRESAMPLEVER}.tar.gz pyresample-${PYRESAMPLEVER}
@@ -4192,7 +4609,7 @@ mk_inotify() {
 
 mk_libffi() {
   resume_tracker && return 0
-  useSysCheck USE_SYS_FFI && return 0 
+  useSysCheck USE_SYS_FFI && return 0
   _configure_make_install libffi src/optional/libffi-${LIBFFIVER}.tar.gz libffi-${LIBFFIVER} --enable-portable-binary
   sed -i.bak 's:$(libdir):${libdir}:g' lib/pkgconfig/libffi.pc
 }
@@ -4225,7 +4642,7 @@ diff -ru minipg/minipg.py minipg/minipg.py
                  if not obj:
 SOSAYWEALL
   make_script minipg <<SOSAYWEALL
-  cython -o minipg/minipy.c minipg/minipg.py 
+  cython -o minipg/minipy.c minipg/minipg.py
 SOSAYWEALL
   _setup_build_install minipg src/optional/minipg-${MINIPGVER}.tar.gz minipg-${MINIPGVER}
 }
@@ -4246,14 +4663,13 @@ mk_cffi() {
 
 mk_pylibtiff() {
   resume_tracker && return 0
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
+  if isPython3 ; then
     #broken on py3
     return 0
   fi
   _find_cots TIFF include/tiff.h $BASE $COTS_HOME ${SYSROOT}/usr || _find_pkgconfig libtiff-4 || oops "pylibtiff needs TIFF"
-  # _setup_build_install pylibtiff src/optional/pylibtiff-${PYLIBTIFFVER}.tar.gz pylibtiff
-  tar xf src/optional/pylibtiff-${PYLIBTIFFVER}.tar.gz -C build
-  (cd build/pylibtiff-${PYLIBTIFFVER}; patch -p0 -l) <<SOSAYWEALL  || oops "Failed to patch pylibtiff"
+
+  make_patch pylibtiff <<SOSAYWEALL  || oops "Failed to patch pylibtiff"
 Index: setup.py
 ===================================================================
 --- setup.py 2014-02-04 16:28:11.330832840 -0600
@@ -4261,7 +4677,7 @@ Index: setup.py
 @@ -52,7 +52,7 @@
          else:
              version += svn_version.strip()
- 
+
 -print version
 +print(version)
  """
@@ -4300,10 +4716,8 @@ Index: libtiff/src/bittools.c
  #include "numpy/arrayobject.h"
 
 SOSAYWEALL
-  (cd build/pylibtiff-${PYLIBTIFFVER} \
-   && ${PYTHON} setup.py build "$@" \
-   && ${PYTHON} setup.py install ${PYTHON_OPTIMIZATION} ) \
-   || oops "pylibtiff build failed"
+
+  _setup_build_install pylibtiff src/optional/pylibtiff-${PYLIBTIFFVER}.tar.gz pylibtiff-${PYLIBTIFFVER} "$@" || oops "pylibtiff build failed"
 }
 
 mk_pillow(){
@@ -4322,7 +4736,7 @@ mk_pillow(){
 +++ setup.py  2012-06-20 23:41:29.000000000 -0500
 @@ -34,11 +34,11 @@
  NAME = 'Pillow'
- PILLOW_VERSION = '$PILLOWVER'
+ PILLOW_VERSION = get_version()
 -JPEG_ROOT = None
 -JPEG2K_ROOT = None
 -ZLIB_ROOT = None
@@ -4361,7 +4775,7 @@ mk_zeromq() {
 @@ -3,6 +3,11 @@
  #include <string.h>
  #include <assert.h>
- 
+
 +#ifndef strndup
 +#include <stdlib.h>
 +#define strndup(c,s) strncpy((char*)calloc(s+1,1),c,s)
@@ -4369,7 +4783,7 @@ mk_zeromq() {
 +
  /// Initialize a zeromq message with a given null-terminated string
  #define ZMQ_PREPARE_STRING(msg, data, size) \
- zmq_msg_init(&msg) && printf("zmq_msg_init: %s\n", zmq_strerror(errno)); 
+ zmq_msg_init(&msg) && printf("zmq_msg_init: %s\n", zmq_strerror(errno));
 PATCH
   make_script zeromq <<SCRIPT
 echo >> tests/test_connect_delay.cpp
@@ -4397,51 +4811,83 @@ mk_ply() { #this is part of pycparser as pycparser.ply, but that is its own util
 mk_pocl() { #opensource opencl implementation
   resume_tracker && return 0
 
-  _find_cots LLVM_BASE bin/llvm-config $BASE || oops 'pocl needs LLVM'
+  _find_cots LLVM_BASE sysbin/llvm-config $BASE || oops 'pocl needs LLVM'
   _find_cots BOOST_BASE include/boost/any.hpp $BASE ${SYSROOT}/usr || oops 'pocl needs boost'
 
-  _cmake_make_install pocl src/experimental/pocl-${POCLVER}.tar.* pocl-${POCLVER}*
+  make_patch pocl <<PATCH
+diff -ru lib/kernel/vecmathlib/vec_sse_double1.h lib/kernel/vecmathlib/vec_sse_double1.h
+--- lib/kernel/vecmathlib/vec_sse_double1.h     2017-05-12 10:30:22.000000000 -0500
++++ lib/kernel/vecmathlib/vec_sse_double1.h     2017-05-12 10:30:43.299535468 -0500
+@@ -65,7 +65,6 @@
+   // boolvec(boolvec const& x): v(x.v) {}
+   // boolvec& operator=(boolvec const& x) { return v=x.v, *this; }
+   boolvec(bvector_t x) : v(x) {}
+-  boolvec(bool a) : v(a) {}
+   boolvec(bool const *as) : v(as[0]) {}
+ 
+   operator bvector_t() const { return v; }
+PATCH
+  _cmake_make_install pocl src/experimental/pocl-${POCLVER}.tar.* pocl-${POCLVER}
  
   return 0
 }
 
 mk_clang(){
+  resume_tracker && return 0
   #build llvm, forcing clang to be built too
-  [ -e bin/llvm-config -a ! -e bin/clang ] && rm -f bin/llvm-config #remove the install check file if clang isn't installed to trigger a rebuild
-  BUILD_LLVM=YES BUILD_CLANG=YES mk_llvm
+  [ -e sysbin/llvm-config -a ! -e bin/clang ] && rm -f sysbin/llvm-config #remove the install check file if clang isn't installed to trigger a rebuild
+  check_gcc_version 4.8 || mk_gcc7
+  mk_zlib \
+    && mk_xz \
+    && mk_libxml \
+    && mk_sqlite \
+    && mk_db48 \
+    && mk_cmake \
+    && mk_py \
+    && \
+  BUILD_LLVM=YES BUILD_CLANG=YES mk_llvm \
+  && echo clang${LLVMVER} >>trim
+
+}
+
+mk_dragonegg() {
+  resume_tracker && return 0
+  
+  make_script dragonegg <<SCRIPT
+echo "exec make \$*" >> configure
+chmod +x configure
+SCRIPT
+
+  _find_cots LLVM_BASE sysbin/llvm-config $BASE || oops "DragonEgg needs LLVM"
+  _find_cots CLANGBIN clang $BASE/sysbin $BASE/bin || oops "DragonEgg needs Clang"
+
+  GCC="$(which gcc)" LDFLAGS="${LDFLAGS} -lcurses -lpthread" _configure_make_install dragonegg src/experimental/dragonegg-${DRAGONEGGVER}.tar.* dragonegg-${DRAGONEGGVER}/ ENABLE_LLVM_PLUGINS=1 || oops "DragonEgg failed to build"
+
+  _check_build_env FC
+
 }
 
 mk_llvm() {
   resume_tracker && return 0
   isFalse BUILD_LLVM && return 0
-  _find_cots LLVM_BASE bin/llvm-config $BASE && return 0
-  name=llvm
-  tarball=src/optional/llvm-${LLVMVER}.src.tar.xz
-  buildir=llvm-${LLVMVER}.src
-  echo unpacking ${name}...
-  rm -rf build/${buildir}
-  LLVMEXTRAPARMS=""
-  xzcat ${tarball} | tar xf - -C build || oops "could not unpack ${name} from ${tarball}"
+  _find_cots LLVM_BASE sysbin/llvm-config $BASE && return 0
+
+  have_cmake || oops "LLVM needs ${CMAKE} to build"
+
+  CMAKEEXTRA="-DLLVM_INSTALL_UTILS=ON -DLLVM_INCLUDE_TESTS=ON"
+  #CMAKEEXTRA="${CMAKEEXTRA} -DLLVM_BUILD_LLVM_DYLIB=ON "
+  isDarwin && CMAKEEXTRA="${CMAKEEXTRA} -DCMAKE_OSX_SYSROOT=${SYSROOT} "
+ 
+ 
+  make_script llvm <<SCRIPT
+  #sed -i.bak 's,~LoopBase(),virtual ~LoopBase(),g' ../include/llvm/Analysis/LoopInfo.h
   if isTrue BUILD_CLANG ; then 
-    ( xzcat src/experimental/cfe-${LLVMVER}.src.tar.xz | tar xf - -C build && mv build/cfe-${LLVMVER}.src build/${buildir}/tools/clang ) || oops "Clang didn't unpack"
-  fi
-  isDarwin && if [ $DARWINVERNUMBER -gt 10 ] ; then #10.6 uses stdc++
-    LLVMEXTRAPARMS="${LLVMEXTRAPARMS} --enable-libcpp"
+    ( xzcat ${BASE}/src/optional/cfe-${LLVMVER}.src.tar.xz | tar xf - -C tools && mv tools/cfe-${LLVMVER}.src tools/clang ) || oops "Clang didn't unpack"
   fi
-  echo "building ${name} for $BASE"
-  #configure script isn't compatible with python 3, so disable PYTHON
+SCRIPT
 
-  CMAKEEXTRA=""
-  isDarwin && CMAKEEXTRA="${CMAKEEXTRA} -DCMAKE_OSX_SYSROOT=${SYSROOT} "
-  CMAKE=${BASE}/bin/cmake
+  _cmake_make_install llvm src/optional/llvm-${LLVMVER}.src.tar.xz llvm-${LLVMVER}.src ${CMAKEEXTRA} "$@" || oops "${name} build failed"
 
-    echo "building ${name} for $BASE"
-    (cd build/${buildir}  \
-     && mkdir build && cd build && ${CMAKE} -DCMAKE_INSTALL_PREFIX:PATH=${BASE} ${CMAKEEXTRA} "$@" .. \
-     && sed -i.bak 's,~LoopBase(),virtual ~LoopBase(),g' ../include/llvm/Analysis/LoopInfo.h \
-     && make \
-   && MAKEFLAGS="" make install ) \
-   || oops "${name} build failed"
   reid_all
   LLVMSIMPLEVER=$(echo ${LLVMVER} | cut -c-3)
   isDarwin && for f in bin/* lib/* ; do \
@@ -4453,8 +4899,17 @@ mk_llvm() {
           "$f" ; \
         fi ;\
       done
+  mv bin/llvm* bin/clang* sysbin
+  for f in build/llvm-*/*/bin/* ; do
+    bnf="$( basename "$f" )"
+    if [ -e bin/"$bnf" ] ; then
+      mv bin/"$bnf" sysbin
+    fi
+  done
+
+  isTrue BUILD_CLANG && _check_build_env CC CXX CPP
+
   return 0
-  #_configure_make_install llvm src/optional/llvm-${LLVMVER}.src.tar.gz llvm-${LLVMVER}.src --enable-shared --enable-keep-symbols
 }
 
 # needed by matplotlib
@@ -4537,28 +4992,23 @@ mk_llvmlite() {
   #pip_install src/optional/funcsigs-*.tar.gz  || oops 'funcsigs did not install'
   pip_install src/optional/argparse-*.tar.gz  || oops 'argparse did not install'
 
-  name=llvmlite
-  tarball=src/optional/llvmlite-${LLVMLITEVER}.tar.gz
-  buildir=llvmlite-${LLVMLITEVER}
-
-  echo unpacking ${name}...
-  tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
+  make_script llvmlite <<SCRIPT
   sed -e 's,MACOSX_DEPLOYMENT_TARGET=10.7 ,,g' -e 's, -stdlib=libc++,,g' \
      -e "s,CXXFLAGS = ,CXXFLAGS = ${CXXFLAGS} ${CPPFLAGS} -I${BASE}/include ,g" \
      -e "s,LDFLAGS = ,LDFLAGS = ${LDFLAGS} ,g" -e "s,-static-libstdc++,,g" \
-     -i .old build/${buildir}/ffi/Makefile.*
-  echo "building ${name} for $BASE"
-  (cd build/${buildir} \
-   && ${PYTHON} setup.py build "$@" \
-   && ${PYTHON} setup.py install ${PYTHON_OPTIMIZATION} ) \
-   || oops "${name} build failed"
-  reid $( find ${BASE} -name libllvmlite* ) 
-  #_setup_build_install llvmlite src/optional/llvmlite-${LLVMLITEVER}.tar.gz llvmlite-${LLVMLITEVER} || oops 'llvmlite did not install'
+     -i.old ffi/Makefile.*
+SCRIPT
+
+  CC="$( isLinux && echo gcc || echo $CC )" CXX="$( isLinux && echo g++ || echo $CXX )" _setup_build_install llvmlite src/optional/llvmlite-${LLVMLITEVER}.tar.* llvmlite-${LLVMLITEVER} || oops 'llvmlite did not install'
+  reid $( find ${BASE}/*ib* -type f -name libllvmlite* ) 
   return 0
 }
 
 mk_requests() {
   resume_tracker && return 0
+  pip_install src/optional/urllib3-* || oops "urllib3 wouldn't install"
+  pip_install src/optional/idna-* || oops "idna wouldn't install"
+  pip_install src/optional/chardet-* || oops "chardet wouldn't install"
   _setup_build_install requests src/optional/requests-${REQUESTSVER}.tar.gz requests-${REQUESTSVER}
 }
 
@@ -4582,6 +5032,58 @@ mk_graphviz(){
   pip_install src/optional/graphviz*zip || oops 'graphviz for python did not install'
 }
 
+mk_gnureadline(){
+    resume_tracker && return 0
+  
+    isNotDarwin && buildPortable && return 0
+
+    _find_cots NCURSES include/ncurses.h $BASE $COTS_HOME ${SYSROOT}/usr || oops 'gnureadline needs ncurses'
+    #pip_install src/optional/pyreadline-*.zip || oops 'pyreadline did not install'
+    _find_cots LIBREADLINE include/readline/readline.h $BASE ${SYSROOT}/usr || oops "gnureadline needs libreadline"
+    _find_cots_lib LIBREADLINE libreadline $BASE ${SYSROOT}/usr || oops "gnureadline needs libreadline"
+    _find_cots_lib LIBHISTORY libhistory $BASE ${SYSROOT}/usr || oops "gnureadline needs libhistory"
+
+    make_script gnureadline <<SCRIPT
+find * -type f | xargs sed -i.bak -e 's,readline/readline.h,readline/sb3readline.h,g' -e 's,readline/history.h,readline/sb3history.h,g'
+find * -name "*.bak" | xargs rm -f
+ln -s readline.h ${BASE}/include/readline/sb3readline.h
+ln -s history.h ${BASE}/include/readline/sb3history.h
+echo -n
+SCRIPT
+
+    make_patch gnureadline <<PATCH
+diff -ru setup.py setup.py
+--- setup.py  2014-04-08 07:19:17.000000000 -0500
++++ setup.py  2017-06-24 22:53:38.000000000 -0500
+@@ -55,7 +55,7 @@
+         verbose = True
+     
+ # Build readline first, if it is not there and we are building the module
+-if building and not os.path.exists('readline/libreadline.a'):
++if False and building and not os.path.exists('readline/libreadline.a'):
+     if verbose:
+         print("\n============ Building the readline library ============\n")
+         os.system('cd rl && /bin/bash ./build.sh')
+@@ -111,8 +111,8 @@
+                   sources=[source],
+-                  include_dirs=['.'],
++                  include_dirs=[os.path.join(os.environ['LIBREADLINE'],'include'),os.path.join(os.environ['NCURSES'],'include')],
+                   define_macros=DEFINE_MACROS,
+-                  extra_objects=['readline/libreadline.a', 'readline/libhistory.a'],
+-                  libraries=['ncurses']
++                  extra_objects=[os.environ['LIBREADLINELIBFILE'], os.environ['LIBHISTORYLIBFILE']],
++                  libraries=['ncurses']
+         ),
+     ],
+     zip_safe=False,
+PATCH
+    #_compiler_proxy_start CC gcc #this sucks. the build script in gnureadline doesn't think of parameters
+    _setup_build_install gnureadline src/optional/gnureadline-${GNUREADLINEVER}.tar.* gnureadline-${GNUREADLINEVER} || oops 'gnureadline did not install'
+    #_compiler_proxy_end CC gcc
+
+    return 0
+}
+
 mk_ipython() {
   resume_tracker && return 0
   # metric arse-banana-ton of dependencies to get ipython notebook going
@@ -4599,19 +5101,8 @@ mk_ipython() {
 
   _setup_build_install Sphinx src/optional/Sphinx-${SPHINXVER}.tar.gz Sphinx-${SPHINXVER}
 
-  #if [ "${PYFSVERMAJOR}" == "3" ] ; then
-  #  pip_install src/optional/pycurl-*z || oops 'pycurl did not install'
-  #else
-  #  pip_install src/optional/pycurl2-*z || oops 'pycurl2 did not install'
-  #fi
-  if notBuildPortable ; then
-    _find_cots NCURSES include/ncurses.h $BASE $COTS_HOME ${SYSROOT}/usr || oops 'readline needs ncurses'
-    #pip_install src/optional/pyreadline-*.zip || oops 'pyreadline did not install'
-
-    _compiler_proxy_start CC gcc #this sucks. the build script in gnureadline doesn't think of parameters
-    _setup_build_install gnureadline src/optional/gnureadline-*tar.gz $( basename  src/optional/gnureadline-*z .tar.gz )  || oops 'gnureadline did not install'
-    _compiler_proxy_end CC gcc
-  fi
+  mk_libreadline || oops "libreadline did not build"
+  mk_gnureadline || oops "gnureadline did not build"
 
   if isDarwin ; then
     pip_install src/macos/appnope-*.gz  || oops 'appnope did not install'
@@ -4630,16 +5121,204 @@ mk_ipython() {
   pip_install src/optional/backports.shutil_get_terminal_size-*.gz  || oops 'backports.shutil_get_terminal_size did not install'
   pip_install src/optional/wcwidth-*z || oops "wcwidth did not install"
   pip_install src/optional/prompt_toolkit-*z || oops "prompt_toolkit did not install"
-  pip_install src/optional/ipython-*z || oops 'ipython did not install'
-  pip_install src/optional/mod_pywebsocket*z || oops 'pywebsocket did not install'
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
-    echo "mplh5canvas not compatible with py3"
+  if isPython2 ; then
+    pip_install src/optional/ipython-${PY2IPYTHONVER}.tar.* || oops 'ipython did not install'
   else
-    pip_install src/optional/mplh5canvas*z || oops 'mplh5canvas did not install'
+    pip_install src/optional/jedi-* || oops 'jedi did not install'
+    pip_install src/optional/ipython-${IPYTHONVER}.tar.* || oops 'ipython did not install'
   fi
+  pip_install src/optional/mod_pywebsocket*z || oops 'pywebsocket did not install'
+
+  make_patch mplh5canvas <<PATCH
+diff -ru examples/imshow_plot.py examples/imshow_plot.py
+--- examples/imshow_plot.py 2011-10-25 07:57:26.000000000 -0500
++++ examples/imshow_plot.py 2017-05-08 16:35:07.000000000 -0500
+@@ -15,7 +15,7 @@
+ title('Another test')
+ show(block=False)
+  # show the figure manager but don't block script execution so animation works..
+-print "Animating... Ctrl-C to stop"
++print("Animating... Ctrl-C to stop")
+ while True:
+     img = standard_normal((50,100))
+     image.set_data(img)
+diff -ru examples/interactive_plot.py examples/interactive_plot.py
+--- examples/interactive_plot.py  2011-10-25 07:57:26.000000000 -0500
++++ examples/interactive_plot.py  2017-05-08 16:35:41.000000000 -0500
+@@ -8,11 +8,11 @@
+ 
+ def onclick(ev):
+     """Callback when mouse button is released."""
+-    print "Received click. X: %i, Y: %i" % (ev.x, ev.y)
++    print("Received click. X: %i, Y: %i" % (ev.x, ev.y))
+     if ev.inaxes is not None:
+-        print "Data X: %f, Data Y: %f" % (ev.xdata, ev.ydata)
++        print("Data X: %f, Data Y: %f" % (ev.xdata, ev.ydata))
+     else:
+-        print "Click was not over active axes."
++        print("Click was not over active axes.")
+ 
+ def next_data(ax):
+     """Shift data along x-axis."""
+@@ -36,7 +36,7 @@
+ def next_target_callback(event):
+     next_data(ax)
+     f.canvas.draw()
+-    print "Next was called..."
++    print("Next was called...")
+ next_target_button.on_clicked(next_target_callback)
+ 
+ show()
+diff -ru examples/monitor_plot.py examples/monitor_plot.py
+--- examples/monitor_plot.py  2011-10-25 07:57:26.000000000 -0500
++++ examples/monitor_plot.py  2017-05-08 16:35:57.000000000 -0500
+@@ -10,7 +10,7 @@
+ 
+ def user_cmd_ret(*args):
+     """Handle any data returned from calls to canvas.send_cmd()"""
+-    print "Got return from user event:",args
++    print("Got return from user event:",args)
+ 
+ def user_event(figure_id, *args):
+     f = figure(int(figure_id)+1)
+diff -ru mplh5canvas/backend_h5canvas.py mplh5canvas/backend_h5canvas.py
+--- mplh5canvas/backend_h5canvas.py 2013-07-15 17:23:52.000000000 -0500
++++ mplh5canvas/backend_h5canvas.py 2017-05-08 16:33:15.000000000 -0500
+@@ -532,12 +532,12 @@
+         except:
+             logger.warning("Failed to open figure page in your browser. Please browse to %s/%s" % (h5m.url,str(Gcf.get_active().canvas.figure.number)))
+     if block and not _test:
+-        print "Showing figures. Hit Ctrl-C to finish script and close figures..."
++        print("Showing figures. Hit Ctrl-C to finish script and close figures...")
+         try:
+             while True:
+                 time.sleep(1)
+         except KeyboardInterrupt:
+-            print "Shutting down..."
++            print("Shutting down...")
+ 
+ def new_figure_manager(num, *args, **kwargs):
+     """
+diff -ru mplh5canvas/management_server.py mplh5canvas/management_server.py
+--- mplh5canvas/management_server.py  2013-07-15 16:28:10.000000000 -0500
++++ mplh5canvas/management_server.py  2017-05-08 16:33:33.000000000 -0500
+@@ -134,10 +134,10 @@
+         RequestHandler.server_port = str(self.port)
+         self.url = "http://%s:%i" % (self.ip, self.port)
+         self._request_handlers = {}
+-        print "============================================================================================"
+-        print "Management interface active. Browse to %s to view all plots." % self.url
+-        print "Alternatively, browse to %s/figure1 etc. to view individual figures." % self.url
+-        print "============================================================================================"
++        print("============================================================================================")
++        print("Management interface active. Browse to %s to view all plots." % self.url)
++        print("Alternatively, browse to %s/figure1 etc. to view individual figures." % self.url)
++        print("============================================================================================")
+         sys.stdout.flush()
+ 
+     def _external_ip(self, preferred_prefixes=('eth', 'en')):
+diff -ru setup.py setup.py
+--- setup.py  2013-07-26 09:40:12.000000000 -0500
++++ setup.py  2017-05-08 16:32:46.000000000 -0500
+@@ -10,8 +10,8 @@
+ import sys
+ 
+ if LooseVersion(mpl_version) < LooseVersion("0.99.1.1"):
+-    print "The HTML5 Canvas Backend requires matplotlib 0.99.1.1 or newer. " \\
+-          "Your version (%s) appears older than this. Unable to continue..." % (mpl_version,)
++    print("The HTML5 Canvas Backend requires matplotlib 0.99.1.1 or newer. ")
++    print("Your version (%s) appears older than this. Unable to continue..." % (mpl_version,))
+     sys.exit(0)
+ 
+ here = os.path.abspath(os.path.dirname(__file__))
+diff -ru tests/rec.py tests/rec.py
+--- tests/rec.py  2013-07-15 16:54:38.000000000 -0500
++++ tests/rec.py  2017-05-08 16:34:52.000000000 -0500
+@@ -20,15 +20,15 @@
+                 s = base64.b64decode(b64[22:])
+                  # skip space and data:image/png;base64, header
+             except Exception,e:
+-                print "Base64 decoding failed. Maybe not an image...",e
++                print("Base64 decoding failed. Maybe not an image...",e)
+                 break
+             if s[0:5] == '\\x89PNG\\r':
+-                print "Base64 decoding passed. Writing image to ",filename
++                print("Base64 decoding passed. Writing image to ",filename)
+                 f = open(os.path.join(".", "output", "h5canvas_" + filename), "w")
+                 f.write(s)
+                 f.close()
+         except Exception,e:
+-            print "Failed...",e
++            print("Failed...",e)
+             break
+ 
+ wsserver = simple_server.WebSocketServer(('', 8123), request, simple_server.WebSocketRequestHandler)
+diff -ru tests/test.py tests/test.py
+--- tests/test.py 2013-07-15 17:39:36.000000000 -0500
++++ tests/test.py 2017-05-08 16:34:36.000000000 -0500
+@@ -42,10 +42,10 @@
+ if options.file:
+     options.dir = os.path.dirname(options.file)
+     files = [os.path.basename(options.file)]
+-    print "Dir:",options.dir,",Files:",files
++    print("Dir:",options.dir,",Files:",files)
+ 
+ if files == []:
+-    print "No .py files found in the specified directory (%s)" % options.dir
++    print("No .py files found in the specified directory (%s)" % options.dir)
+     sys.exit(0)
+ 
+ import matplotlib
+@@ -62,7 +62,7 @@
+ thtml = "<html><head><body><table><tr><th>File<th>H5 Canvas (PNG from Chrome 4.0 OSX)<th>PNG</tr>"
+ files.sort()
+ for count, filename in enumerate(files):
+-    print "Running %s\\n" % filename
++    print("Running %s\\n" % filename)
+     html += "<tr><th id='name_" + str(count) + "'>" + filename
+     thtml += "<tr><th id='name_" + str(count) + "'>" + filename
+     try:
+@@ -70,7 +70,7 @@
+         f = gcf()
+         f.canvas.draw()
+     except Exception, e:
+-        print "Failed to run script %s. (%s)" % (filename, str(e))
++        print("Failed to run script %s. (%s)" % (filename, str(e)))
+         html += "<td>Failed to execute script.<td>Failed to execute script.<td>Failed to execute script.</tr>"
+         thtml += "<td>Failed to execute script.<td>Failed to execute script.<td>Failed to execute script.</tr>"
+         if options.crash:
+@@ -89,7 +89,7 @@
+         html += "\\n</script></canvas>"
+         thtml += "<td><img src='%s' width='%dpx' height='%dpx' />" % ("h5canvas_" + png_filename, w, h)
+     except Exception, e:
+-        print "Failed to create Canvas for %s. (%s)" % (filename, str(e))
++        print("Failed to create Canvas for %s. (%s)" % (filename, str(e)))
+         html += "<td>Failed to create Canvas"
+         thtml += "<td>Failed to create Canvas"
+         if options.crash:
+@@ -100,7 +100,7 @@
+         html += "<td><img src='%s' width='%dpx' height='%dpx' />" % (png_filename, w, h)
+         thtml += "<td><img src='%s' width='%dpx' height='%dpx' />" % (png_filename, w, h)
+     except Exception, e:
+-        print "Failed to create PNG for %s. (%s)" % (filename, str(e))
++        print("Failed to create PNG for %s. (%s)" % (filename, str(e)))
+         html += "<td>Failed to create PNG"
+         thtml += "<td>Failed to create PNG"
+         if options.crash:
+@@ -119,7 +119,7 @@
+     html += "</tr>"
+     thtml += "</tr>"
+ 
+-print "Finished processing files..."
++print("Finished processing files...")
+ ip = mplh5canvas.backend_h5canvas.h5m._external_ip()
+ html += "</table><script> var total_plots = " + str(count) + "; "
+ pi = """
+PATCH
+  _setup_build_install mplh5canvas src/optional/mplh5canvas-${MPLH5CANVASVER}.tar.* mplh5canvas-${MPLH5CANVASVER} || oops 'mplh5canvas did not install'
   #bin/easy_install-${PYFSVER} -Z --no-deps src/optional/readline*z || oops 'readline did not install'
   pip_install src/optional/zope.interface-*z || oops 'zope.interface did not install'
-  pip_install src/optional/DateTime*zip || oops 'DateTime did not install'
+  pip_install src/optional/DateTime-* || oops 'DateTime did not install'
   # bin/python${PYFSVER} -c 'from IPython.external import mathjax; mathjax.install_mathjax()' || oops 'mathjax installation failed'
   isDarwin && make_frameworklinks
   # workaround for http://bugs.python.org/issue6059 due to glibc problem on RHEL6, segfault in uuid4
@@ -4650,7 +5329,7 @@ mk_ipython() {
 
 mk_sqlalchemy(){ #used with aeri-mads
   resume_tracker && return 0
-  pip_install src/optional/SQLAlchemy-*z || oops 'SQLAlchemy did not install'  
+  pip_install src/optional/SQLAlchemy-*z || oops 'SQLAlchemy did not install'
 }
 
 mk_pycrypto() {
@@ -4665,7 +5344,7 @@ mk_pexif() {
 
 mk_mpld3() {
   resume_tracker && return 0
-  pip_install src/optional/mpld3-*tar* || oops 'mpld3 did not install'
+  _setup_build_install mpld3 src/optional/mpld3-${MPLD3VER}.tar* mpld3-${MPLD3VER} || oops 'mpld3 did not install'
 }
 
 mk_tenti() {
@@ -4680,10 +5359,20 @@ mk_dplkit() {
 
 mk_ssec_all() {
   resume_tracker && return 0
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
-    return 0
-  fi
-  pip_install src/SSEC/virtual_radiosonde_source-*z || oops 'VRS did not install'
+  make_patch virtual_radiosonde_source <<PATCH
+diff -ru setup.py setup.py
+--- setup.py  2017-04-04 15:40:34.000000000 -0500
++++ setup.py  2017-05-09 16:07:06.000000000 -0500
+@@ -13,7 +13,6 @@
+       author_email='cmphillips5@wisc.edu',
+       packages=['virtual_radiosonde_source'],
+       install_requires=[
+-        'python>=2.6',
+         'numpy',
+         'scipy',
+         'pyproj',
+PATCH
+  _setup_build_install virtual_radiosonde_source src/SSEC/virtual_radiosonde_source-0.1.4.tar.gz virtual_radiosonde_source-0.1.4 || oops 'VRS did not install'
   pip_install src/SSEC/aeri-mads-*z || oops 'aeri-mads did not install'
 }
 
@@ -4700,6 +5389,8 @@ mk_pyramid() {
   pip_install src/optional/translationstring-*z || oops 'translationstring did not install'
   pip_install src/optional/PasteDeploy-*z || oops 'PasteDeploy did not install'
   pip_install src/optional/hupper-*z || oops 'hupper did not install'
+  pip_install src/optional/plaster-* || oops 'plaster did not install'
+  pip_install src/optional/plaster_pastedeploy-* || oops 'plaster did not install'
   pip_install src/optional/pyramid-*z || oops 'pyramid did not install'
   pip_install src/optional/pyramid_mako-*z || oops 'pyramid_mako did not install'
   pip_install src/optional/Pygments*z || oops 'Pygments did not install'
@@ -4735,57 +5426,127 @@ mk_pylint() {
   pip_install src/optional/pylint-${PYLINTVER}.* || oops 'pylint did not install'
   pip_install src/optional/pylint-plugin-utils-*z || oops 'pylint-plugin-utils did not install'
   pip_install src/optional/pylint-common-*z || oops 'pylint-common did not install'
-  pip_install src/optional/pyflakes-*z || oops 'pyflakes did not install'  
+  pip_install src/optional/pyflakes-*z || oops 'pyflakes did not install'
   isDarwin && make_frameworklinks
   return 0
 }
 
 mk_dsltools() {
   resume_tracker && return 0
-  _setup_build_install dsltools src/experimental/dsltools-${DSLTOOLSVER}.tar.gz dsltools-${DSLTOOLSVER} 
+  _setup_build_install dsltools src/experimental/dsltools-${DSLTOOLSVER}.tar.gz dsltools-${DSLTOOLSVER}
 }
 
 mk_parakeet() {
   resume_tracker && return 0
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
-    #broken on py3
-    return 0
-  fi
+
+  make_patch parakeet <<PATCH
+diff -ru setup.py setup.py
+--- setup.py  2013-11-20 01:50:12.000000000 -0600
++++ setup.py  2017-05-09 16:17:50.000000000 -0500
+@@ -3,7 +3,7 @@
+ from setuptools import setup, find_packages
+ import os 
+ 
+-import parakeet.package_info
++#import parakeet.package_info
+ 
+ readme_filename = os.path.join(os.path.dirname(__file__), 'README.md')
+ with open(readme_filename, 'r') as f:
+@@ -13,7 +13,7 @@
+   import pypandoc
+   readme = pypandoc.convert(readme, to='rst', format='md')
+ except:
+-  print "Conversion of long_description from markdown to reStructuredText failed, skipping..."
++  print("Conversion of long_description from markdown to reStructuredText failed, skipping...")
+ 
+ setup(
+     name="parakeet",
+@@ -28,8 +28,8 @@
+     author="Alex Rubinsteyn",
+     author_email="alexr@cs.nyu.edu",
+     license="BSD",
+-    version=parakeet.package_info.__version__,
+-    url=parakeet.package_info.__website__, 
++    version="${PARAKEETVER}",
++    #url=parakeet.package_info.__website__, 
+     download_url = 'https://github.com/iskandr/parakeet/releases', 
+     packages=find_packages() + ['parakeet.test', 'parakeet.benchmarks', 'parakeet.examples'], 
+     package_dir={ 
+PATCH
+
   _setup_build_install parakeet src/experimental/parakeet-${PARAKEETVER}.tar.gz parakeet-${PARAKEETVER} 
 }
 
 mk_meta() {
   resume_tracker && return 0
-  _setup_build_install meta src/optional/meta-${METAVER}.tar.gz meta-${METAVER} 
+  _setup_build_install meta src/optional/meta-${METAVER}.tar.gz meta-${METAVER}
 }
 
 mk_oclpb() {
   resume_tracker && return 0
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
-    #broken on py3
-    return 0
-  fi
   isDarwin && if [ $DARWINVERNUMBER -le 10 ] ; then #10.6 opencl is too old
     return 0
   fi
+
+  make_patch oclpb <<PATCH
+diff -ru setup.py setup.py
+--- setup.py  2017-05-09 16:20:41.000000000 -0500
++++ setup.py  2017-05-09 16:23:14.000000000 -0500
+@@ -52,7 +52,7 @@
+     have_opengl = True
+ except ImportError as err:
+     have_opengl = False
+-    print err
++    print(err)
+     
+ if os.environ.get('NO_OPENGL'):
+     have_opengl = False
+@@ -72,12 +72,12 @@
+     ext_modules = [extension(name, '.c') for name in pyx_extention_names]
+ 
+ try:
+-    long_description = open('README.rst').read()
++    long_description = open('README.rst').read()
+ except IOError as err:
+     long_description = str(err)
+     
+ try:
+-    exec open(join('opencl', 'version.py')).read()
++    __version__ = "${OCLPBVER}"
+ except IOError as err:
+     __version__ = '???'
+ 
+PATCH
+
   _find_cots OCL_INC opencl.h $BASE/include/CL /usr/include/CL ${SYSROOT}/System/Library/Frameworks/OpenCL.framework/Versions/Current/Headers || return 0
   _find_cots AMDAPPSDKROOT include/CL/opencl.h $BASE ${SYSROOT}/usr
   # this does require Mac OS X 10.7 or newer to compile
-  _setup_build_install oclpb "src/experimental/opencl-for-python-${OCLPBVER}.tar.gz" "opencl-for-python-${OCLPBVER}" 
+  _setup_build_install oclpb "src/experimental/opencl-for-python-${OCLPBVER}.tar.gz" "opencl-for-python-${OCLPBVER}"
 }
 
 mk_clyther() {
   resume_tracker && return 0
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
-    #broken on py3
-    return 0
-  fi
   isDarwin && if [ $DARWINVERNUMBER -le 10 ] ; then #10.6 opencl is too old
     return 0
   fi
+
+  make_patch clyther <<PATCH
+diff -ru /setup.py setup.py
+--- /setup.py 2012-01-09 19:59:30.000000000 -0600
++++ setup.py  2017-05-09 16:28:04.000000000 -0500
+@@ -15,7 +15,7 @@
+     long_description = str(err)
+ 
+ try:
+-    exec open(join('clyther', 'version.py')).read()
++    __version__ = "${CLYTHERVER}"
+ except IOError as err:
+     __version__ = '???'
+ 
+PATCH
   _find_cots OCL_INC opencl.h $BASE/include/CL ${SYSROOT}/usr/include/CL ${SYSROOT}/System/Library/Frameworks/OpenCL.framework/Versions/Current/Headers || return 0
   _find_cots AMDAPPSDKROOT include/CL/opencl.h $BASE ${SYSROOT}/usr
-  _setup_build_install clyther src/experimental/Clyther-${CLYTHERVER}.tar.gz Clyther-${CLYTHERVER} 
+  _setup_build_install clyther src/experimental/Clyther-${CLYTHERVER}.tar.gz Clyther-${CLYTHERVER}
 }
 
 mk_mako() {
@@ -4796,10 +5557,6 @@ mk_mako() {
 
 mk_gitpy() {
   resume_tracker && return 0
-  if [ "${PYFSVERMAJOR}" == "3" ] ; then
-    #async and gitdb are broken on py3
-    return 0
-  fi
   pip_install src/optional/async-*z || oops 'async did not install'
   pip_install src/optional/smmap2-*z || oops 'smmap2 did not install'
   pip_install src/optional/gitdb2-*z || oops 'gitdb2 did not install'
@@ -4824,7 +5581,7 @@ mk_pyopencl() {
 --- setup.py  2013-10-28 09:42:54.000000000 -0500
 +++ setup.py  2013-11-21 17:06:47.000000000 -0600
 @@ -9,11 +9,19 @@
- 
+
      import sys
      if 'darwin' in sys.platform:
 -        import platform
@@ -4851,7 +5608,7 @@ mk_pyopencl() {
 SOSAYWEALL
 
   make_script pyopencl <<SOSAYWEALL
-  ${PYTHON} configure.py ${EXTRAPYOPENCLPARMS} 
+  ${PYTHON} configure.py ${EXTRAPYOPENCLPARMS}
 SOSAYWEALL
 
   CFLAGS="$CFLAGS -I${BASE}/include" _setup_build_install pyopencl src/experimental/pyopencl-${PYOPENCLVER}.tar.gz pyopencl-${PYOPENCLVER}
@@ -4866,9 +5623,9 @@ mk_boost() {
   _find_cots FULLPY bin/python${PYFSVER} ${BASE}/Library/Frameworks/Python.framework/Versions/${PYFSVER} $BASE || oops "Can't find python!"
   _find_cots_lib FULLPY libpython${PYFSVER} ${FULLPY} || oops "Can't find libpython!"
 
-  name=boost 
+  name=boost
   tarball=src/experimental/boost_${BOOSTVER}.tar.bz2
-  buildir=boost_${BOOSTVER} 
+  buildir=boost_${BOOSTVER}
 
   BOOTSTRAPPARMS=""
   if [ -z "${ICU}" ] ; then
@@ -4892,7 +5649,7 @@ mk_boost() {
   tar xf ${tarball} -C build || oops "could not unpack ${name} from ${tarball}"
   echo "building ${name} for $BASE"
   isDarwin && export EXTRABOOSTPARMS="toolset=clang"
-  test -e bin/clang && export EXTRABOOSTPARMS="toolset=clang"
+  test -e sysbin/clang && export EXTRABOOSTPARMS="toolset=clang"
   (cd build/${buildir} \
    && ./bootstrap.sh --prefix=$BASE ${BOOTSTRAPPARMS} --with-python=${PYTHON} "$@" \
    && ./b2 ${EXTRABOOSTPARMS} cxxflags="$( ${BASE}/bin/python${PYFSVER}-config --cflags ) ${CXXFLAGS} ${CPPFLAGS}" \
@@ -4922,13 +5679,13 @@ mk_boost() {
 
 mk_pycuda() {
   resume_tracker && return 0
-  _find_cots CUDA_ROOT bin/nvcc $BASE $COTS_HOME ${SYSROOT}/usr /usr/local/cuda /Developer/NVIDIA/CUDA-* 
+  _find_cots CUDA_ROOT bin/nvcc $BASE $COTS_HOME ${SYSROOT}/usr /usr/local/cuda /Developer/NVIDIA/CUDA-*
   if [ -z "$CUDA_ROOT" ] ; then
     echo "WARNING pycuda needs system-installed CUDA https://developer.nvidia.com/cuda-downloads. Ignoring"
     return 0
   fi
-  name=pycuda 
-  tarball=src/experimental/pycuda-${PYCUDAVER}.tar.gz 
+  name=pycuda
+  tarball=src/experimental/pycuda-${PYCUDAVER}.tar.gz
   buildir=pycuda-${PYCUDAVER}
   echo "unpacking ${name}..."
   rm -rf build/pycuda-${PYCUDAVER}
@@ -4944,29 +5701,30 @@ mk_pycuda() {
 }
 
 test_opencl() {
+  # verify that we can build a simple binary using OpenCL
+  resume_tracker && return 0
   if [ -z "$CXX" ] ; then
-    MYCXX=g++
+    MYCXX="g++ ${CXXFLAGS}"
   else
-    MYCXX=$CXX
+    MYCXX="$CXX ${CXXFLAGS}"
   fi
-  _tmpenvset CXX "${MYCXX} ${CXXFLAGS}"
   if isDarwin ; then
-    ( $CXX $CXXFLAGS -framework OpenCL -o sysbin/clInfo src/experimental/clInfo.c && ./sysbin/clInfo ) || open "clInfo failed"
+    ( $MYCXX -framework OpenCL -o sysbin/clInfo src/experimental/clInfo.c && ./sysbin/clInfo ) || open "clInfo failed"
   elif isLinux ; then
-    ( $CXX $CXXFLAGS -lOpenCL -o sysbin/clInfo src/experimental/clInfo.c && LD_LIBRARY_PATH="${BASE}/lib64:${BASE}/lib" ./sysbin/clInfo ) || oops "clInfo failed"
+    ( $MYCXX -I${BASE}/include -L${BASE}/lib64 -L${BASE}/lib -lOpenCL -o sysbin/clInfo src/experimental/clInfo.c && LD_LIBRARY_PATH="${BASE}/lib64:${BASE}/lib" ./sysbin/clInfo ) || oops "clInfo failed"
   else
     echo "WARNING: Can't test OpenCL"
   fi
-  _tmpenvres CXX
+
 }
 
 mk_softopencl() {
   # build POCL, LLVM-based OpenCL support
   resume_tracker && return 0
 
-  useSysCheck USE_SYS_OPENCL && return 0 
+  useSysCheck USE_SYS_OPENCL && return 0
 
-  isTrue USE_MAC_OPENCL && return 0
+  isTrue USE_PORTABLE_OPENCL && return 0
 
   mk_boost \
   && mk_hwloc \
@@ -5002,7 +5760,7 @@ mk_hpc() {
 
 mk_libreadline() {
   resume_tracker && return 0
-  _configure_make_install libreadline src/optional/IDL/readline-${LIBREADLINEVER}.tar.gz readline-${LIBREADLINEVER}
+  _configure_make_install libreadline src/optional/readline-${LIBREADLINEVER}.tar.gz readline-${LIBREADLINEVER}
 }
 
 mk_gsl() {
@@ -5017,7 +5775,7 @@ mk_libproject() {
 
 mk_libproj4() {
   resume_tracker && return 0
-  _configure_make_install libproj4 src/optional/IDL/proj.4-${LIBPROJ4VER}.tar.* proj.4-${LIBPROJ4VER}
+  _configure_make_install libproj4 src/optional/proj.4-${LIBPROJ4VER}.tar.* proj.4-${LIBPROJ4VER}
 }
 
 mk_octave() {
@@ -5043,97 +5801,97 @@ diff -ru liboctave/numeric/CmplxCHOL.h liboctave/numeric/CmplxCHOL.h
 --- liboctave/numeric/CmplxCHOL.h 2015-10-08 18:00:51.000000000 -0500
 +++ liboctave/numeric/CmplxCHOL.h  2015-10-09 12:19:13.000000000 -0500
 @@ -93,7 +93,7 @@
- 
+
    bool is_upper;
- 
+
 -  octave_idx_type init (const ComplexMatrix& a, bool upper, bool calc_cond);
 +  octave_idx_type init (const ComplexMatrix& a, bool upper = true, bool calc_cond = false);
  };
- 
+
  ComplexMatrix OCTAVE_API chol2inv (const ComplexMatrix& r);
 diff -ru liboctave/numeric/CmplxSCHUR.h liboctave/numeric/CmplxSCHUR.h
 --- liboctave/numeric/CmplxSCHUR.h  2015-10-08 18:00:51.000000000 -0500
 +++ liboctave/numeric/CmplxSCHUR.h 2015-10-09 12:35:21.000000000 -0500
 @@ -88,7 +88,7 @@
    select_function selector;
- 
+
    octave_idx_type init (const ComplexMatrix& a, const std::string& ord,
 -                        bool calc_unitary);
 +                        bool calc_unitary = true);
  };
- 
+
  #endif
 diff -ru liboctave/numeric/dbleCHOL.h liboctave/numeric/dbleCHOL.h
 --- liboctave/numeric/dbleCHOL.h  2015-10-08 18:00:51.000000000 -0500
 +++ liboctave/numeric/dbleCHOL.h 2015-10-09 12:36:20.000000000 -0500
 @@ -90,7 +90,7 @@
- 
+
    bool is_upper;
- 
+
 -  octave_idx_type init (const Matrix& a, bool upper, bool calc_cond);
 +  octave_idx_type init (const Matrix& a, bool upper = true, bool calc_cond = false);
  };
- 
+
  Matrix OCTAVE_API chol2inv (const Matrix& r);
 diff -ru liboctave/numeric/dbleSCHUR.h liboctave/numeric/dbleSCHUR.h
 --- liboctave/numeric/dbleSCHUR.h 2015-10-08 18:00:51.000000000 -0500
 +++ liboctave/numeric/dbleSCHUR.h  2015-10-09 12:36:57.000000000 -0500
 @@ -83,7 +83,7 @@
    select_function selector;
- 
+
    octave_idx_type init (const Matrix& a, const std::string& ord,
 -                        bool calc_unitary);
 +                        bool calc_unitary = true);
  };
- 
+
  #endif
 diff -ru liboctave/numeric/fCmplxCHOL.h liboctave/numeric/fCmplxCHOL.h
 --- liboctave/numeric/fCmplxCHOL.h  2015-10-08 18:00:51.000000000 -0500
 +++ liboctave/numeric/fCmplxCHOL.h 2015-10-09 12:37:21.000000000 -0500
 @@ -92,7 +92,7 @@
- 
+
    float xrcond;
- 
+
 -  octave_idx_type init (const FloatComplexMatrix& a, bool calc_cond);
 +  octave_idx_type init (const FloatComplexMatrix& a, bool calc_cond = false);
  };
- 
+
  FloatComplexMatrix OCTAVE_API chol2inv (const FloatComplexMatrix& r);
 diff -ru liboctave/numeric/fCmplxSCHUR.h liboctave/numeric/fCmplxSCHUR.h
 --- liboctave/numeric/fCmplxSCHUR.h 2015-10-08 18:00:51.000000000 -0500
 +++ liboctave/numeric/fCmplxSCHUR.h  2015-10-09 12:37:56.000000000 -0500
 @@ -88,7 +88,7 @@
    select_function selector;
- 
+
    octave_idx_type init (const FloatComplexMatrix& a, const std::string& ord,
 -                        bool calc_unitary);
 +                        bool calc_unitary = true);
  };
- 
+
  #endif
 diff -ru liboctave/numeric/floatCHOL.h liboctave/numeric/floatCHOL.h
 --- liboctave/numeric/floatCHOL.h 2015-10-08 18:00:51.000000000 -0500
 +++ liboctave/numeric/floatCHOL.h  2015-10-09 12:38:15.000000000 -0500
 @@ -92,7 +92,7 @@
- 
+
    bool is_upper;
- 
+
 -  octave_idx_type init (const FloatMatrix& a, bool upper, bool calc_cond);
 +  octave_idx_type init (const FloatMatrix& a, bool upper = true, bool calc_cond = false);
  };
- 
+
  FloatMatrix OCTAVE_API chol2inv (const FloatMatrix& r);
 diff -ru liboctave/numeric/floatSCHUR.h liboctave/numeric/floatSCHUR.h
 --- liboctave/numeric/floatSCHUR.h  2015-10-08 18:00:51.000000000 -0500
 +++ liboctave/numeric/floatSCHUR.h 2015-10-09 12:38:45.000000000 -0500
 @@ -84,7 +84,7 @@
    select_function selector;
- 
+
    octave_idx_type init (const FloatMatrix& a, const std::string& ord,
 -                        bool calc_unitary);
 +                        bool calc_unitary = true);
  };
- 
+
  #endif
 diff -ru libinterp/parse-tree/pt-id.h libinterp/parse-tree/pt-id.h
 --- libinterp/parse-tree/pt-id.h  2015-03-19 10:41:51.000000000 -0500
@@ -5141,11 +5899,11 @@ diff -ru libinterp/parse-tree/pt-id.h libinterp/parse-tree/pt-id.h
 @@ -122,7 +122,7 @@
               name ().c_str ());
    }
- 
+
 -  tree_identifier *dup (symbol_table::scope_id scope,
 +  virtual tree_identifier *dup (symbol_table::scope_id scope,
                          symbol_table::context_id context) const;
- 
+
    void accept (tree_walker& tw);
 diff -r 91a6f06c5052 -r 1433cd4f7b7b liboctave/operators/libcxx-fix.h
 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -5224,7 +5982,7 @@ diff -r 91a6f06c5052 -r 1433cd4f7b7b liboctave/operators/mx-inlines.cc
 --- liboctave/operators/mx-inlines.cc Thu Oct 09 20:38:04 2014 -0700
 +++ liboctave/operators/mx-inlines.cc Sun Oct 12 00:00:55 2014 +0800
 @@ -306,7 +306,13 @@
- 
+
  // Let the compiler decide which pow to use, whichever best matches the
  // arguments provided.
 +#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION >= 1101)
@@ -5235,7 +5993,7 @@ diff -r 91a6f06c5052 -r 1433cd4f7b7b liboctave/operators/mx-inlines.cc
  using std::pow;
 +#endif
  DEFMXMAPPER2X (mx_inline_pow, pow)
- 
+
  // Arbitrary function appliers. The function is a template parameter to enable
 SOSAYWEALL
 
@@ -5248,18 +6006,18 @@ SOSAYWEALL
     --with-curl-includedir=${CURL}/include --with-curl-libdir=${CURLLIBDIR} \
     --with-blas=${BLASLIBFILE} --with-lapack=${LAPACKLIBFILE} \
     --with-fftw3-includedir=${FFTW}/include --with-fftw3-libdir=${FFTWLIBDIR} \
-    --with-fftw3f-includedir=${FFTWF}/include --with-fftw3f-libdir=${FFTWFLIBDIR} 
-  
+    --with-fftw3f-includedir=${FFTWF}/include --with-fftw3f-libdir=${FFTWFLIBDIR}
+
   isLinux && ( cd lib && ln -s octave/*/*.so* . )
-  
+
   return 0
 }
 
 mk_wxwidgets() {
   resume_tracker && return 0
- 
+
   WXEXTRA=""
-  if isDarwin ; then 
+  if isDarwin ; then
     WXEXTRA="${WXEXTRA} --with-macosx-sdk=${SYSROOT} --with-macosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
     case ${MACOSX_DEPLOYMENT_TARGET} in
       10.9|10.10|10.11|10.12)
@@ -5314,7 +6072,7 @@ diff -u include/wx/wxcrtbase.h include/wx/wxcrtbase.h
  #define wxCRT_StrspnA    strspn
  #define wxCRT_StrstrA    strstr
 
-+#ifndef __cplusplus 
++#ifndef __cplusplus
  #define wxCRT_StrcatW    wcscat
  #define wxCRT_StrchrW    wcschr
  #define wxCRT_StrcmpW    wcscmp
@@ -5341,35 +6099,35 @@ diff -u include/wx/wxcrtbase.h include/wx/wxcrtbase.h
 +#define wxCRT_StrspnW    std::wcsspn
 +#define wxCRT_StrstrW    std::wcsstr
 +#endif
- 
+
  #define wxCRT_StrcollA   strcoll
  #define wxCRT_StrxfrmA   strxfrm
- 
-+#ifndef __cplusplus 
+
++#ifndef __cplusplus
  #define wxCRT_StrcollW   wcscoll
  #define wxCRT_StrxfrmW   wcsxfrm
 +#else
 +#define wxCRT_StrcollW   std::wcscoll
 +#define wxCRT_StrxfrmW   std::wcsxfrm
 +#endif
- 
+
 @@ -181,7 +181,11 @@
  #endif /* wxHAVE_TCHAR_SUPPORT */
- 
+
  #ifdef HAVE_WCSLEN
-+#ifndef __cplusplus 
++#ifndef __cplusplus
      #define wxCRT_StrlenW wcslen
 +#else
 +    #define wxCRT_StrlenW wcslen
 +#endif
  #endif
- 
+
  #define wxCRT_StrtodA    strtod
 @@ -191,8 +191,14 @@
  #define wxCRT_StrtolW    android_wcstol
  #define wxCRT_StrtoulW   android_wcstoul
  #else
-+#ifndef __cplusplus 
++#ifndef __cplusplus
  #define wxCRT_StrtodW    wcstod
  #define wxCRT_StrtolW    wcstol
  #define wxCRT_StrtoulW   wcstoul
@@ -5379,12 +6137,12 @@ diff -u include/wx/wxcrtbase.h include/wx/wxcrtbase.h
 +#define wxCRT_StrtoulW   std::wcstoul
 +#endif
  #endif
- 
+
 @@ -215,8 +215,13 @@
      #endif /* HAVE_STRTOULL */
      #ifdef HAVE_WCSTOULL
          /* assume that we have wcstoull(), which is also C99, too */
-+#ifndef __cplusplus 
++#ifndef __cplusplus
          #define wxCRT_StrtollW   wcstoll
          #define wxCRT_StrtoullW  wcstoull
 +#else
@@ -5393,7 +6151,7 @@ diff -u include/wx/wxcrtbase.h include/wx/wxcrtbase.h
 +#endif
      #endif /* HAVE_WCSTOULL */
  #endif
- 
+
 diff -ru src/osx/webview_webkit.mm src/osx/webview_webkit.mm
 --- src/osx/webview_webkit.mm  2014-10-06 16:33:44.000000000 -0500
 +++ src/osx/webview_webkit.mm 2015-03-20 09:15:42.000000000 -0500
@@ -5419,7 +6177,7 @@ diff -ru src/osx/carbon/utilscocoa.mm src/osx/carbon/utilscocoa.mm
 --- src/osx/carbon/utilscocoa.mm  2016-02-28 15:33:37.000000000 -0600
 +++ src/osx/carbon/utilscocoa.mm  2016-07-05 12:42:37.000000000 -0500
 @@ -476,7 +476,13 @@
- 
+
  double wxOSXGetMainScreenContentScaleFactor()
  {
 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
@@ -5430,7 +6188,7 @@ diff -ru src/osx/carbon/utilscocoa.mm src/osx/carbon/utilscocoa.mm
 +    return 1.0;
 +#endif
  }
- 
+
  CGImageRef wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scaleptr )
 diff -ru src/osx/cocoa/window.mm src/osx/cocoa/window.mm
 --- src/osx/cocoa/window.mm 2016-02-28 15:33:37.000000000 -0600
@@ -5447,13 +6205,13 @@ diff -ru src/osx/cocoa/window.mm src/osx/cocoa/window.mm
 +    return 1.0;
 +#endif
  }
- 
+
  // ----------------------------------------------------------------------------
 diff -ru src/osx/cocoa/nonownedwnd.mm src/osx/cocoa/nonownedwnd.mm
 --- src/osx/cocoa/nonownedwnd.mm  2016-02-28 15:33:37.000000000 -0600
 +++ src/osx/cocoa/nonownedwnd.mm  2016-07-05 13:06:02.000000000 -0500
 @@ -93,7 +93,11 @@
- 
+
  static bool IsUsingFullScreenApi(WXWindow macWindow)
  {
 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
@@ -5462,7 +6220,7 @@ diff -ru src/osx/cocoa/nonownedwnd.mm src/osx/cocoa/nonownedwnd.mm
 +    return false;
 +#endif
  }
- 
+
  //
 @@ -586,8 +590,12 @@
      NSView* view = [window contentView];
@@ -5474,7 +6232,7 @@ diff -ru src/osx/cocoa/nonownedwnd.mm src/osx/cocoa/nonownedwnd.mm
 +#else
 +    NSRect expectedframerect = viewframe;
 +#endif
-     
+
      if ( !NSEqualSizes(expectedframerect.size, viewframe.size) )
      {
 @@ -1006,7 +1014,11 @@
@@ -5487,7 +6245,7 @@ diff -ru src/osx/cocoa/nonownedwnd.mm src/osx/cocoa/nonownedwnd.mm
 +        return false;
 +#endif
      }
- 
+
      return m_macFullScreenData != NULL ;
 @@ -1015,6 +1027,7 @@
  bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable)
@@ -5505,7 +6263,7 @@ diff -ru src/osx/cocoa/nonownedwnd.mm src/osx/cocoa/nonownedwnd.mm
 +    return false;
 +#endif
      [m_macWindow setCollectionBehavior: collectionBehavior];
- 
+
      return true;
 SOSAYWEALL
 
@@ -5541,17 +6299,17 @@ diff -ru cmake/modules/TestFortranIsnan.f cmake/modules/TestFortranIsnan.f
 +++ cmake/modules/TestFortranIsnan.f  2015-03-18 22:32:55.000000000 -0500
 @@ -1,8 +1,11 @@
        program testisnan
- 
+
  c      external isnan
 +      real n
 +      n = 500.0
 +      n = n - n
- 
+
 -      if (isnan(0.0/0.0)) then
 +      if (isnan(n/n)) then
          print *,"NaN"
        endif
- 
+
 diff -ru cmake/modules/pkg-config.cmake cmake/modules/pkg-config.cmake
 --- cmake/modules/pkg-config.cmake  2015-03-18 16:49:37.000000000 -0500
 +++ cmake/modules/pkg-config.cmake 2015-03-18 23:34:24.000000000 -0500
@@ -5564,12 +6322,12 @@ diff -ru cmake/modules/pkg-config.cmake cmake/modules/pkg-config.cmake
      )
      #message("(frameworks) link_flags = \${link_flags}")
    endif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
- 
+
 -  set(\${link_flags_out} \${link_flags} PARENT_SCOPE)
 +  set("\${link_flags_out}" "\${link_flags}" PARENT_SCOPE)
- 
+
  endfunction(pkg_config_link_flags)
- 
+
 SOSAYWEALL
 
   CFLAGS="-I${BASE}/include $CFLAGS" CXXFLAGS="-I${BASE}/include $CXXFLAGS" CPPFLAGS="-I${BASE}/include $CPPFLAGS" \
@@ -5635,13 +6393,13 @@ mk_gdl() {
   _find_cots FULLPY bin/python${PYFSVER} ${BASE}/Library/Frameworks/Python.framework/Versions/${PYFSVER} $BASE || oops "gdl Can't find python!"
   _find_cots_lib FULLPY libpython${PYFSVER} ${FULLPY} || oops "gdl Can't find libpython!"
 
-  if [ ${PYFSVERMAJOR} -gt 2 ] ; then
+  if isPython3 ; then
     echo "GDL not supported on Python 3"
     return 0
   fi
 
   GDLEXTRA=""
-  isDarwin && GDLEXTRA="${GDLEXTRA} -DX11=OFF "
+  isTrue WITHOUT_X11 && GDLEXTRA="${GDLEXTRA} -DX11=OFF "
 
   make_patch gdl <<SOSAYWEALL
 diff -ru src/gdlwidget.hpp src/gdlwidget.hpp
@@ -5650,7 +6408,7 @@ diff -ru src/gdlwidget.hpp src/gdlwidget.hpp
 @@ -1301,6 +1301,8 @@
     return rows;
    }
- 
+
 +  int GetColumnWidth(int col)const{return GetColWidth(col);};
 +
  private:
@@ -5671,36 +6429,36 @@ diff -ru src/basic_fun.cpp src/basic_fun.cpp
 @@ -85,7 +85,7 @@
        s2++;
      }
- 
+
 -  return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
 +  return std::tolower(*(unsigned char *) s1) - std::tolower(*(unsigned char *) s2);
  }
  #endif
- 
+
 diff -ru src/gshhs.cpp src/gshhs.cpp
 --- src/gshhs.cpp  2015-03-16 12:08:07.000000000 -0500
 +++ src/gshhs.cpp 2015-03-19 20:42:46.000000000 -0500
 @@ -175,7 +175,7 @@
          double ss = h.south * GSHHS_SCL;
          double nn = h.north * GSHHS_SCL;
-         char source = (src == 1) ? 'W' : 'C'; // Either WVS or CIA (WDBII) pedigree 
--        if ( river ) source = tolower( (int) source ); // Lower case c means river-lake 
-+        if ( river ) source = std::tolower( (int) source ); // Lower case c means river-lake 
-         int line = (h.area) ? 0 : 1; // Either Polygon (0) or Line (1) (if no area) 
- 
- 
+         char source = (src == 1) ? 'W' : 'C'; // Either WVS or CIA (WDBII) pedigree
+-        if ( river ) source = tolower( (int) source ); // Lower case c means river-lake
++        if ( river ) source = std::tolower( (int) source ); // Lower case c means river-lake
+         int line = (h.area) ? 0 : 1; // Either Polygon (0) or Line (1) (if no area)
+
+
 SOSAYWEALL
 
   if [ -n "${LIBMAGICK}" ] ; then
     GDLEXTRA="${GDLEXTRA} -DMAGICK=ON -DMAGICKDIR=${LIBMAGICK}"
   else
     GDLEXTRA="${GDLEXTRA} -DMAGICK=OFF"
-  fi 
+  fi
   if [ -n "${OPENMP}" ] ; then
     GDLEXTRA="${GDLEXTRA} -DOPENMP=ON -DOPENMPDIR=${OPENMP}"
   else
     GDLEXTRA="${GDLEXTRA} -DOPENMP=OFF"
-  fi 
+  fi
 
   CFLAGS="-I${BASE}/include $CFLAGS" CXXFLAGS="-I${BASE}/include $CXXFLAGS" CPPFLAGS="-I${BASE}/include $CPPFLAGS" LDFLAGS="-L${BASE}/lib -L${BASE}/lib64 $LDFLAGS" \
     _cmake_make_install gdl src/optional/IDL/gdl-${GDLVER}.tgz gdl-$(echo ${GDLVER} | sed s,v2,,g) ${GDLEXTRA} -DPYTHONVERSION=${PYFSVER} \
@@ -5752,9 +6510,9 @@ SCR
 mk_cmake(){
   resume_tracker && return 0
 
-  useSysCheck USE_SYS_CMAKE && return 0 
+  useSysCheck USE_SYS_CMAKE && return 0
 
-  [ -e bin/cmake ] && return 0
+  [ -e ${BASE}/bin/cmake ] && [ "`${BASE}/bin/cmake --version | awk '/version/ {print $3}'`" == "$CMAKEVER" ] && return 0
 
   CMAKEEXTRA=""
   # -o "$( useSysCheck USE_SYS_LZMA && echo YES )"=="YES" 
@@ -5762,7 +6520,7 @@ mk_cmake(){
   _cmake_buildcheck ZLIB include/zlib.h libz USE_SYS_ZLIB zlib
   _cmake_buildcheck BZIP2D include/bzlib.h libbz2 NO bzip2
   _cmake_buildcheck CURL include/curl/curl.h libcurl USE_SYS_CURL curl
-  _cmake_buildcheck EXPAT include/expat.h libexpat YES expat
+  _cmake_buildcheck EXPAT include/expat.h libexpat USE_SYS_EXPAT expat
   _cmake_buildcheck JSONCPP include/jsoncpp.hh libjsoncpp NO jsoncpp
   _cmake_buildcheck LIBARCHIVE include/archive.h libarchive NO libarchive
   _cmake_buildcheck LIBLZMA include/lzma.h liblzma USE_SYS_LZMA liblzma
@@ -5797,7 +6555,6 @@ mk_idl() {
   cleanup
   mk_libreadline \
   && mk_gsl \
-  && mk_libproj4 \
   && mk_wxwidgets \
   && mk_udunits \
   && mk_cmake \
@@ -5867,20 +6624,23 @@ mk_graphics() {
   && mk_pixman \
   && mk_geos \
   && mk_cairo \
-  && mk_harfbuzz \
+  && _mk_harfbuzz \
   && mk_pycairo \
   && mk_nose \
   && mk_dateutil \
   && mk_backports \
   && mk_certifi \
   && mk_tornado \
-  && mk_mock \
+  && _mk_mock \
   && mk_pytz \
   && mk_pip \
   && mk_cycler \
   && mk_process32 \
   && mk_matplotlib_batch \
   && mk_basemap \
+  && mk_pyshp \
+  && mk_shapely \
+  && mk_cartopy \
   && mk_olefile \
   && mk_pillow \
   && mk_mpld3 \
@@ -5889,7 +6649,7 @@ mk_graphics() {
 
 #  && mk_pyresample \
 
-# OR 
+# OR
 
 mk_gui() {
   # build Python On- and Off-Screen Graphics support
@@ -5902,7 +6662,7 @@ mk_gui() {
   && mk_geos \
   && mk_sip \
   && mk_cairo \
-  && mk_harfbuzz \
+  && _mk_harfbuzz \
   && mk_pycairo \
   && mk_cmake \
   && mk_pyside \
@@ -5912,13 +6672,16 @@ mk_gui() {
   && mk_backports \
   && mk_certifi \
   && mk_tornado \
-  && mk_mock \
+  && _mk_mock \
   && mk_pytz \
   && mk_pip \
   && mk_cycler \
   && mk_process32 \
   && mk_matplotlib \
   && mk_basemap \
+  && mk_pyshp \
+  && mk_shapely \
+  && mk_cartopy \
   && mk_olefile \
   && mk_pillow \
   && mk_pyopengl \
@@ -6002,7 +6765,7 @@ import sys,os
 
 def isVersioned(shortfile,pyfsver,shortver):
   return shortfile.endswith(pyfsver) or \
-    (shortfile.endswith(shortver) and not shortfile.endswith('.'+shortver) 
+    (shortfile.endswith(shortver) and not shortfile.endswith('.'+shortver)
                                   and not shortfile.endswith('to'+shortver)) or \
     shortfile.startswith('python'+shortver)
 
@@ -6083,19 +6846,19 @@ EOF
 bundle_machos() {
     _check_build_env
     # fix RPATHs on Mach-O binaries, excluding system libraries and non-SB3 installed (Fink or MacPorts)
-    find lib Library Applications -type f -print0 | xargs -0 chmod +rw 
+    find lib Library Applications -type f -print0 | xargs -0 chmod +rw
     for f in bin/* ; do
       if [ -L "$f" -a -n "$(readlink "$f" | grep ${BASE})" ] ; then
         echo Repairing link $f from $(readlink $f) to .."$( readlink $f | sed "s,${BASE},,g" )"
         ln -sf .."$( readlink $f | sed "s,${BASE},,g" )" $f
       fi
-    done 
+    done
     for f in Library/Frameworks/Python.framework/Versions/*/bin/* ; do
       if [ -L "$f" -a -n "$(readlink "$f" | grep ${BASE}/Library/Frameworks/Python.framework)" ] ; then
         echo Repairing link $f from $(readlink $f) to .."$( readlink $f | sed "s,${BASE}/Library/Frameworks/Python.framework/Versions/...,,g" )"
         ln -sf .."$( readlink $f | sed "s,${BASE}/Library/Frameworks/Python.framework/Versions/...,,g" )" $f
       fi
-    done 
+    done
     ${PYTHON} sbin/thosewhohuntelfs.py . lib Library Applications "$@" \
       --migrate=\@executable_path/..,/sw/lib/fontconfig2,/sw/lib/freetype219,/sw/lib/gcc4.6,/sw/lib/gcc4.7,/sw/lib/gcc4.8,/sw,/opt/local/libexec/qt4,/opt/local,/usr/local \
       --migrateto=@rpath,/usr,/System --exclude='(?:.*?(build|sysbin|libexec|libsys)/.*)' || oops "could not make binary bundle relocatable"
@@ -6133,7 +6896,7 @@ migrate_required_elfs() { #this takes the system libraries and imports them into
       else
         echo "Not able to figure $f as a file or a link... copying"
         cp --archive --remove-destination $f  $( dirname $f | xargs basename )/$( basename $f )
-      fi        
+      fi
     done
 }
 
@@ -6174,7 +6937,7 @@ expand_python_binary_eggs() {
   _check_build_env
   for f in $( find *ib* -name "*.egg" -type f | grep ${CPUTYPE} | grep "py${PYFSVER}" ) ; do #unzip any binary installed egg so we can repath
     mv "$f" "$(basename "$f")" && ( install_flat "$(basename "$f")" && rm -f "$(basename "$f")" ) || mv "$(basename "$f")" "$f"
-  done  
+  done
 }
 
 bundle_bins() {
@@ -6184,7 +6947,7 @@ bundle_bins() {
   elif isLinux ; then
       bundle_elfs || oops "Bundle failed"
   else
-      oops "Unknown binary system for " ${SYSNAME}     
+      oops "Unknown binary system for " ${SYSNAME}
   fi
 }
 
@@ -6226,7 +6989,7 @@ scan_bins() {
   elif isLinux ; then
       scan_elfs || oops "Scan failed"
   else
-      oops "Unknown binary system for " ${SYSNAME}     
+      oops "Unknown binary system for " ${SYSNAME}
   fi
   test $egg_check -eq 0 || scan_eggs || oops "Must decompress binary eggs for binary path safety!  run either bundle_bins or expand_python_binary_eggs to just expand the eggs"
   test $script_check -eq 0 || scan_scripts || oops "Non-relocated python scripts exist"
@@ -6234,14 +6997,14 @@ scan_bins() {
 
 # relocate entry scripts to use /usr/bin/env python${PYFSVER}
 # this is at least slightly more correct than the usual as-shipped form,
-# but assumes that SB3 will be prepended onto the 
+# but assumes that SB3 will be prepended onto the
 bundle_python_scripts() {
   # make scripts in bin relocatable
   _check_build_env
   if [ -d Library ] ; then
     make_frameworklinks
   fi
-  cp -f sbin/rel bin/  
+  cp -f sbin/re-l bin/  
   ${PYTHON} sbin/thosewhohuntpythons.py ${BASE} bin/* || oops "Python relocation failed"
 }
 
@@ -6276,16 +7039,32 @@ SOSAYWEALL
       export SYSLIB=unknown
     fi
     export TRIM=$(echo $(cat trim) |sed 's/ /-/g')
-    if hasRel ; then
-      export TRIM="${TRIM}-rel"
-    fi
 }
 
-_make_archive() {
+_make_compiler_archive() {
     COMPREXT=$1
     shift
     COMPR="$@"
     load_archive_tags  
+    COMPRNAME="ShellB2Compilers-${TRIM}-${PLAT}-${SYSLIB}-${REVDATE}-r${REVNUM}.tar"${COMPREXT}
+    echo "Creating Distribution File ${COMPRNAME}"
+    pushd ..
+    set -x
+    tar cf - --exclude='ShellB3/build*' \
+        --exclude='*.svn*' --exclude='ShellB3/src*' --exclude='ShellB3/sbin*' \
+        --exclude='ShellB3/shallbethree.sh' \
+        --exclude=".DS_Store" ShellB3 | ${COMPR} > "${COMPRNAME}" 
+    RESUL=$?
+    set +x
+    popd
+    return $RESUL  
+}
+
+_make_archive() {
+    COMPREXT=$1
+    shift
+    COMPR="$@"
+    load_archive_tags
     COMPRNAME="ShellB3-${PLAT}-${SYSLIB}-${REVDATE}-r${REVNUM}-${TRIM}.tar"${COMPREXT}
     echo "Creating Distribution File ${COMPRNAME}"
     pushd ..
@@ -6293,11 +7072,11 @@ _make_archive() {
     tar cf - --exclude='ShellB3/build*' \
         --exclude='*.svn*' --exclude='ShellB3/src*' --exclude='ShellB3/sbin*' --exclude='ShellB3/sys*' \
          --exclude='ShellB3/libexec*' --exclude='ShellB3/libsys*' --exclude='ShellB3/shallbethree.sh' \
-        --exclude='*.a' --exclude='*.la' ShellB3 | ${COMPR} > "${COMPRNAME}" 
+        --exclude='*.a' --exclude='*.la' --exclude=".DS_Store" ShellB3 | ${COMPR} > "${COMPRNAME}" 
     RESUL=$?
     set +x
     popd
-    return $RESUL  
+    return $RESUL
 }
 
 make_relocatable() {
@@ -6312,7 +7091,7 @@ make_relocatable() {
 
 preferred_threadcount() {
   if isDarwin ; then
-    sysctl -a | grep cpu.thread | awk '{print $2}'
+    sysctl -a | awk '/cpu.thread/ {print $2}'
   elif isLinux ; then
     cat /proc/cpuinfo | grep -c processor
   else
@@ -6320,6 +7099,17 @@ preferred_threadcount() {
   fi
 }
 
+compiler_dist() {
+  #compress ShellB3-COMPILER into tagged tarball with XZ compression
+  resume_tracker && return 0
+  make_relocatable || oops "relocate failed"
+  cleanup
+  _make_compiler_archive .xz xz -9 --threads=$( preferred_threadcount ) - \
+    || _make_archive .xz xz -9 --threads=$(( $( preferred_threadcount ) / 2 )) - \
+    || _make_archive .xz xz -9 - 
+  return $?
+}
+
 bin_dist_xz() {
   #compress ShellB3 into tagged tarball with XZ compression
   resume_tracker && return 0
@@ -6327,7 +7117,7 @@ bin_dist_xz() {
   cleanup
   _make_archive .xz xz -9 --threads=$( preferred_threadcount ) - \
     || _make_archive .xz xz -9 --threads=$(( $( preferred_threadcount ) / 2 )) - \
-    || _make_archive .xz xz -9 - 
+    || _make_archive .xz xz -9 -
   return $?
 }
 
@@ -6372,17 +7162,30 @@ clean() {
 }
 
 mk_glib(){
+  #Open Source GLIB
   resume_tracker && return 0
   mk_pcre && mk_icu && mk_libffi && mk_gettext && mk__glib
 }
 
+mk_pkgconfig(){
+  resume_tracker && return 0
+  if [ -z "$FC" ] ; then
+    TESTFC=gfortran
+  else
+    TESTFC=$(echo $FC | awk '{print $1}')
+  fi
+  [ -z "$( which $TESTFC | grep ${BASE} )" ] && return 0 #if fortran compiler is not part of shellb3, skip pkgconfig
+  mk_glib && mk__pkgconfig
+}
+
 #
 # standard trim lines
 #
 
 mk_core() {
+  #build basic core functionality, including python all the way up to scipy
     resume_tracker && return 0
-    
+
     MAKE_PYVER="$1"
     if [ -z "${MAKE_PYVER}" ] ; then
       MAKE_PYVER="py"
@@ -6395,7 +7198,7 @@ mk_core() {
     && mk_libxml \
     && mk_sqlite \
     && mk_db48 \
-    && mk_"${MAKE_PYVER}" \
+    && mk_"${MAKE_PYVER}" && mk_pkgconfig \
     && mk_six \
     && mk_appdirs \
     && mk_pyparsing \
@@ -6408,6 +7211,7 @@ mk_core() {
     && mk_jpeg \
     && mk_jasper \
     && mk_png \
+    && mk_libproj4 \
     && mk_pyproj \
     && mk_gribapi \
     && mk_szip \
@@ -6416,10 +7220,13 @@ mk_core() {
     && mk_pygrib \
     && mk_h5py \
     && mk_numexpr \
-    && mk_blosc \
+    && mk_cmake \
+    && mk_cblosc \
+    && mk_pyblosc \
     && mk_lzo \
     && mk_pytables \
     && mk_swig \
+    && mk_metis \
     && mk_suitesparse \
     && mk_scipy \
     && cleanup \
@@ -6460,6 +7267,7 @@ mk_cspp() {
     && mk_shapely \
     && mk_inotify \
     && mk_configobj \
+    && mk_pyyaml \
     && mk_pykdtree \
     && mk_pyresample \
     && mk_bottleneck \
@@ -6478,6 +7286,7 @@ mk_scmi() {
     && mk_pycparser \
     && mk_cffi \
     && mk_configobj \
+    && mk_pyyaml \
     && mk_pykdtree \
     && mk_pyresample \
     && mk_shapely \
@@ -6487,7 +7296,55 @@ mk_scmi() {
     echo scmi >>trim
 }
 
-    
+
+mk_polar2grid() {
+  # used by Polar2Grid  
+
+  # && mk_libffi \
+  # && mk_cffi \
+  # && mk_inotify \
+  # From mk_graphics:
+  # && mk_tornado \
+  # && mk_cycler \
+  # && mk_matplotlib_batch \
+  # && mk_basemap \
+  # && mk_mpld3 \
+
+  resume_tracker && return 0
+    mk_core py3 \
+    && mk_jpeg \
+    && mk_png \
+    && mk_tiff \
+    && mk_freetype \
+    && mk_pixman \
+    && mk_geos \
+    && mk_cairo \
+    && mk_harfbuzz \
+    && mk_pycairo \
+    && mk_nose \
+    && mk_pyparsing \
+    && mk_six \
+    && mk_dateutil \
+    && mk_backports \
+    && mk_certifi \
+    && mk_mock \
+    && mk_pytz \
+    && mk_pip \
+    && mk_process32 \
+    && mk_pillow \
+    && mk_hdf4 && mk_pyhdf \
+    && mk_netcdf4 && mk_netcdf4py \
+    && mk_pycparser \
+    && mk_shapely \
+    && mk_configobj \
+    && mk_pyyaml \
+    && mk_pykdtree \
+    && mk_pyresample \
+    && mk_bottleneck \
+    && mk_gdal
+    echo polar2grid >>trim
+}
+
 mk_eumetsat() {
   # eumetsat support, similar to CSPP but adds NAT format 
   resume_tracker && return 0
@@ -6503,6 +7360,7 @@ mk_eumetsat() {
     && mk_shapely \
     && mk_inotify \
     && mk_configobj \
+    && mk_pyyaml \
     && mk_pykdtree \
     && mk_pyresample \
     && mk_bottleneck \
@@ -6527,26 +7385,30 @@ mk_iasi2fbf() {
     && mk_setuptools \
     && mk_libffi \
     && mk_pycparser \
-    && mk_cffi 
+    && mk_cffi
     echo iasi2fbf >>trim
 }
 
-mk_lidar() {
-  # lidar operational processing with gui
+_mk_lidar() {
+  # lidar operational processing
+  GUI_MODE=$1
   resume_tracker && return 0
     mk_core \
-    && mk_gui  \
+    && mk_${GUI_MODE}  \
     && mk_hdf4 && mk_pyhdf \
     && mk_netcdf4 && mk_pycdf && mk_netcdf4py \
-    && mk_eugene \
     && mk_libffi \
     && mk_pycparser \
     && mk_cffi \
+    && mk_pint \
+    && mk_enum \
+    && mk_metpy \
     && mk_minipg \
     && mk_pylibtiff \
     && mk_shapely \
     && mk_inotify \
     && mk_configobj \
+    && mk_pyyaml \
     && mk_pykdtree \
     && mk_pyresample \
     && mk_bottleneck \
@@ -6570,49 +7432,18 @@ mk_lidar() {
     && mk_pycrypto \
     && mk_ssec_all \
     && mk_pyramid
-    echo lidar >>trim
+}
+
+mk_lidar() {
+  # lidar operational processing with offscreen and onscreen graphics
+  resume_tracker && return 0
+  _mk_lidar gui && echo lidar >>trim
 }
 
 mk_lidar_batch() {
-  # lidar operational processing and offscreen graphics
+  # lidar operational processing with offscreen graphics only
   resume_tracker && return 0
-    mk_core \
-    && mk_graphics  \
-    && mk_hdf4 && mk_pyhdf \
-    && mk_netcdf4 && mk_pycdf && mk_netcdf4py \
-    && mk_eugene \
-    && mk_libffi \
-    && mk_pycparser \
-    && mk_cffi \
-    && mk_minipg \
-    && mk_pylibtiff \
-    && mk_shapely \
-    && mk_inotify \
-    && mk_configobj \
-    && mk_pykdtree \
-    && mk_pyresample \
-    && mk_bottleneck \
-    && mk_gdal \
-    && mk_sodium \
-    && mk_zeromq \
-    && mk_pyzmq \
-    && mk_requests \
-    && mk_ply \
-    && mk_gitpy \
-    && mk_virtualenv \
-    && mk_graphviz \
-    && mk_astral \
-    && mk_sqlalchemy \
-    && mk_ipython \
-    && mk_tenti \
-    && mk_dplkit \
-    && mk_pexif \
-    && mk_pylint \
-    && mk_vispy \
-    && mk_pycrypto \
-    && mk_ssec_all \
-    && mk_pyramid
-    echo lidar_batch >>trim
+  _mk_lidar graphics && echo lidar_batch >>trim
 }
 
 mk_hhg() {
@@ -6629,6 +7460,7 @@ mk_hhg() {
     && mk_shapely \
     && mk_inotify \
     && mk_configobj \
+    && mk_pyyaml \
     && mk_pykdtree \
     && mk_pyresample \
     && mk_bottleneck \
@@ -6662,6 +7494,7 @@ mk_circus() {
     && mk_shapely \
     && mk_inotify \
     && mk_configobj \
+    && mk_pyyaml \
     && mk_pykdtree \
     && mk_pyresample \
     && mk_bottleneck \
@@ -6681,11 +7514,53 @@ fetch_pip_latest(){
     | xargs bin/pip${PYFSVER} install --no-binary :all: --download ${BASE}/src/fetched )
 }
 
+_list_addons(){
+  # list addons in src/addons queued to be loaded by load_addons 
+  if [ -e src/addons/addons.txt ] ; then
+    for f in $( cat src/addons/addons.txt ) ; do
+      echo "src/addons/$f"
+    done
+  elif [ $( find src/addons/* | grep . -c ) -gt 1 ] ; then
+    for f in src/addons/* ; do
+      if [ "$f" != "src/addons/README.txt" ] ; then
+        echo "$f"
+      fi
+    done
+  else
+    echo -n
+  fi
+}
+
+list_addons(){
+  # list addons in src/addons queued to be loaded by load_addons 
+  for addon_path in $( _list_addons ) ; do
+    ${PYTHON} -c "import re,sys,os; print(re.split('|'.join(sys.argv[2:]),os.path.basename(sys.argv[1]))[0])" "$addon_path" .tar .sh
+    #awk -F . '{print $1}'
+  done
+}
+
+load_addons(){
+  # load addons in src/addons listed by list_addons
+  resume_tracker && return 0
+  for addon_path in $( _list_addons ) ; do
+      addon_name="$( ${PYTHON} -c "import re,sys,os; print(re.split('|'.join(sys.argv[2:]),os.path.basename(sys.argv[1]))[0])" "$addon_path" .tar .sh )"
+      if [ -n "$( cat trim | grep "${addon_name}" )" ] ; then
+        echo "Skipping addon ${addon_name}. Already installed"
+      elif [ "${addon_name}.sh" == "$( basename "${addon_path}" )" ] ; then
+        ( set -x ; . "${addon_path}" && echo "Ran addon ${addon_name}" ) || oops "Failed to run addon ${addon_name}"
+        echo ${addon_name} >> trim
+      else
+        ( ${BASE}/bin/easy_install-${PYFSVER} "${addon_path}" && echo "Installed addon ${addon_name}" ) || oops "Failed to install addon ${addon_name}"
+        echo ${addon_name} >> trim
+      fi
+  done
+}
+
 alleggs(){
   if true ; then
     find *ib* -name "*.egg"
     find *ib* -name "*.egg-info"
-  fi 
+  fi
 }
 
 allpkgs(){
@@ -6716,6 +7591,9 @@ pypi_listall(){
 # e.g.
 # ./shallbethree.sh mk_szip mk_hdf5
 go() {
+    if [ "$1" == "noop" ] ; then
+      return 0
+    fi
     ret=0
     oldresume=""
     if [ -f ${RESUMERECEIPT} ] ; then
@@ -6723,7 +7601,7 @@ go() {
     fi
     tag_src
     ALLPARAMS="$*"
-    for stage in $@; do 
+    for stage in $@; do
         eval "$stage"
         ret=$?
         didsomething=1
@@ -6731,7 +7609,7 @@ go() {
           break
         fi
     done
-    if [ -z "$didsomething" ]; then 
+    if [ -z "$didsomething" ]; then
         mk_core && echo "Complete."
         ret=$?
     fi
@@ -6769,7 +7647,7 @@ list_commands(){
     echo "$(echo $f | awk '{printf("    %-20s",$1)}')" $( ${ANYPYTHON} sbin/shellscrape $0 --documentation $f )
   done
   echo "INSTALL PREBUILT:"
-  for f in $(${ANYPYTHON} sbin/shellscrape $0 | egrep -v "^(mk_|_)" | egrep -v "(resume_tr|install_flat)" |  egrep "install_") ; do
+  for f in $(${ANYPYTHON} sbin/shellscrape $0 | egrep -v "^(mk_|_)" | egrep -v "(resume_tr|install_flat)" |  egrep "(install_|addon)") ; do
     echo "$(echo $f | awk '{printf("    %-20s",$1)}')" $( ${ANYPYTHON} sbin/shellscrape $0 --documentation $f )
   done
   echo "TESTING & PACKAGING:"
@@ -6805,7 +7683,7 @@ help(){
 }
 
 # if UNITTEST variable is set then act as a sourceable library and present a unit test environment
-# e.g. 
+# e.g.
 # export UNITTEST=1
 # source shallbethree.sh
 # mk_szip
diff --git a/ShellB3/src/SSEC/dplkit-0.3.4.tar.gz b/ShellB3/src/SSEC/dplkit-0.3.4.tar.gz
deleted file mode 100644
index 9dbc845ed8bfc5e647b0f86dfe0ebb1c77f3b4e5..0000000000000000000000000000000000000000
Binary files a/ShellB3/src/SSEC/dplkit-0.3.4.tar.gz and /dev/null differ
diff --git a/ShellB3/src/SSEC/dplkit-0.3.7.tar.gz b/ShellB3/src/SSEC/dplkit-0.3.7.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..33ad45daf881f71205fb01a74a2414f4e55927cd
--- /dev/null
+++ b/ShellB3/src/SSEC/dplkit-0.3.7.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:da942245f5b6efb397bfd9dec410b52fa80ab3efbd2c8879e5fd8452b9d6f1b3
+size 40667
diff --git a/ShellB3/src/addons/.gitignore b/ShellB3/src/addons/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..72e8ffc0db8aad71a934dd11e5968bd5109e54b4
--- /dev/null
+++ b/ShellB3/src/addons/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/ShellB3/src/addons/README.txt b/ShellB3/src/addons/README.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9a91bc892450350cb3a353f6f4fa7a24cc8d62b7
--- /dev/null
+++ b/ShellB3/src/addons/README.txt
@@ -0,0 +1,14 @@
+This folder is for Python packages and shell scripts to be included by the 'custom_addons' command.
+These are non-standard packages that aren't part of ShellB3, aren't normally available,
+and/or proprietary. Each bundle must be a Python package that is setup compatible, or 
+a shell script, with the suffix ".sh". Each will be added to the trim file describing the bundle.
+
+If addons need to be installed in a specific order, list them in a file 'addons.txt'
+
+NOTHING IN THIS FOLDER SHOULD BE COMMITTED TO GIT. THESE ARE CUSTOM DEVELOPER ADDONS
+
+Typical use cases:
+- Quick-and-Dirty addons for testing
+- Top-level deliverable that ShellB3 is being built as a runtime to
+- Create additional non-Python files within ShellB3 to be bundled.
+
diff --git a/ShellB3/src/experimental/cfe-4.0.0.src.tar.xz b/ShellB3/src/experimental/cfe-4.0.0.src.tar.xz
deleted file mode 100644
index 0a1ad7ed1337cc1f38483b60dab347fb00866e25..0000000000000000000000000000000000000000
--- a/ShellB3/src/experimental/cfe-4.0.0.src.tar.xz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:cea5f88ebddb30e296ca89130c83b9d46c2d833685e2912303c828054c4dc98a
-size 10900916
diff --git a/ShellB3/src/experimental/dragonegg-3.6.2.src.tar.xz b/ShellB3/src/experimental/dragonegg-3.6.2.src.tar.xz
new file mode 100644
index 0000000000000000000000000000000000000000..a3d44efed9cb0e5ec025d17df067912e6bb6f60a
--- /dev/null
+++ b/ShellB3/src/experimental/dragonegg-3.6.2.src.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d59c6e0d04a7a9a155cf1aa37bf371cce9b2f52dbb570f14d23c03f92b3e6a54
+size 374856
diff --git a/ShellB3/src/experimental/pocl-0.13-838-g82d7cc9e.tar.bz2 b/ShellB3/src/experimental/pocl-0.13-838-g82d7cc9e.tar.bz2
deleted file mode 100644
index df22551013df1a1ed387a0bc902759b8c53041a3..0000000000000000000000000000000000000000
--- a/ShellB3/src/experimental/pocl-0.13-838-g82d7cc9e.tar.bz2
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:63ccd5d030fa0cd2f815f514b8cdf488dfe0aa5da10ebce58869d37885bd3cbe
-size 887353
diff --git a/ShellB3/src/experimental/pocl-0.13-863-g2b5cc9a7.tar.bz2 b/ShellB3/src/experimental/pocl-0.13-863-g2b5cc9a7.tar.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..d40d64be54d9ef682bbe17403709d4170c65561d
--- /dev/null
+++ b/ShellB3/src/experimental/pocl-0.13-863-g2b5cc9a7.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f0fd19c21154bb3dccd2885828be6304eeffd42c4bfe7be54229cd8127ec11b9
+size 881119
diff --git a/ShellB3/src/hdf5-1.8.18.tar.bz2 b/ShellB3/src/hdf5-1.8.18.tar.bz2
deleted file mode 100644
index 0a0fae999305498bb8ba4a5a595303cd39412793..0000000000000000000000000000000000000000
--- a/ShellB3/src/hdf5-1.8.18.tar.bz2
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:01c6deadf4211f86922400da82c7a8b5b50dc8fc1ce0b5912de3066af316a48c
-size 10081294
diff --git a/ShellB3/src/hdf5-1.8.19.tar.bz2 b/ShellB3/src/hdf5-1.8.19.tar.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..e3ecee6bf99180e87fd820d22ab84cef2bda1c7a
--- /dev/null
+++ b/ShellB3/src/hdf5-1.8.19.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:59c03816105d57990329537ad1049ba22c2b8afe1890085f0c022b75f1727238
+size 10121044
diff --git a/ShellB3/src/macos/altgraph-0.13.tar.gz b/ShellB3/src/macos/altgraph-0.13.tar.gz
deleted file mode 100644
index 67e54354c5ae766c852404c4e9b9ed0e22f1362c..0000000000000000000000000000000000000000
--- a/ShellB3/src/macos/altgraph-0.13.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8510e9d85598d718d1f94afa7a64696565d6c3cb139d72603d6f64339377be68
-size 47164
diff --git a/ShellB3/src/macos/altgraph-0.14.tar.gz b/ShellB3/src/macos/altgraph-0.14.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..bc6ddbae67c4d6dba25fc4f61f0f02ad33a4957d
--- /dev/null
+++ b/ShellB3/src/macos/altgraph-0.14.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:481bac8feb1716bb8e485e652ed94002cc11304abccb2911f8f4574fc9dc207b
+size 588506
diff --git a/ShellB3/src/macos/modulegraph-0.14.tar.gz b/ShellB3/src/macos/modulegraph-0.14.tar.gz
deleted file mode 100644
index fa8d8bea5cbc1b009a57d9499127595f12026fb4..0000000000000000000000000000000000000000
--- a/ShellB3/src/macos/modulegraph-0.14.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:84998c1b6d1f0ebd2908dbfe5d2d76066b1e67480e98d925710b213fb002aea3
-size 679742
diff --git a/ShellB3/src/macos/modulegraph-0.15.tar.gz b/ShellB3/src/macos/modulegraph-0.15.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..7a33f1b56fcce0325ea7cd76b06526206acf472a
--- /dev/null
+++ b/ShellB3/src/macos/modulegraph-0.15.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:732be924d772eed19073b8eeebd9c4cdc2f66ce711e39dd0ea486058fd2655a7
+size 681930
diff --git a/ShellB3/src/metis-5.1.0.tar.gz b/ShellB3/src/metis-5.1.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..ff0aadd92a9258a54cf8e15fbbc2177b88c85e36
--- /dev/null
+++ b/ShellB3/src/metis-5.1.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:76faebe03f6c963127dbb73c13eab58c9a3faeae48779f049066a21c087c5db2
+size 4984968
diff --git a/ShellB3/src/numpy-1.12.1.zip b/ShellB3/src/numpy-1.12.1.zip
deleted file mode 100644
index 98fff998039782061bc7f154adf24a2b86da30d0..0000000000000000000000000000000000000000
--- a/ShellB3/src/numpy-1.12.1.zip
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a65266a4ad6ec8936a1bc85ce51f8600634a31a258b722c9274a80ff189d9542
-size 4824784
diff --git a/ShellB3/src/numpy-1.13.1.zip b/ShellB3/src/numpy-1.13.1.zip
new file mode 100644
index 0000000000000000000000000000000000000000..65e1372c7e59b86bc1c2f8dcc1bf6ab71f58cb93
--- /dev/null
+++ b/ShellB3/src/numpy-1.13.1.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c9b0283776085cb2804efff73e9955ca279ba4edafd58d3ead70b61d209c4fbb
+size 5012881
diff --git a/ShellB3/src/optional/Bottleneck-1.2.0.tar.gz b/ShellB3/src/optional/Bottleneck-1.2.0.tar.gz
deleted file mode 100644
index 6a725fd238b5dc5785df2452dd4cdc551392f78e..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/Bottleneck-1.2.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3bec84564a4adbe97c24e875749b949a19cfba4e4588be495cc441db7c6b05e8
-size 92504
diff --git a/ShellB3/src/optional/Bottleneck-1.2.1.tar.gz b/ShellB3/src/optional/Bottleneck-1.2.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..d3e957ab4fffdd394cd8aaa35599b9b7eb0ed9cb
--- /dev/null
+++ b/ShellB3/src/optional/Bottleneck-1.2.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6efcde5f830aed64feafca0359b51db0e184c72af8ba6675b4a99f263922eb36
+size 105225
diff --git a/ShellB3/src/optional/DateTime-4.1.1.zip b/ShellB3/src/optional/DateTime-4.1.1.zip
deleted file mode 100644
index 6c18ae089e110e1476085d275d18446eba90bb83..0000000000000000000000000000000000000000
Binary files a/ShellB3/src/optional/DateTime-4.1.1.zip and /dev/null differ
diff --git a/ShellB3/src/optional/DateTime-4.2.tar.gz b/ShellB3/src/optional/DateTime-4.2.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2a9fb5c181de2c0c8b30ed4b5c439661a8c97283
--- /dev/null
+++ b/ShellB3/src/optional/DateTime-4.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b3d91011caff312274a629b35abd6eb67038f8f92423ad3d9e071c0bf8823226
+size 58830
diff --git a/ShellB3/src/optional/GitPython-2.1.3.tar.gz b/ShellB3/src/optional/GitPython-2.1.3.tar.gz
deleted file mode 100644
index a47271c5f78f3cf041ebb2d13a8770e8ae071c24..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/GitPython-2.1.3.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3826185b11e1fc372e7d31251e9b65e11ccb7c27f82c771d619048bdb5b66c81
-size 419838
diff --git a/ShellB3/src/optional/GitPython-2.1.5.tar.gz b/ShellB3/src/optional/GitPython-2.1.5.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..a6322a63cb3ee183e9d6342a8443276c8d0c42b3
--- /dev/null
+++ b/ShellB3/src/optional/GitPython-2.1.5.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5c00cbd256e2b1d039381d4f7d71fcb7ee5cc196ca10c101ff7191bd82ab5d9c
+size 420147
diff --git a/ShellB3/src/optional/IDL/proj.4-4.9.2.tar.gz b/ShellB3/src/optional/IDL/proj.4-4.9.2.tar.gz
deleted file mode 100644
index 5f4c0ffd437f0d05c0b0052ce506b967ee073f68..0000000000000000000000000000000000000000
Binary files a/ShellB3/src/optional/IDL/proj.4-4.9.2.tar.gz and /dev/null differ
diff --git a/ShellB3/src/optional/IDL/readline-6.3.tar.gz b/ShellB3/src/optional/IDL/readline-6.3.tar.gz
deleted file mode 100644
index e6b370795753d5c79b5751923ad327df66ca0d9b..0000000000000000000000000000000000000000
Binary files a/ShellB3/src/optional/IDL/readline-6.3.tar.gz and /dev/null differ
diff --git a/ShellB3/src/optional/IDL/traitlets-4.2.1.tar.gz b/ShellB3/src/optional/IDL/traitlets-4.2.1.tar.gz
deleted file mode 100644
index 3703123c7e3c6922166e0da32f53ccb7f5cba908..0000000000000000000000000000000000000000
Binary files a/ShellB3/src/optional/IDL/traitlets-4.2.1.tar.gz and /dev/null differ
diff --git a/ShellB3/src/optional/IDL/udunits-2.2.24.tar.gz b/ShellB3/src/optional/IDL/udunits-2.2.24.tar.gz
deleted file mode 100644
index a3562c6c4074d5db5ec4c2a090e7f434d4b7ebbc..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/IDL/udunits-2.2.24.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:20bac512f2656f056385429a0e44902fdf02fc7fe01c14d56f3c724336177f95
-size 1006419
diff --git a/ShellB3/src/optional/IDL/udunits-2.2.25.tar.gz b/ShellB3/src/optional/IDL/udunits-2.2.25.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2951be1849a102231bbb6f66cd35d33d67952950
--- /dev/null
+++ b/ShellB3/src/optional/IDL/udunits-2.2.25.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ad486f8f45cba915ac74a38dd15f96a661a1803287373639c17e5a9b59bfd540
+size 1006463
diff --git a/ShellB3/src/optional/IDL/wxWidgets-3.1.0.tar.bz2 b/ShellB3/src/optional/IDL/wxWidgets-3.1.0.tar.bz2
index b0feb91cc175f54cde2e1fb29f1657d45e2ee59d..1b47dc0ee633b1b8c913c6781a85189d02c03175 100644
Binary files a/ShellB3/src/optional/IDL/wxWidgets-3.1.0.tar.bz2 and b/ShellB3/src/optional/IDL/wxWidgets-3.1.0.tar.bz2 differ
diff --git a/ShellB3/src/optional/MetPy-0.5.1.tar.gz b/ShellB3/src/optional/MetPy-0.5.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..57bd2992bb55182951159bcde139932cbf8537a6
--- /dev/null
+++ b/ShellB3/src/optional/MetPy-0.5.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bd02ee47e8fe0f9ff86dfc86eee81fd2064403e5275a3ac5cc882a583ee24100
+size 1563596
diff --git a/ShellB3/src/optional/Pillow-4.1.0.tar.gz b/ShellB3/src/optional/Pillow-4.1.0.tar.gz
deleted file mode 100644
index f186cfa3d6317dfbe56ea9ece41ad9fdfeb3d576..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/Pillow-4.1.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a0fd487fed4a35717401b7566e51a1520b34e7c0f7f2a315a6509f82bc86299f
-size 11257676
diff --git a/ShellB3/src/optional/Pillow-4.2.1.tar.gz b/ShellB3/src/optional/Pillow-4.2.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..689a46bc0dbc16a77f29419adc44e93b9852b8bc
--- /dev/null
+++ b/ShellB3/src/optional/Pillow-4.2.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c724f65870e545316f9e82e4c6d608ab5aa9dd82d5185e5b2e72119378740073
+size 12673417
diff --git a/ShellB3/src/optional/Pint-0.8.1.tar.gz b/ShellB3/src/optional/Pint-0.8.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..60a7d3e5065113716333d2e300f46f2fc12dc924
--- /dev/null
+++ b/ShellB3/src/optional/Pint-0.8.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:afcf31443a478c32bbac4b00337ee9026a13d0e2ac83d30c79151462513bb0d4
+size 162197
diff --git a/ShellB3/src/optional/PyYAML-3.12.tar.gz b/ShellB3/src/optional/PyYAML-3.12.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..138e7a26c409927b74030c97f87c12c4a170c7b4
--- /dev/null
+++ b/ShellB3/src/optional/PyYAML-3.12.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab
+size 253011
diff --git a/ShellB3/src/optional/SQLAlchemy-1.1.11.tar.gz b/ShellB3/src/optional/SQLAlchemy-1.1.11.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..12a56f23974fb864b7bd40c63001ae2f90fcd709
--- /dev/null
+++ b/ShellB3/src/optional/SQLAlchemy-1.1.11.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:76f76965e9a968ba3aecd2a8bc0d991cea04fd9a182e6c95c81f1551487b0211
+size 5197520
diff --git a/ShellB3/src/optional/SQLAlchemy-1.1.9.tar.gz b/ShellB3/src/optional/SQLAlchemy-1.1.9.tar.gz
deleted file mode 100644
index acd2f24875072e3a17610b3e1ee1681b10f0ba1c..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/SQLAlchemy-1.1.9.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b65cdc73cd348448ef0164f6c77d45a9f27ca575d3c5d71ccc33adf684bc6ef0
-size 5164787
diff --git a/ShellB3/src/optional/Sphinx-1.6.3.tar.gz b/ShellB3/src/optional/Sphinx-1.6.3.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..65c30af798830abf4263b7de6ebb7eece5e6391f
--- /dev/null
+++ b/ShellB3/src/optional/Sphinx-1.6.3.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:af8bdb8c714552b77d01d4536e3d6d2879d6cb9d25423d29163d5788e27046e6
+size 4674251
diff --git a/ShellB3/src/optional/Sphinx-1.6b1.tar.gz b/ShellB3/src/optional/Sphinx-1.6b1.tar.gz
deleted file mode 100644
index 142603fdcfde54bea96a3fba71b5e7dcf2714e14..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/Sphinx-1.6b1.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:eaa29b88849724c4a2b21977c9664d0050b4b24d5f4322eb99920cc12019dd16
-size 4479134
diff --git a/ShellB3/src/optional/WebOb-1.7.2.tar.gz b/ShellB3/src/optional/WebOb-1.7.2.tar.gz
deleted file mode 100644
index f8e2c19899d745cbce6b55b0317d2038c8ce5284..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/WebOb-1.7.2.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0dc8b30bdbf15d8fd1a967e30ece3357f2f468206354f69213e57b30a63f0039
-size 215746
diff --git a/ShellB3/src/optional/WebOb-1.7.3.tar.gz b/ShellB3/src/optional/WebOb-1.7.3.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..003a6f084ca9c799192b697bc36ea79058232c8a
--- /dev/null
+++ b/ShellB3/src/optional/WebOb-1.7.3.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e65ca14b9f5ae5b031988ffc93f8b7f305ddfcf17a4c774ae0db47bcb3b87283
+size 216028
diff --git a/ShellB3/src/optional/astroid-1.5.2.tar.gz b/ShellB3/src/optional/astroid-1.5.2.tar.gz
deleted file mode 100644
index c35decc2d82e7fdf9fa408e88d9d7658f40179eb..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/astroid-1.5.2.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:271f1c9ad6519a5dde2a7f0c9b62c2923b55e16569bdd888f9f9055cc5be37ed
-size 240007
diff --git a/ShellB3/src/optional/astroid-1.5.3.tar.gz b/ShellB3/src/optional/astroid-1.5.3.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..b96b484b3f8e79ec0d68349c85994d98a982a577
--- /dev/null
+++ b/ShellB3/src/optional/astroid-1.5.3.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:492c2a2044adbf6a84a671b7522e9295ad2f6a7c781b899014308db25312dd35
+size 240617
diff --git a/ShellB3/src/optional/astropy-1.2.1.tar.gz b/ShellB3/src/optional/astropy-1.2.1.tar.gz
index 946329328c805efa1a76c787af3c9303a080a953..606ec6c7350ecdb0f9778514dc69d6836e918c0d 100644
Binary files a/ShellB3/src/optional/astropy-1.2.1.tar.gz and b/ShellB3/src/optional/astropy-1.2.1.tar.gz differ
diff --git a/ShellB3/src/optional/backports.functools_lru_cache-1.3.tar.gz b/ShellB3/src/optional/backports.functools_lru_cache-1.3.tar.gz
deleted file mode 100644
index e7ed8144d0f4a13220e0c8e3fc17c8f0290e77ed..0000000000000000000000000000000000000000
Binary files a/ShellB3/src/optional/backports.functools_lru_cache-1.3.tar.gz and /dev/null differ
diff --git a/ShellB3/src/optional/backports.functools_lru_cache-1.4.tar.gz b/ShellB3/src/optional/backports.functools_lru_cache-1.4.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..6fc5d68d5e8d56f1b913166055df648c38eff7f7
--- /dev/null
+++ b/ShellB3/src/optional/backports.functools_lru_cache-1.4.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:31f235852f88edc1558d428d890663c49eb4514ffec9f3650e7f3c9e4a12e36f
+size 6927
diff --git a/ShellB3/src/optional/c-blosc-1.12.1.tar.gz b/ShellB3/src/optional/c-blosc-1.12.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..29c8682912e9b31ca41965416e5128750a717404
--- /dev/null
+++ b/ShellB3/src/optional/c-blosc-1.12.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e04535e816bb942bedc9a0ba209944d1eb34e26e2d9cca37f114e8ee292cb3c8
+size 683510
diff --git a/ShellB3/src/optional/cartopy-0.15.1.tar.gz b/ShellB3/src/optional/cartopy-0.15.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..184265e12bfca860475fbf6bc63e986c643b1a91
--- /dev/null
+++ b/ShellB3/src/optional/cartopy-0.15.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c2221eaf8cb3827b026a398374f3b2e9431aa77fdf95754229232ef5236221ed
+size 8336001
diff --git a/ShellB3/src/optional/cfe-4.0.1.src.tar.xz b/ShellB3/src/optional/cfe-4.0.1.src.tar.xz
new file mode 100644
index 0000000000000000000000000000000000000000..6a55c6bf190d09272ccb8ddcb6c49b5e598dc540
--- /dev/null
+++ b/ShellB3/src/optional/cfe-4.0.1.src.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:61738a735852c23c3bdbe52d035488cdb2083013f384d67c1ba36fabebd8769b
+size 10933628
diff --git a/ShellB3/src/optional/chardet-3.0.4.tar.gz b/ShellB3/src/optional/chardet-3.0.4.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..b05e4d8e737d7aeb08b09c2dc6166562cefd3e3d
--- /dev/null
+++ b/ShellB3/src/optional/chardet-3.0.4.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae
+size 1868453
diff --git a/ShellB3/src/optional/gdal-2.2.1.tar.gz b/ShellB3/src/optional/gdal-2.2.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..9d8703eee7e708848a0686e1163a1cbb30954b3d
--- /dev/null
+++ b/ShellB3/src/optional/gdal-2.2.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:61837706abfa3e493f3550236efc2c14bd6b24650232f9107db50a944abf8b2f
+size 13724990
diff --git a/ShellB3/src/optional/geopy-1.11.0.tar.gz b/ShellB3/src/optional/geopy-1.11.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..949bd7a4ff9405ce08978b42b721010962b25410
--- /dev/null
+++ b/ShellB3/src/optional/geopy-1.11.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4250e5a9e9f7abb990eddf01d1491fc112755e14f76060011c607ba759a74112
+size 88667
diff --git a/ShellB3/src/optional/gitdb2-2.0.0.tar.gz b/ShellB3/src/optional/gitdb2-2.0.0.tar.gz
deleted file mode 100644
index b74f372879ecc7892fa63c9b88fe1e2e82bdad91..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/gitdb2-2.0.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b9f3209b401b8b4da5f94966c9c17650e66b7474ee5cd2dde5d983d1fba3ab66
-size 392536
diff --git a/ShellB3/src/optional/gitdb2-2.0.2.tar.gz b/ShellB3/src/optional/gitdb2-2.0.2.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..11b7c37b6ae1770b9aa5eb4834240a07ad2950b7
--- /dev/null
+++ b/ShellB3/src/optional/gitdb2-2.0.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f2e36d7561e91f30a6a44858756dc020d8f1e81ca6e4185979d5c6c24c648070
+size 393188
diff --git a/ShellB3/src/optional/graphviz-0.6.zip b/ShellB3/src/optional/graphviz-0.6.zip
deleted file mode 100644
index aa989774a5b5166ab4967722bef775592f21fb28..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/graphviz-0.6.zip
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b4be2b3438971588dc306116658f475916755ad8fcc0618e79023846ce94f97b
-size 73045
diff --git a/ShellB3/src/optional/graphviz-0.8.zip b/ShellB3/src/optional/graphviz-0.8.zip
new file mode 100644
index 0000000000000000000000000000000000000000..b5347f6a9438521a93fccbef8467317c55349398
--- /dev/null
+++ b/ShellB3/src/optional/graphviz-0.8.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:889c720d9955b804d56a8e842621558cbb5cbbdd93cbdf55862371311646e344
+size 132752
diff --git a/ShellB3/src/optional/hdf-4.2.12.tar.bz2 b/ShellB3/src/optional/hdf-4.2.12.tar.bz2
deleted file mode 100644
index 169590aaa85cb9968c41b06e5b1d8af0fadc36da..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/hdf-4.2.12.tar.bz2
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2d224a57a711d853d71b92ef0875d295b410454b005144ebd3dd4b3d4c811208
-size 3606747
diff --git a/ShellB3/src/optional/hdf-4.2.13.tar.bz2 b/ShellB3/src/optional/hdf-4.2.13.tar.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..3de1c9a8bb1b46fea265b3fda51308ca0bd2dfdd
--- /dev/null
+++ b/ShellB3/src/optional/hdf-4.2.13.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:55d3a42313bda0aba7b0463687caf819a970e0ba206f5ed2c23724f80d2ae0f3
+size 3616255
diff --git a/ShellB3/src/optional/hupper-0.4.4.tar.gz b/ShellB3/src/optional/hupper-0.4.4.tar.gz
deleted file mode 100644
index b324e721b17a2fbfea019b0288bad000c26b73bc..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/hupper-0.4.4.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a44971bd58e904864f31058b2e64b5716568d7db67f34d8f83b4d40f268adf7a
-size 29042
diff --git a/ShellB3/src/optional/hupper-1.0.tar.gz b/ShellB3/src/optional/hupper-1.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..ea77b1f462bd4aed0b29e0852852b4a3e66c0be8
--- /dev/null
+++ b/ShellB3/src/optional/hupper-1.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:afb9584fc387c962824627bb243d7d92c276df608a771b17c8b727a7de34920a
+size 30734
diff --git a/ShellB3/src/optional/idna-2.5.tar.gz b/ShellB3/src/optional/idna-2.5.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..ede7df9225aad4e88df09fcafc9f02ef3451616a
--- /dev/null
+++ b/ShellB3/src/optional/idna-2.5.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3cb5ce08046c4e3a560fc02f138d0ac63e00f8ce5901a56b32ec8b7994082aab
+size 130211
diff --git a/ShellB3/src/optional/ipython-5.3.0.tar.gz b/ShellB3/src/optional/ipython-5.3.0.tar.gz
deleted file mode 100644
index 0f8c93fb0c45346b8e062df848e6cec7b13e5844..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/ipython-5.3.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bf5e615e7d96dac5a61fbf98d9e2926d98aa55582681bea7e9382992a3f43c1d
-size 4967956
diff --git a/ShellB3/src/optional/ipython-5.4.1.tar.gz b/ShellB3/src/optional/ipython-5.4.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..80ed2817f706d01ece3aeb6906805b221ded3621
--- /dev/null
+++ b/ShellB3/src/optional/ipython-5.4.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:afaa92343c20cf4296728161521d84f606d8817f963beaf7198e63dfede897fb
+size 4973571
diff --git a/ShellB3/src/optional/ipython-6.1.0.tar.gz b/ShellB3/src/optional/ipython-6.1.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..5680164f66d0ddab68f092db4023b04b25ae96a6
--- /dev/null
+++ b/ShellB3/src/optional/ipython-6.1.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5c53e8ee4d4bec27879982b9f3b4aa2d6e3cfd7b26782d250fa117f85bb29814
+size 5066094
diff --git a/ShellB3/src/optional/isort-4.2.15.tar.gz b/ShellB3/src/optional/isort-4.2.15.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..0ec17a2612152520df17f7c83809d106bf874d19
--- /dev/null
+++ b/ShellB3/src/optional/isort-4.2.15.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:79f46172d3a4e2e53e7016e663cc7a8b538bec525c36675fcfd2767df30b3983
+size 56740
diff --git a/ShellB3/src/optional/isort-4.2.5.tar.gz b/ShellB3/src/optional/isort-4.2.5.tar.gz
deleted file mode 100644
index 4ac3e52908f3162903716c7618a0861cd4684ee8..0000000000000000000000000000000000000000
Binary files a/ShellB3/src/optional/isort-4.2.5.tar.gz and /dev/null differ
diff --git a/ShellB3/src/optional/jedi-0.10.2.tar.gz b/ShellB3/src/optional/jedi-0.10.2.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..58807e7e68869bb370f661b6eb66b9dc3cd9068c
--- /dev/null
+++ b/ShellB3/src/optional/jedi-0.10.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7abb618cac6470ebbd142e59c23daec5e6e063bfcecc8a43a037d2ab57276f4e
+size 381087
diff --git a/ShellB3/src/optional/lazy-object-proxy-1.2.2.tar.gz b/ShellB3/src/optional/lazy-object-proxy-1.2.2.tar.gz
deleted file mode 100644
index ed17a19f680e37d029d6906b17884ed01c60f2f4..0000000000000000000000000000000000000000
Binary files a/ShellB3/src/optional/lazy-object-proxy-1.2.2.tar.gz and /dev/null differ
diff --git a/ShellB3/src/optional/lazy-object-proxy-1.3.1.tar.gz b/ShellB3/src/optional/lazy-object-proxy-1.3.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..f234de70f8e5af73365b62cb7127b6b4779dca63
--- /dev/null
+++ b/ShellB3/src/optional/lazy-object-proxy-1.3.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:eb91be369f945f10d3a49f5f9be8b3d0b93a4c2be8f8a5b83b0571b8123e0a7a
+size 32237
diff --git a/ShellB3/src/optional/llvm-4.0.0.src.tar.xz b/ShellB3/src/optional/llvm-4.0.0.src.tar.xz
deleted file mode 100644
index ef0489ad8b94529954f8a9e51663c594c4315ac8..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/llvm-4.0.0.src.tar.xz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8d10511df96e73b8ff9e7abbfb4d4d432edbdbe965f1f4f07afaf370b8a533be
-size 21016340
diff --git a/ShellB3/src/optional/llvm-4.0.1.src.tar.xz b/ShellB3/src/optional/llvm-4.0.1.src.tar.xz
new file mode 100644
index 0000000000000000000000000000000000000000..bd0fee1505a6ec7ce6fbfd530d5cf9055757ea1d
--- /dev/null
+++ b/ShellB3/src/optional/llvm-4.0.1.src.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:da783db1f82d516791179fe103c71706046561f7972b18f0049242dee6712b51
+size 21065652
diff --git a/ShellB3/src/optional/llvmlite-0.17.1.tar.gz b/ShellB3/src/optional/llvmlite-0.17.1.tar.gz
deleted file mode 100644
index 3fc03d539eb4e9223f285ae917786e4a20222d7a..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/llvmlite-0.17.1.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9f5d98615ce1852c0f79e52d122ba38adee89752482db9bcbe51c8cd5030d140
-size 96072
diff --git a/ShellB3/src/optional/llvmlite-0.19.0.tar.gz b/ShellB3/src/optional/llvmlite-0.19.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..f80a67c65677d69a38a8a4a5af29e8bf7b2593f4
--- /dev/null
+++ b/ShellB3/src/optional/llvmlite-0.19.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fbaeb3d584e0f6bac82a33776e9b5f0b5b4a3415a03edeff5d66f6176f0edbe2
+size 97109
diff --git a/ShellB3/src/optional/logilab-common-1.4.0.tar.gz b/ShellB3/src/optional/logilab-common-1.4.0.tar.gz
deleted file mode 100644
index b61fde2d83a77b88d974684315ee60c081a208f6..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/logilab-common-1.4.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4f6feb984ee1aa0bef4ba9e42bcd07c2095f631e97feddc21b0bb8e4c87920af
-size 185740
diff --git a/ShellB3/src/optional/logilab-common-1.4.1.tar.gz b/ShellB3/src/optional/logilab-common-1.4.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2a9936454abeacadc5a937a4346ca9854eec7d48
--- /dev/null
+++ b/ShellB3/src/optional/logilab-common-1.4.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ed1c60f32c3fa03dc2efaa730e606db1209d14b4769561ff0365aa584a29360a
+size 185150
diff --git a/ShellB3/src/optional/matplotlib-2.0.0.tar.gz b/ShellB3/src/optional/matplotlib-2.0.0.tar.gz
deleted file mode 100644
index cdf3ee4f3e9159e8890e935a1e47f8ff810f1912..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/matplotlib-2.0.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:36cf0985829c1ab2b8b1dae5e2272e53ae681bf33ab8bedceed4f0565af5f813
-size 53161302
diff --git a/ShellB3/src/optional/matplotlib-2.0.2.tar.gz b/ShellB3/src/optional/matplotlib-2.0.2.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..ac13baae36207de6fdf4a22a656c9390b87382b3
--- /dev/null
+++ b/ShellB3/src/optional/matplotlib-2.0.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0ffbc44faa34a8b1704bc108c451ecf87988f900ef7ce757b8e2e84383121ff1
+size 53879938
diff --git a/ShellB3/src/optional/netCDF4-1.2.7.tar.gz b/ShellB3/src/optional/netCDF4-1.2.7.tar.gz
deleted file mode 100644
index ee06b5a6bb80f7be8484fc66e9981c47e53f2c6e..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/netCDF4-1.2.7.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0c449b60183ee06238a8f9a75de7b0eed3acaa7a374952ff9f1ff06beb8f94ba
-size 823926
diff --git a/ShellB3/src/optional/netCDF4-1.2.9.tar.gz b/ShellB3/src/optional/netCDF4-1.2.9.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..7c4311bb51117d84e46807e34c50ddbce66dccbd
--- /dev/null
+++ b/ShellB3/src/optional/netCDF4-1.2.9.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:259edab1f03b1c1b93bdbaa804d50211a0c9d8a15eee4f23988b5685c6c0d2c0
+size 538450
diff --git a/ShellB3/src/optional/numba-0.32.0.tar.gz b/ShellB3/src/optional/numba-0.32.0.tar.gz
deleted file mode 100644
index 127e09007865e43245cb379e2704e451c91e1064..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/numba-0.32.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f402ad47e2025f498f1303757ef38174a0358ac1a9f33657258671050d6b7683
-size 1177902
diff --git a/ShellB3/src/optional/numba-0.34.0.tar.gz b/ShellB3/src/optional/numba-0.34.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..c5762d6de05467fed33bd4e2d2ebf2247fa34a5d
--- /dev/null
+++ b/ShellB3/src/optional/numba-0.34.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4f86df9212cb2678598e6583973ef1df978f3e3ba497b4dc6f91848887710577
+size 1256742
diff --git a/ShellB3/src/optional/pathlib2-2.2.1.tar.gz b/ShellB3/src/optional/pathlib2-2.2.1.tar.gz
deleted file mode 100644
index 9a0711e58d4942891a7495bc14c4b39db1d81682..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/pathlib2-2.2.1.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ce9007df617ef6b7bd8a31cd2089ed0c1fed1f7c23cf2bf1ba140b3dd563175d
-size 31680
diff --git a/ShellB3/src/optional/pathlib2-2.3.0.tar.gz b/ShellB3/src/optional/pathlib2-2.3.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..8feb8a0b181f0542e86e410898617ea892155e60
--- /dev/null
+++ b/ShellB3/src/optional/pathlib2-2.3.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d32550b75a818b289bd4c1f96b60c89957811da205afcceab75bc8b4857ea5b3
+size 34291
diff --git a/ShellB3/src/optional/pbr-3.0.0.tar.gz b/ShellB3/src/optional/pbr-3.0.0.tar.gz
deleted file mode 100644
index af80762ec5d494ed5d165d1014edc3ca323afa71..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/pbr-3.0.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:568f988af109114fbfa0525dcb6836b069838360d11732736ecc82e4c15d5c12
-size 99062
diff --git a/ShellB3/src/optional/pbr-3.1.1.tar.gz b/ShellB3/src/optional/pbr-3.1.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..5e468d8e09813ec3f919f9964de1f97f161bded6
--- /dev/null
+++ b/ShellB3/src/optional/pbr-3.1.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:05f61c71aaefc02d8e37c0a3eeb9815ff526ea28b3b76324769e6158d7f95be1
+size 102665
diff --git a/ShellB3/src/optional/pcre-8.40.tar.bz2 b/ShellB3/src/optional/pcre-8.40.tar.bz2
deleted file mode 100644
index 4591064e1c5048e5e7954bc6dce668433c4466b4..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/pcre-8.40.tar.bz2
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:00e27a29ead4267e3de8111fcaa59b132d0533cdfdbdddf4b0604279acbcf4f4
-size 1560119
diff --git a/ShellB3/src/optional/gdal-2.1.3.tar.gz b/ShellB3/src/optional/pcre-8.41.tar.bz2
similarity index 80%
rename from ShellB3/src/optional/gdal-2.1.3.tar.gz
rename to ShellB3/src/optional/pcre-8.41.tar.bz2
index 2939869d64214ce299c907bd455906b892c340b3..6d56e97ff12d54c0a37733e2edc486a17be13889 100644
--- a/ShellB3/src/optional/gdal-2.1.3.tar.gz
+++ b/ShellB3/src/optional/pcre-8.41.tar.bz2
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:ae6a0a0dc6eb45a981a46db27e3dfe16c644fcf04732557e2cb315776974074a
-size 12890278
+oid sha256:e62c7eac5ae7c0e7286db61ff82912e1c0b7a0c13706616e94a7dd729321b530
+size 1561874
diff --git a/ShellB3/src/optional/plaster-0.5.tar.gz b/ShellB3/src/optional/plaster-0.5.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..ea34c8ffab8368c8b341615f8a5bb98763f8ee30
--- /dev/null
+++ b/ShellB3/src/optional/plaster-0.5.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2a028938dcbf41033c5d377363781b2528151b0159201587c41e7a4c74bc887c
+size 29600
diff --git a/ShellB3/src/optional/plaster_pastedeploy-0.4.1.tar.gz b/ShellB3/src/optional/plaster_pastedeploy-0.4.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..d83912c8da26f25e839fe5c729adc67eabf21e87
--- /dev/null
+++ b/ShellB3/src/optional/plaster_pastedeploy-0.4.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5b92469d4efb26f3581ea32ecc64a513891693d29639fbd2ab2ec755949f2bd3
+size 18456
diff --git a/ShellB3/src/optional/proj.4-4.9.2.tar.gz b/ShellB3/src/optional/proj.4-4.9.2.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..a2daa38034aa59728417eaa81b81695430e4fedc
--- /dev/null
+++ b/ShellB3/src/optional/proj.4-4.9.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9a40de36183d23a395cf51ba7a465e1e6c982b6e4553b31310c42012d188be6b
+size 4045125
diff --git a/ShellB3/src/optional/ptyprocess-0.5.1.tar.gz b/ShellB3/src/optional/ptyprocess-0.5.1.tar.gz
deleted file mode 100644
index ee425ed048d2d53b5c1932269188adf46ae327d9..0000000000000000000000000000000000000000
Binary files a/ShellB3/src/optional/ptyprocess-0.5.1.tar.gz and /dev/null differ
diff --git a/ShellB3/src/optional/ptyprocess-0.5.2.tar.gz b/ShellB3/src/optional/ptyprocess-0.5.2.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..802b76dde55af706a303e043a4f788bc8ac9582f
--- /dev/null
+++ b/ShellB3/src/optional/ptyprocess-0.5.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e64193f0047ad603b71f202332ab5527c5e52aa7c8b609704fc28c0dc20c4365
+size 69297
diff --git a/ShellB3/src/optional/pycparser-2.17.tar.gz b/ShellB3/src/optional/pycparser-2.17.tar.gz
deleted file mode 100644
index b251f3dd1dbde75f0650c5a5474b35e4d8c82f0e..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/pycparser-2.17.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0aac31e917c24cb3357f5a4d5566f2cc91a19ca41862f6c3c22dc60a629673b6
-size 231163
diff --git a/ShellB3/src/optional/pycparser-2.18.tar.gz b/ShellB3/src/optional/pycparser-2.18.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2e992366bda09d37627c7af942c3a580a83ad124
--- /dev/null
+++ b/ShellB3/src/optional/pycparser-2.18.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:99a8ca03e29851d96616ad0404b4aad7d9ee16f25c9f9708a11faf2810f7b226
+size 245897
diff --git a/ShellB3/src/optional/pykdtree-1.2.1.tar.gz b/ShellB3/src/optional/pykdtree-1.2.1.tar.gz
deleted file mode 100644
index 02a362641b52d6da37765b84fd19370d713e7c70..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/pykdtree-1.2.1.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5d9dd0b4ad4818996ff2439d0366e514126655c034d73e122f1bb39c3c494b68
-size 59745
diff --git a/ShellB3/src/optional/pykdtree-1.2.2.tar.gz b/ShellB3/src/optional/pykdtree-1.2.2.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..fd1cde653e5afd3ffd18e54b9ff1d492f44e196b
--- /dev/null
+++ b/ShellB3/src/optional/pykdtree-1.2.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:958cb731b19f10e14471947e67602876c3ab9e01246e6b9c6c5cbfd34d17141f
+size 59843
diff --git a/ShellB3/src/optional/pylint-1.7.1.tar.gz b/ShellB3/src/optional/pylint-1.7.1.tar.gz
deleted file mode 100644
index ff2079ea072b36f1dc1330e5dc1eaf1307383778..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/pylint-1.7.1.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8b4a7ab6cf5062e40e2763c0b4a596020abada1d7304e369578b522e46a6264a
-size 489108
diff --git a/ShellB3/src/optional/pylint-1.7.2.tar.gz b/ShellB3/src/optional/pylint-1.7.2.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2a47110d8fabee5bdb3dfd3279c4de0f747ba2f5
--- /dev/null
+++ b/ShellB3/src/optional/pylint-1.7.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ea6afb93a9ed810cf52ff3838eb3a15e2bf6a81b80de0eaede1ce442caa5ca69
+size 488628
diff --git a/ShellB3/src/optional/pyramid-1.8.3.tar.gz b/ShellB3/src/optional/pyramid-1.8.3.tar.gz
deleted file mode 100644
index 6b9ee5de29c93cc850361169548f970c9a0a3d1a..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/pyramid-1.8.3.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:1218140ea016dcb63b962d44e43c6d26e448e6c2a49133dc52d01f01fbb2d5c3
-size 2612188
diff --git a/ShellB3/src/optional/pyramid-1.9.tar.gz b/ShellB3/src/optional/pyramid-1.9.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2f2a3f2bc641297b973cae06e7bf2241b72e8d27
--- /dev/null
+++ b/ShellB3/src/optional/pyramid-1.9.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a1292c80d1cd776552d4a0e7549766829c81fa9e21516b5a4ce176d5d50d7e01
+size 2632038
diff --git a/ShellB3/src/optional/pyresample-1.4.1.tar.gz b/ShellB3/src/optional/pyresample-1.4.1.tar.gz
deleted file mode 100644
index 62fe55a5b662a7b226774c0a79ae0337002343cd..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/pyresample-1.4.1.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7fb9451bc3095816f30d5dc371820286bcef5d2f9cd2fe73f4f27565a3f7a9c4
-size 3873373
diff --git a/ShellB3/src/optional/pyresample-1.5.0.tar.gz b/ShellB3/src/optional/pyresample-1.5.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..8bc789ab75cdaf59aaa8901c51d000d1918c8019
--- /dev/null
+++ b/ShellB3/src/optional/pyresample-1.5.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a03db5f5a9df09df3524dc62e53aa54103c0b96390a99f6cbd3c9a6130c2f0b1
+size 5534327
diff --git a/ShellB3/src/optional/python-dateutil-2.6.0.tar.gz b/ShellB3/src/optional/python-dateutil-2.6.0.tar.gz
deleted file mode 100644
index 12cb0deadcd3c4dda3bccdcdffac91763b72bc48..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/python-dateutil-2.6.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:62a2f8df3d66f878373fd0072eacf4ee52194ba302e00082828e0d263b0418d2
-size 258060
diff --git a/ShellB3/src/optional/python-dateutil-2.6.1.tar.gz b/ShellB3/src/optional/python-dateutil-2.6.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..d9ade3183f19456d5450d4734901d118cb141e9e
--- /dev/null
+++ b/ShellB3/src/optional/python-dateutil-2.6.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:891c38b2a02f5bb1be3e4793866c8df49c7d19baabf9c1bad62547e0b4866aca
+size 241428
diff --git a/ShellB3/src/optional/readline-6.3.tar.gz b/ShellB3/src/optional/readline-6.3.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..6cfe800166e6c813424fa78f753539f60a941132
--- /dev/null
+++ b/ShellB3/src/optional/readline-6.3.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43
+size 2468560
diff --git a/ShellB3/src/optional/requests-2.13.0.tar.gz b/ShellB3/src/optional/requests-2.13.0.tar.gz
deleted file mode 100644
index 1eb7c4313f1558454162034df9cfb26fe5dc33ec..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/requests-2.13.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5722cd09762faa01276230270ff16af7acf7c5c45d623868d9ba116f15791ce8
-size 557508
diff --git a/ShellB3/src/optional/requests-2.18.1.tar.gz b/ShellB3/src/optional/requests-2.18.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..23c5a6d576de8ebacc43645ea06bdffb81671751
--- /dev/null
+++ b/ShellB3/src/optional/requests-2.18.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c6f3bdf4a4323ac7b45d01e04a6f6c20e32a052cd04de81e05103abc049ad9b9
+size 124229
diff --git a/ShellB3/src/optional/setuptools-35.0.1.zip b/ShellB3/src/optional/setuptools-35.0.1.zip
deleted file mode 100644
index 5e7efdb2ae5e045f2e43341b8319f32a9cc2cd92..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/setuptools-35.0.1.zip
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:eea7f2ff55d4a810b6bc39be1ad1c60c2702341b78b2365c71306eaa7316beac
-size 624263
diff --git a/ShellB3/src/optional/setuptools-36.0.1.zip b/ShellB3/src/optional/setuptools-36.0.1.zip
new file mode 100644
index 0000000000000000000000000000000000000000..3de63b985985c29d3310248fcaa11cf282ec3422
--- /dev/null
+++ b/ShellB3/src/optional/setuptools-36.0.1.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e17c4687fddd6d70a6604ac0ad25e33324cec71b5137267dd5c45e103c4b288a
+size 711296
diff --git a/ShellB3/src/optional/setuptools_scm-1.15.5.tar.gz b/ShellB3/src/optional/setuptools_scm-1.15.5.tar.gz
deleted file mode 100644
index 63151e983328c29075e2c7865d8fa282b26d1df8..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/setuptools_scm-1.15.5.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:145b2a8a609e0fd66108a92a06fe62d0fb329c0eb944f2d5c7ae3ca24222f29e
-size 25752
diff --git a/ShellB3/src/optional/setuptools_scm-1.15.6.tar.gz b/ShellB3/src/optional/setuptools_scm-1.15.6.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..80896c5197e05de5641787c6d4528d99e79ee159
--- /dev/null
+++ b/ShellB3/src/optional/setuptools_scm-1.15.6.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:49ab4685589986a42da85706b3311a2f74f1af567d39fee6cb1e088d7a75fb5f
+size 25779
diff --git a/ShellB3/src/optional/smmap2-2.0.1.tar.gz b/ShellB3/src/optional/smmap2-2.0.1.tar.gz
deleted file mode 100644
index 80eb0e8de090a0394a959dcca27480bc6cf0c262..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/smmap2-2.0.1.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5c9fd3ac4a30b85d041a8bd3779e16aa704a161991e74b9a46692bc368e68752
-size 21948
diff --git a/ShellB3/src/optional/smmap2-2.0.3.tar.gz b/ShellB3/src/optional/smmap2-2.0.3.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..753fe7b1783fd60743247676b11765e723d0e263
--- /dev/null
+++ b/ShellB3/src/optional/smmap2-2.0.3.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c7530db63f15f09f8251094b22091298e82bf6c699a6b8344aaaef3f2e1276c3
+size 23049
diff --git a/ShellB3/src/optional/sphinxcontrib-websupport-1.0.0.tar.gz b/ShellB3/src/optional/sphinxcontrib-websupport-1.0.0.tar.gz
deleted file mode 100644
index 7b1a25149450f124eed6f047d941c462ff4559f1..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/sphinxcontrib-websupport-1.0.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:38b6a295bd68a298c563ccfa005415ad4492f8d6095ba57fc5955de63620deeb
-size 590459
diff --git a/ShellB3/src/optional/sphinxcontrib-websupport-1.0.1.tar.gz b/ShellB3/src/optional/sphinxcontrib-websupport-1.0.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..d32e2253c4faf5550cf77b4d10b4af6dfcb2ce77
--- /dev/null
+++ b/ShellB3/src/optional/sphinxcontrib-websupport-1.0.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7a85961326aa3a400cd4ad3c816d70ed6f7c740acd7ce5d78cd0a67825072eb9
+size 590480
diff --git a/ShellB3/src/optional/urllib3-1.21.1.tar.gz b/ShellB3/src/optional/urllib3-1.21.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..bba018aa366876cf9c8626d15b5e8b8adb1383fc
--- /dev/null
+++ b/ShellB3/src/optional/urllib3-1.21.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b14486978518ca0901a76ba973d7821047409d7f726f22156b24e83fd71382a5
+size 224266
diff --git a/ShellB3/src/optional/zope.interface-4.4.0.tar.gz b/ShellB3/src/optional/zope.interface-4.4.0.tar.gz
deleted file mode 100644
index 82940579288f81862dfbd478f61ad409526c0893..0000000000000000000000000000000000000000
--- a/ShellB3/src/optional/zope.interface-4.4.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e50e5e87cde9bf0ed59229fd372390c2d68b3674ae313858ef544d32051e2cd3
-size 151322
diff --git a/ShellB3/src/optional/zope.interface-4.4.2.tar.gz b/ShellB3/src/optional/zope.interface-4.4.2.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..cd4dafc5ded0b7f1140d48da26f9c1c1d64e25a9
--- /dev/null
+++ b/ShellB3/src/optional/zope.interface-4.4.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4e59e427200201f69ef82956ddf9e527891becf5b7cde8ec3ce39e1d0e262eb0
+size 150150
diff --git a/ShellB3/src/scipy-0.19.0.zip b/ShellB3/src/scipy-0.19.0.zip
deleted file mode 100644
index b172bb67da74ba09ee0a76c51929bfcff229fc78..0000000000000000000000000000000000000000
--- a/ShellB3/src/scipy-0.19.0.zip
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4190d34bf9a09626cd42100bbb12e3d96b2daf1a8a3244e991263eb693732122
-size 15279751
diff --git a/ShellB3/src/scipy-0.19.1.tar.gz b/ShellB3/src/scipy-0.19.1.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..78ced5c644d4b610a688da5000b72731ed336fbd
--- /dev/null
+++ b/ShellB3/src/scipy-0.19.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a19a2ca7a7336495ec180adeaa0dfdcf41e96dbbee90d51c3ed828ba570884e6
+size 14083805
diff --git a/ShellB3/src/sqlite-autoconf-3180000.tar.gz b/ShellB3/src/sqlite-autoconf-3180000.tar.gz
deleted file mode 100644
index 38d957ba51b065c4699868b9dad1eba0ff622e64..0000000000000000000000000000000000000000
--- a/ShellB3/src/sqlite-autoconf-3180000.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3757612463976e7d08c5e9f0af3021613fc24bbcfe1c51197d6776b9ece9ac5c
-size 2533004
diff --git a/ShellB3/src/sqlite-autoconf-3190300.tar.gz b/ShellB3/src/sqlite-autoconf-3190300.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..0897d405306c305555878f46522ac4f8176bbad9
--- /dev/null
+++ b/ShellB3/src/sqlite-autoconf-3190300.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:06129c03dced9f87733a8cba408871bd60673b8f93b920ba8d815efab0a06301
+size 2542682
diff --git a/ShellB3/src/sys/cmake-3.7.2.tar.gz b/ShellB3/src/sys/cmake-3.7.2.tar.gz
deleted file mode 100644
index 7d1ad2560ba3bc0d3c9c9414deb67b48f59951c5..0000000000000000000000000000000000000000
--- a/ShellB3/src/sys/cmake-3.7.2.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:dc1246c4e6d168ea4d6e042cfba577c1acd65feea27e56f5ff37df920c30cae0
-size 7361593
diff --git a/ShellB3/src/sys/cmake-3.9.0.tar.gz b/ShellB3/src/sys/cmake-3.9.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..252a85a2763ba4fe9d4938465319fd70461cb0ee
--- /dev/null
+++ b/ShellB3/src/sys/cmake-3.9.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:167701525183dbb722b9ffe69fb525aa2b81798cf12f5ce1c020c93394dfae0f
+size 7691313
diff --git a/ShellB3/src/sys/gcc-5.4.0.tar.bz2 b/ShellB3/src/sys/gcc-5.4.0.tar.bz2
index 6fa36b7e01f89d7e8ca7218eb89992c0b97a671a..f67d2753af18e5f95efd15695f6757d3caa55ffc 100644
Binary files a/ShellB3/src/sys/gcc-5.4.0.tar.bz2 and b/ShellB3/src/sys/gcc-5.4.0.tar.bz2 differ
diff --git a/ShellB3/src/sys/gfortran-6.3-bin.tar.gz b/ShellB3/src/sys/gfortran-6.3-bin.tar.gz
deleted file mode 100644
index fe02b1a14ea95b9c857c91c4f8d423e70f6a6627..0000000000000000000000000000000000000000
--- a/ShellB3/src/sys/gfortran-6.3-bin.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:34e9b0a664f4bdb8c1b9a1fba8b8985055b734856a30ae09642b38ad8439631a
-size 61865253
diff --git a/ShellB3/src/sys/gfortran-7.1-bin.tar.gz b/ShellB3/src/sys/gfortran-7.1-bin.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..fee05c12313bbaa044df616fb726e7e92cb8bc7e
--- /dev/null
+++ b/ShellB3/src/sys/gfortran-7.1-bin.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ea4702b31433baab46b85d712aa86284e4ed1111bd2cda6678d3c92aa224ef57
+size 75192144
diff --git a/docker_shellb3/Dockerfile b/docker_shellb3/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..3383e047105ea8ac79ca8fde70cfc65cbafe0730
--- /dev/null
+++ b/docker_shellb3/Dockerfile
@@ -0,0 +1,4 @@
+FROM centos:6
+ENV PORTABLESHELLB3="Y"
+RUN yum -y install gcc-gfortran gcc-c++ unzip perl patch yacc bison flex gettext expat-devel git
+