def environ(self): for each in libsDB(): if each != 'gcc': self.update( eval("%s()" % each.replace('-','_')) )
def alias(withlibs=True): from glob import glob import os SHLIB = [ '.dylib', '.dll', '.so', '.la', '.lib', '.a', ] aliasScript = [] pythonBin = "/usr/bin/python2" # if osx: # import glob # paths = glob.glob( '%s/python/2.6*' % roots.libs() ) # if paths: # paths.sort() # pythonBin = "%s/bin/python" % paths[-1] for appname in libsDB(): classType = 'apps' try: # sys.stderr.write("%s\n" % appname) appClass = eval("apps.%s()" % appname) except: appClass = None if withlibs or os.environ.has_key('PIPE_RUN_WITH_LIBS'): try: classType = 'libs' appClass = eval("libs.%s()" % appname) except: appClass = None # import sys # print >>sys.stderr, appname, classType if appClass: for each in appClass.bins(): # print >>sys.stderr, each aliasScript.append('''alias %s='env LD_PRELOAD="" %s -c "import pipe;pipe.%s.%s().run(\\"%s\\")"' ''' % (each[0].replace(' ','_'), pythonBin, classType,appname, each[1]) ) for appname in appsDB(): try: appClass = eval("apps.%s()" % appname) except: appClass = None if appClass: try: for each in appClass.bins(): aliasScript.append('''alias %s='env LD_PRELOAD="" %s -c "import pipe;pipe.apps.%s().run(\\"%s\\")"' ''' % (each[0].replace(' ','_'), pythonBin, appname, each[1]) ) except: from bcolors import bcolors sys.stderr.write(bcolors.FAIL) sys.stderr.write("\nERROR: Application %s %s doesnt exist in the current job/shot!!\n" % (appname, appClass.version())) sys.stderr.write(bcolors.END) return '\n'.join(aliasScript)
# ================================================================================= import pipe from baseApp import baseLib, libsDB from baseApp import versionLib as version from pipe.base import roots from pipe.bcolors import bcolors import os, glob import traceback genericRegistry = [ 'class %s(baseLib):', ' pass', ] for each in libsDB(): if each != 'gcc': exec( '\n'.join(genericRegistry) % each.replace('-','_').replace('+','_plus_') ) class allLibs(baseLib): ''' this class loops over all installed libs and sets the proper env vars for then. As all our libs are installed in a padronized way, we don't need specific classes for each lib. In the case a library needs some special setup, we can allways create a new class for it, in the same molds of our apps classes! ''' def environ(self): for each in libsDB(): if each != 'gcc':