def _bootstrap(): conts = realpath(join(dirname(__file__))) try: ui = hgui.ui() repository = localrepository(ui, join(conts, '..')) #repository = localrepository(ui, conts) ctx = repository['.'] if ctx.tags() and ctx.tags() != ['tip']: revision = ' '.join(ctx.tags()) else: revision = '%(num)s:%(id)s' % { 'num': ctx.rev(), 'id': shorthex(ctx.node()) } except TypeError: revision = 'unknown' except RepoError: return 0 # This value defines the timeout for sockets in seconds. Per default python # sockets do never timeout and as such we have blocking workers. # Socket timeouts are set globally within the whole application. # The value *must* be a floating point value. socket.setdefaulttimeout(10.0) return revision
def _bootstrap(): """Get the Inyoka version and store it.""" global INYOKA_REVISION # the path to the contents of the Inyoka module conts = os.environ.setdefault('INYOKA_MODULE', realpath(join(dirname(__file__)))) # the path to the Inyoka instance folder os.environ['INYOKA_INSTANCE'] = realpath(join(conts, pardir)) os.environ['CELERY_LOADER'] = 'inyoka.core.celery_support.CeleryLoader' # get the `INYOKA_REVISION` using the mercurial python api try: ui = hgui.ui() repository = localrepository(ui, join(conts, '..')) ctx = repository['tip'] INYOKA_REVISION = ('%(num)s:%(id)s' % { 'num': ctx.rev(), 'id': shorthex(ctx.node()) }) except TypeError: # fail silently pass # This value defines the timeout for sockets in seconds. Per default python # sockets do never timeout and as such we have blocking workers. # Socket timeouts are set globally within the whole application. # The value *must* be a floating point value. socket.setdefaulttimeout(10.0) #: bind the context ctx = ApplicationContext() ctx.bind() # setup components ctx.load_packages(ctx.cfg['activated_components']) if ctx.cfg['testing']: logger.level_name = 'ERROR' # makes INYOKA_REVISION visible in the extra dict of every log record proc = Processor(lambda x: x.extra.update(INYOKA_REVISION=INYOKA_REVISION)) proc.push_application()
def _bootstrap(): """Get the Inyoka version and store it.""" global INYOKA_REVISION # the path to the contents of the Inyoka module conts = os.environ.setdefault("INYOKA_MODULE", realpath(join(dirname(__file__)))) # the path to the Inyoka instance folder os.environ["INYOKA_INSTANCE"] = realpath(join(conts, pardir)) os.environ["CELERY_LOADER"] = "inyoka.core.celery_support.CeleryLoader" # get the `INYOKA_REVISION` using the mercurial python api try: ui = hgui.ui() repository = localrepository(ui, join(conts, "..")) ctx = repository["tip"] INYOKA_REVISION = "%(num)s:%(id)s" % {"num": ctx.rev(), "id": shorthex(ctx.node())} except TypeError: # fail silently pass # This value defines the timeout for sockets in seconds. Per default python # sockets do never timeout and as such we have blocking workers. # Socket timeouts are set globally within the whole application. # The value *must* be a floating point value. socket.setdefaulttimeout(10.0) #: bind the context ctx = ApplicationContext() ctx.bind() # setup components ctx.load_packages(ctx.cfg["activated_components"]) if ctx.cfg["testing"]: logger.level_name = "ERROR" # makes INYOKA_REVISION visible in the extra dict of every log record proc = Processor(lambda x: x.extra.update(INYOKA_REVISION=INYOKA_REVISION)) proc.push_application()