Exemple #1
0
    def setUp(self):
        # This setup is needed because we'd like to be able to use
        # --locale on the command line to test a given locale. So,
        # basically the code below is copy-and-pasted out of Utility.py
        # to make sure that everything gets initialized in the right
        # order.
        needInit = self.view is None

        # We always store a list of all failures, so that we can report them
        # all rather than fail on the first.
        self.failures = []

        if needInit:
            Utility.initLogging(Globals.options)
            type(self).view = NullRepositoryView()

            parcelPath = Utility.initParcelEnv(Globals.options, Globals.chandlerDirectory)
            pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options, Globals.options.pluginPath)

            Utility.initI18n(Globals.options)

            Utility.initParcels(Globals.options, self.view, parcelPath)
            Utility.initPlugins(Globals.options, self.view, pluginEnv, pluginEggs)
        # We don't want to import these globally, because they will
        # trigger parcel loading, and that will cause i18n to be set
        # up before the above call to initI18n, which will mean --locale
        # won't work on the command line. So, instead, we stash these
        # in instance variables.
        self.Menu = schema.importString("osaf.framework.blocks.Menu")
        self.MenuItem = schema.importString("osaf.framework.blocks.MenuItem")
Exemple #2
0
    def setUp(self):
        # This setup is needed because we'd like to be able to use
        # --locale on the command line to test a given locale. So,
        # basically the code below is copy-and-pasted out of Utility.py
        # to make sure that everything gets initialized in the right
        # order.
        needInit = (self.view is None)

        # We always store a list of all failures, so that we can report them
        # all rather than fail on the first.
        self.failures = []

        if needInit:
            Utility.initLogging(Globals.options)
            type(self).view = NullRepositoryView()

            parcelPath = Utility.initParcelEnv(Globals.options,
                                               Globals.chandlerDirectory)
            pluginEnv, pluginEggs = Utility.initPluginEnv(
                Globals.options, Globals.options.pluginPath)

            Utility.initI18n(Globals.options)

            Utility.initParcels(Globals.options, self.view, parcelPath)
            Utility.initPlugins(Globals.options, self.view, pluginEnv,
                                pluginEggs)
        # We don't want to import these globally, because they will
        # trigger parcel loading, and that will cause i18n to be set
        # up before the above call to initI18n, which will mean --locale
        # won't work on the command line. So, instead, we stash these
        # in instance variables.
        self.Menu = schema.importString('osaf.framework.blocks.Menu')
        self.MenuItem = schema.importString('osaf.framework.blocks.MenuItem')
Exemple #3
0
def startup(chandlerDirectory=None, **kwds):
    global view, commitOnExit

    Globals.options = Utility.initOptions(**kwds)
    if chandlerDirectory is None:
        Globals.chandlerDirectory = Utility.locateChandlerDirectory()
    else:
        Globals.chandlerDirectory = chandlerDirectory

    os.chdir(Globals.chandlerDirectory)
    Utility.initI18n(Globals.options)

    profileDir = Globals.options.profileDir

    Utility.initLogging(Globals.options)

    parcelPath = Utility.initParcelEnv(Globals.options,
                                       Globals.chandlerDirectory)
    pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options,
                                                  Globals.options.pluginPath)

    Globals.options.getPassword = getPassword
    repoDir = Utility.locateRepositoryDirectory(profileDir, Globals.options)
    view = Utility.initRepository(repoDir, Globals.options)

    verify, repoVersion, schemaVersion = Utility.verifySchema(view)
    if not verify:
        print "Schema mismatch (%s vs %s).  Try again with startup(create=True)" % (
            repoVersion, schemaVersion)
        return None

    Utility.initCrypto(Globals.options.profileDir)
    Utility.initParcels(Globals.options, view, parcelPath)
    Utility.initPlugins(Globals.options, view, pluginEnv, pluginEggs)
    Utility.initTimezone(Globals.options, view)

    if Globals.options.reload:
        from osaf import dumpreload
        dumpreload.reload(view, Globals.options.reload)

    return view
Exemple #4
0
def startup(chandlerDirectory=None, **kwds):
    global view, commitOnExit

    Globals.options = Utility.initOptions(**kwds)
    if chandlerDirectory is None:
        Globals.chandlerDirectory = Utility.locateChandlerDirectory()
    else:
        Globals.chandlerDirectory = chandlerDirectory

    os.chdir(Globals.chandlerDirectory)
    Utility.initI18n(Globals.options)

    profileDir = Globals.options.profileDir

    Utility.initLogging(Globals.options)

    parcelPath = Utility.initParcelEnv(Globals.options, 
                                       Globals.chandlerDirectory)
    pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options,
                                                  Globals.options.pluginPath)

    Globals.options.getPassword = getPassword
    repoDir = Utility.locateRepositoryDirectory(profileDir, Globals.options)
    view = Utility.initRepository(repoDir, Globals.options)

    verify, repoVersion, schemaVersion = Utility.verifySchema(view)
    if not verify:
        print "Schema mismatch (%s vs %s).  Try again with startup(create=True)" %(repoVersion, schemaVersion)
        return None

    Utility.initCrypto(Globals.options.profileDir)
    Utility.initParcels(Globals.options, view, parcelPath)
    Utility.initPlugins(Globals.options, view, pluginEnv, pluginEggs)
    Utility.initTimezone(Globals.options, view)

    if Globals.options.reload:
        from osaf import dumpreload
        dumpreload.reload(view, Globals.options.reload)

    return view
    e_options.include_log = True
    e_options.target = os.path.join(outputDir, 'api')
    e_options.verbosity = 4

    epydoc.cli.main(e_options, names)


if __name__ == '__main__':
    Globals.options = Utility.initOptions()
    Globals.options.create = True
    Globals.options.verify = False

    Globals.chandlerDirectory = Utility.locateChandlerDirectory()

    os.chdir(Globals.chandlerDirectory)
    Utility.initI18n(Globals.options)

    profileDir = os.path.abspath(
        os.path.join(Globals.chandlerDirectory, '..', 'doc_profile'))

    if not os.path.isdir(profileDir):
        _mkdirs(profileDir)

    print Globals.chandlerDirectory
    print profileDir

    Utility.initLogging(Globals.options)

    parcelPath = Utility.initParcelEnv(Globals.options,
                                       Globals.chandlerDirectory)
    pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options,
Exemple #6
0
cause *all* modules in all sub-packages of that package to be imported.)

"""

import sys

from unittest import main
from application import Globals, Utility
from util import test_finder

if __name__ == '__main__':

    if len(sys.argv) < 2 or sys.argv[1] in ('-h', '--help'):  # XXX
        print __doc__
        sys.exit(2)

    options = Utility.initOptions()
    Utility.initI18n(options)
    Utility.initLogging(options)

    # Rebuild the command line for unittest.main
    args = [sys.argv[0]]
    if options.verbose:
        args.append('-v')
    if options.quiet:
        args.append('-q')
    # options.args has all the leftover arguments from Utility
    sys.argv = args + options.args

    main(module=None, testLoader=test_finder.ScanningLoader())
Exemple #7
0
"""

import sys

from unittest import main
from application import Globals, Utility
from util import test_finder


if __name__ == '__main__':

    if len(sys.argv)<2 or sys.argv[1] in ('-h','--help'):   # XXX
        print __doc__
        sys.exit(2)

    options = Utility.initOptions()
    Utility.initI18n(options)
    Utility.initLogging(options)

    # Rebuild the command line for unittest.main
    args = [sys.argv[0]]
    if options.verbose:
        args.append('-v')
    if options.quiet:
        args.append('-q')
    # options.args has all the leftover arguments from Utility
    sys.argv = args + options.args

    main(module=None, testLoader=test_finder.ScanningLoader())

Exemple #8
0
    e_options.include_log = True
    e_options.target      = os.path.join(outputDir, 'api')
    e_options.verbosity   = 4

    epydoc.cli.main(e_options, names)


if __name__ == '__main__':
    Globals.options = Utility.initOptions()
    Globals.options.create = True
    Globals.options.verify = False

    Globals.chandlerDirectory = Utility.locateChandlerDirectory()

    os.chdir(Globals.chandlerDirectory)
    Utility.initI18n(Globals.options)

    profileDir = os.path.abspath(os.path.join(Globals.chandlerDirectory, '..', 'doc_profile'))

    if not os.path.isdir(profileDir):
        _mkdirs(profileDir)

    print Globals.chandlerDirectory
    print profileDir

    Utility.initLogging(Globals.options)

    parcelPath = Utility.initParcelEnv(Globals.options, 
                                       Globals.chandlerDirectory)
    pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options,
                                                  Globals.options.pluginPath)