@@ -0,0 +1,2553 @@
+#!/usr/bin/env python%0A#-*- coding: utf-8 -*-%0A%22%22%22%0A   ____%0A  %7C mx %7C%0A  %7C____%7C_______________________%0A     %7C                         %7C%0A     %7C An encrypting remailer. %7C%0A     %7C_________________________%7C%0A%0A@author Isis Agora Lovecruft %3Cisis@leap.se%3E, 0x2cdb8b35%0A@version 0.0.1%0A%0A%22%22%22%0A%0Afrom os  import getcwd%0Afrom os  import path as ospath%0A%0Aimport sys%0A%0Aapplication_name = %22leap_mx%22%0A%0Adef __get_dirs__():%0A    %22%22%22Get the absolute path of the top-level repository directory.%22%22%22%0A    here = getcwd()%0A    base = here.rsplit(application_name, 1)%5B0%5D%0A    repo = ospath.join(base, application_name)%0A    leap = ospath.join(repo, 'src')%0A    ours = ospath.join(leap, application_name.replace('_', '/'))%0A    return repo, leap, ours%0A%0A%0Aif __name__ == %22__main__%22:%0A    ## Set the $PYTHONPATH:%0A    repo, leap, ours = __get_dirs__()%0A    sys.path%5B:%5D = map(ospath.abspath, sys.path)%0A    sys.path.insert(0, leap)%0A%0A    ## Now we should be able to import ourselves without installation:%0A    try:%0A        from leap.mx      import runner%0A        from leap.mx.util import config, log, version%0A    except ImportError, ie:%0A        print %22%25s%5CnExiting...%5Cn%22 %25 ie.message%0A        sys.exit(1)%0A%0A    config.filename = 'mx.conf'%0A    config.loadConfig()%0A%0A    ## xxx fixme version requires twisted...%0A    dependency_check = runner.CheckRequirements(version.getPackageName(),%0A                                                version.getPipfile())%0A%0A    from twisted.python   import usage, runtime%0A    from twisted.internet import reactor%0A%0A    if config.basic.enable_logfile:%0A        logfilename = config.basic.logfile%0A        logfilepath = ospath.join(repo, 'logs')%0A        log.start(logfilename, logfilepath)%0A    else:%0A        log.start()%0A%0A    log.msg(%22Testing logging functionality%22)%0A    log.debug(%22Running %25s, with Python %25s%22%0A              %25 (application_name, runtime.shortPythonVersion()))%0A    log.debug(%22Platform: %25s%22 %25 runtime.platform.getType())%0A    log.debug(%22Thread support: %25s%22 %25 str(runtime.platform.supportsThreads()))%0A%0A    mx_options = MXOptions()%0A    mx_options.parseOptions(sys.argv)%0A%0A    if len(sys.argv) %3C= 0:%0A        print mx_options.getUsage()%0A        sys.exit(0)%0A    else:%0A        options = mx_options%0A%0A    if options%5B'verbose'%5D:%0A        config.basic.debug = True%0A%0A    if options%5B'test'%5D:%0A        from leap.mx import tests ## xxx this needs an __init__.py%0A        tests.run()               ## xxx need /leap/mx/tests.py%0A    elif options%5B'conf'%5D and os.path.isfile(options%5B'conf'%5D):%0A        config.parse()%0A        runner.run()%0A    else:%0A        mx_options.getUsage()%0A        sys.exit(1)%0A

Add new start script.