def __init__(self, args): # get current working directory self.cwd = os.getcwd() # find out if this is a pin project self.root = get_project_root(self.cwd) self.args = args # get command's argument-parser self.parser = self._getparser() # get command's parsed arguments self.options = self._getoptions(args)
def get_configuration(): check_configuration() config = DEFAULT_CONFIG config = merge(load_yaml(os.path.join(GLOBAL_PATH, SETTINGS_FILE)), config) # get project configuration root = get_project_root(os.getcwd()) if root: configfile = os.path.join(root, '.pin', SETTINGS_FILE) if os.path.isfile(configfile): config = merge(load_yaml(os.path.join(root, '.pin', SETTINGS_FILE)), config) return config
def get_subcommands(cls): cwd = os.getcwd() root = get_project_root(cwd) try: sys.path.append(root) mod = __import__('pavement') env = Environment(mod) tasks = env.get_tasks() maxlen, tasklist = _group_by_module(tasks) for name, group in tasklist: if name == 'pavement': return dict((t.shortname, t) for t in group) except ImportError: return dict()