コード例 #1
0
 def __init__(self, config=None, read_config_files=None):
     if config is None:
         config = read_config()
     self._read_cfg_files = read_config_files
     self._cfg_obj = config
     self._used_var = {}
コード例 #2
0
ファイル: gcmdr.py プロジェクト: pombredanne/peyotl
                     metavar="FILE",
                     required=False,
                     help='config file (highest priority value of settings; this overrides the '\
                     'setting values found in the peyotl config and the values in the config '\
                     'specified by the GCMDR_CONFIG_FILE env var (if used).')
 args = parser.parse_args()
 cmd = args.command.lower()
 if cmd not in lc_commands:
     sys.exit('Expecting the command to be one of: {}'.format(', '.join(commands)))
 cfg_filepaths = [None] # always read the default peyotl config
 ecfg = os.environ.get('GCMDR_CONFIG_FILE')
 if ecfg is not None:
     cfg_filepaths.append(ecfg)
 if args.config:
     cfg_filepaths.append(args.config)
 cfg, read_cfg_files = read_config(cfg_filepaths)
 _LOG.debug('read configuration in lowest->highest priority from: "{}"'.format('", "'.join(read_cfg_files)))
 if cmd in requires_studies:
     if args.studies is None:
         sys.exit('A list of trees in studies (--studies arg) must be specified when using the "{}" command'.format(cmd))
     tree_list = parse_study_tree_list(args.studies)
 gcmdr = GraphCommander(config=cfg, read_config_files=read_cfg_files)
 if cmd == 'taxonomy':
     gcmdr.load_taxonomy()
 elif cmd == 'fetchnexsons':
     gcmdr.fetch_nexsons(tree_list, download=args.download)
 elif cmd == 'loadgraph':
     gcmdr.load_graph(tree_list, reinitialize=args.reinitialize)
 elif cmd == 'synthesize':
     gcmdr.synthesize()
 elif cmd == 'extractsynthesis':
コード例 #3
0
ファイル: test_git_workflows.py プロジェクト: rvosa/peyotl
                                             delete_study, \
                                             GitWorkflowError, \
                                             merge_from_master
from peyotl.phylesystem.phylesystem_umbrella import Phylesystem
from peyotl.utility.input_output import read_as_json
from peyotl.utility import get_logger, read_config, _replace_default_config
import unittest
import codecs
import json
import copy
import sys
from peyotl.test.support import pathmap

_LOG = get_logger(__name__)

config, cfg_filename = read_config()
COMMITS_SHOULD_FAIL_ARG = 'tiny_max_file_size'
COMMITS_SHOULD_FAIL = COMMITS_SHOULD_FAIL_ARG in sys.argv
if COMMITS_SHOULD_FAIL:
    sys.argv.remove(COMMITS_SHOULD_FAIL_ARG)
    if 'phylesystem' not in config.sections():
        config.add_section('phylesystem')
    config.set('phylesystem', 'max_file_size', '10')  # ten bytes is not large
_replace_default_config(config)

phylesystem = Phylesystem(pathmap.get_test_repos(), )

_MINI_PHYL_SHA1 = '2d59ab892ddb3d09d4b18c91470b8c1c4cca86dc'
_SID = 'xy_10'
_AUTH = {
    'name': 'test_name',
コード例 #4
0
                     required=False,
                     help='config file (highest priority value of settings; this overrides the '\
                     'setting values found in the peyotl config and the values in the config '\
                     'specified by the GCMDR_CONFIG_FILE env var (if used).')
 args = parser.parse_args()
 cmd = args.command.lower()
 if cmd not in lc_commands:
     sys.exit('Expecting the command to be one of: {}'.format(
         ', '.join(commands)))
 cfg_filepaths = [None]  # always read the default peyotl config
 ecfg = os.environ.get('GCMDR_CONFIG_FILE')
 if ecfg is not None:
     cfg_filepaths.append(ecfg)
 if args.config:
     cfg_filepaths.append(args.config)
 cfg, read_cfg_files = read_config(cfg_filepaths)
 _LOG.debug(
     'read configuration in lowest->highest priority from: "{}"'.format(
         '", "'.join(read_cfg_files)))
 if cmd in requires_studies:
     if args.studies is None:
         sys.exit(
             'A list of trees in studies (--studies arg) must be specified when using the "{}" command'
             .format(cmd))
     tree_list = parse_study_tree_list(args.studies)
 gcmdr = GraphCommander(config=cfg, read_config_files=read_cfg_files)
 if cmd == 'taxonomy':
     gcmdr.load_taxonomy()
 elif cmd == 'fetchnexsons':
     gcmdr.fetch_nexsons(tree_list, download=args.download)
 elif cmd == 'loadgraph':
コード例 #5
0
ファイル: test_git_workflows.py プロジェクト: rvosa/peyotl
                                             commit_and_try_merge2master, \
                                             delete_study, \
                                             GitWorkflowError, \
                                             merge_from_master
from peyotl.phylesystem.phylesystem_umbrella import Phylesystem
from peyotl.utility.input_output import read_as_json
from peyotl.utility import get_logger, read_config, _replace_default_config
import unittest
import codecs
import json
import copy
import sys
from peyotl.test.support import pathmap
_LOG = get_logger(__name__)

config, cfg_filename = read_config()
COMMITS_SHOULD_FAIL_ARG = 'tiny_max_file_size'
COMMITS_SHOULD_FAIL = COMMITS_SHOULD_FAIL_ARG in sys.argv
if COMMITS_SHOULD_FAIL:
    sys.argv.remove(COMMITS_SHOULD_FAIL_ARG)
    if 'phylesystem' not in config.sections():
        config.add_section('phylesystem')
    config.set('phylesystem', 'max_file_size', '10') # ten bytes is not large
_replace_default_config(config)

phylesystem = Phylesystem(pathmap.get_test_repos(),
                            )

_MINI_PHYL_SHA1 = '2d59ab892ddb3d09d4b18c91470b8c1c4cca86dc'
_SID = 'xy_10'
_AUTH = {