示例#1
0
    pass


# Default path of the configuration file:
DEFAULT_CONFIG_PATH = os.path.join(os.environ['HOME'], '.config',
                                   'devtools-conf.json')

FLAGS.add_string(
    name='config_file',
    default=DEFAULT_CONFIG_PATH,
    help='Path of the persistent configuration file.',
)

Keys = base.make_tuple(
    'Keys',
    REVIEWBOARD='reviewboard_servers',
    JIRA='jira_servers',
    CONFLUENCE='confluence_servers',
)


class Configuration(object):
    """Persistent configuration.

    Configuration is persisted as a JSON serialized Avro record.
    The configuration record is defined in 'avro/devtools.avdl'.
    """

    # Singleton instance:
    INSTANCE = None

    @classmethod
示例#2
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- mode: python -*-

"""CLI tool actions."""

import abc
import logging
import os

from base import base


HELP_FLAG = base.make_tuple(
    name='HelpFlag',
    ADD_HANDLE=0,
    ADD_NO_HANDLE=1,
    NO_ADD=2,
)

HelpFlag = HELP_FLAG  # Deprecated - for compatibility only


class Error(Exception):
    """Errors used in this module."""
    pass


class Action(object, metaclass=abc.ABCMeta):
    """Abstract base class for CLI actions."""

    # Name of this action, optionally overridden by sub-classes.
示例#3
0
    """Raised when a circular dependency is detected."""
    pass


# --------------------------------------------------------------------------------------------------
# Task abstract base class:


# Task states:
TaskState = base.make_tuple('TaskState',
    # Task is being initialized:
    INIT     = 1,

    # Task initialization is complete,
    # task is either runnable or waiting for some upstream dependency:
    PENDING  = 2,

    # Task completed successfully:
    SUCCESS  = 3,

    # Tasks failed:
    FAILURE  = 4,
)


DOWNSTREAM = 'downstream'
UPSTREAM = 'upstream'



def get_task_id(task_or_id):
    """Gets the ID of a task, given a parameter that is either a Task or an ID.
示例#4
0

# Default path of the configuration file:
DEFAULT_CONFIG_PATH = os.path.join(os.environ['HOME'], '.config', 'devtools-conf.json')


FLAGS.add_string(
    name='config_file',
    default=DEFAULT_CONFIG_PATH,
    help='Path of the persistent configuration file.',
)


Keys = base.make_tuple('Keys',
    REVIEWBOARD = 'reviewboard_servers',
    JIRA = 'jira_servers',
    CONFLUENCE = 'confluence_servers',
)


class Configuration(object):
    """Persistent configuration.

    Configuration is persisted as a JSON serialized Avro record.
    The configuration record is defined in 'avro/devtools.avdl'.
    """

    # Singleton instance:
    INSTANCE = None

    @classmethod