示例#1
0
def _get_git_options(locations):
    '''
    Returns the git options from the git_settings file for a stack.  Accepts
    either stack name, or ordered list of potential git_settings.py files.  
    Each entry in list overwrites previous options, allowing each layer to
    only change the settings from the previous layer.
    '''

    if type(locations) == type('text'):
        locations = _get_locations(locations, 'git_settings.py')
    new_options = {}

    for location in locations:
        git_file = location+'/git_settings.py'
        if os.path.isfile(git_file):
            path=sys.path
            sys.path=[os.path.dirname(git_file)]
            from git_settings import git_options
            sys.path=path
            for option in git_options.keys():
                new_options[option] = git_options[option]
            del git_options, path

    return new_options
示例#2
0
def _get_git_options(locations):
    '''
    Returns the git options from the git_settings file for a stack.  Accepts
    either stack name, or ordered list of potential git_settings.py files.  
    Each entry in list overwrites previous options, allowing each layer to
    only change the settings from the previous layer.
    '''

    if type(locations) == type('text'):
        locations = _get_locations(locations, 'git_settings.py')
    new_options = {}

    for location in locations:
        git_file = location+'/git_settings.py'
        if os.path.isfile(git_file):
            path=sys.path
            sys.path=[os.path.dirname(git_file)]
            from git_settings import git_options
            sys.path=path
            for option in git_options.keys():
                new_options[option] = git_options[option]
            del git_options, path

    return new_options
示例#3
0
        print
    print helpstring[2]
    from django.core.management import execute_from_command_line
    execute_from_command_line()

elif sys.argv[1] in localcmds:
    from git_settings import git_options
    cmd = sys.argv[1]
    options['stack'] = sys.argv[2]
    if options['stack'][-1] == '/':
        options['stack'] = options['stack'][0:-1]
    cmd_line_options=sys.argv[3:]
    single_options = [
        'git',
        ]
    paired_options = options.keys()+git_options.keys()
    while len(cmd_line_options) >= 1:
        option = cmd_line_options[0]
        if option in single_options:
            exec('options[\''+option+'\'] = True')
            cmd_line_options=cmd_line_options[1:]
        elif option in paired_options:
            exec('options[\''+option+'\'] = \''+cmd_line_options[1]+'\'')
            cmd_line_options = cmd_line_options[2:]
        elif option[:2] in ('No', 'NO', 'no'):
            if len(option) == 2:
                exec('options[\''+cmd_line_options[1]+'\'] = False')
                cmd_line_options = cmd_line_options[2:]
            else:
                exec('options[\''+option[2:]+'\'] = False')
                cmd_line_options = cmd_line_options[1:]
示例#4
0
        print cmd+":"
        exec('print '+cmd+'.__doc__')
        print
    print helpstring[2]
    from django.core.management import execute_from_command_line
    execute_from_command_line()

elif sys.argv[1] in localcmds:
    from git_settings import git_options
    cmd = sys.argv[1]
    options['stack'] = sys.argv[2]
    cmd_line_options=sys.argv[3:]
    single_options = [
        'git',
        ]
    paired_options = options.keys()+git_options.keys()
    while len(cmd_line_options) >= 1:
        option = cmd_line_options[0]
        if option in single_options:
            exec('options[\''+option+'\'] = True')
            cmd_line_options=cmd_line_options[1:]
        elif option in paired_options:
            exec('options[\''+option+'\'] = \''+cmd_line_options[1]+'\'')
            cmd_line_options = cmd_line_options[2:]
        elif option[:2] in ('No', 'NO', 'no'):
            if len(option) == 2:
                exec('options[\''+cmd_line_options[1]+'\'] = False')
                cmd_line_options = cmd_line_options[2:]
            else:
                exec('options[\''+option[2:]+'\'] = False')
                cmd_line_options = cmd_line_options[1:]