Esempio n. 1
0
def init():
    """ Called from main. In mma.py we checked for known directories and
        inserted the first found 'mma' directory into the sys.path list and
        set MMAdir. Now, set the lib/inc/plug lists. ENV variables are inserted
        at the beginning of each path.
    """

    def testpaths(paths, msg):
        """ Test validity of paths. No errors ...
            hope user notices he/she buggered up
        """
        for t in paths:
            if not os.path.exists(t):
                warning("%s '%s' does not exist." % (msg, t))
            elif not os.path.isdir(t):
                warning("%s '%s' is not a directory." % (msg, t))

    # set libpath
    t = safeEnv('MMA_LIBPATH')
    if t:
        t = t.split(os.pathsep)
    else:
        t = []
    t.append(os.path.join(gbl.MMAdir, 'lib'))
    setLibPath(t, user=0)
    testpaths(libPath, "LIBRARY")

    # set incpath
    t = safeEnv('MMA_INCPATH')
    if t:
        t = t.split(os.pathsep)
    else:
        t = []
    t.append(os.path.join(gbl.MMAdir, 'includes'))
    setIncPath(t)
    testpaths(incPath, "INCLUDE")

    # set plugpaths
    t = safeEnv('MMA_PLUGPATH')
    if t:
        t = t.split(os.pathsep)
    else:
        t = []
    t.append(os.path.join(gbl.MMAdir, "plugins"))
    setPlugPath(t)
    testpaths(plugPaths, "PLUGIN")
Esempio n. 2
0
    def sysfun(self, func, arg):
        if func == 'NOTELEN':
            return "%sT" % getNoteLen(arg)

        elif func == 'ENV':
            return safeEnv(arg)

        else:
            error("Unknown system function %s" % func)
Esempio n. 3
0
from MMA.common import *
from MMA.lyric import lyric

import MMA.paths

cmdSMF = None

########################################
########################################

# This is the program mainline. It is called/executed
# exactly once from a call in the stub program mma.py.

# for some reason, someone might want a different encoding
# real easy to set it from env at startup
m = safeEnv('MMA_ENCODING')
if m:  # don't set to empty ... will crash
    gbl.encoding = m

# MMA prints errors/warning/debug to stdout
# this will redirect to a file
gbl.logFile = safeEnv('MMA_LOGFILE')

MMA.paths.init()  # initialize the lib/include paths

# Get our command line stuff

MMA.options.opts()

#  LibPath and IncPath are set before option parsing, but
#  debug setting wasn't. So we need to do the debug for this now