def get_task_name_validation_error(proposed): """ Return None if the proposed task name satisfies our naming convention, or a string describing problem otherwise. Currently, our constraints require the task name to start with a letter and be followed by any sequence of letters, digits, underscores, or hyphens --but must end with alphanum. The dot, @, ~, and other punctuation chars are not allowed. """ err = component.get_component_name_validation_error(proposed) if err: err = err.replace("Component", "Task") err = err.replace("component", "task") return err
def get_task_name_validation_error(proposed): ''' Return None if the proposed task name satisfies our naming convention, or a string describing problem otherwise. Currently, our constraints require the task name to start with a letter and be followed by any sequence of letters, digits, underscores, or hyphens --but must end with alphanum. The dot, @, ~, and other punctuation chars are not allowed. ''' err = component.get_component_name_validation_error(proposed) if err: err = err.replace('Component', 'Task') err = err.replace('component', 'task') return err
def _get_component_subdirs(root, excluding=None, bzr_only=True): """ Given a folder such as a code root, built root, or test root, find all subdirs that appear to contain components. @param excluding A list of component names that should not be returned. @param bzr_only If True, only consider component subdirs that have a relationship to bazaar. """ sdirs = [] if os.path.isdir(root): sdirs = [sd for sd in ioutil.subdirs(root)] sdirs = [sd for sd in sdirs if not component.get_component_name_validation_error(sd)] if excluding: sdirs = [sd for sd in sdirs if sd not in excluding] if bzr_only: sdirs = [sd for sd in sdirs if os.path.isdir(os.path.join(root, sd, ".bzr"))] return sdirs
def _get_component_subdirs(root, excluding=None, bzr_only=True): ''' Given a folder such as a code root, built root, or test root, find all subdirs that appear to contain components. @param excluding A list of component names that should not be returned. @param bzr_only If True, only consider component subdirs that have a relationship to bazaar. ''' sdirs = [] if os.path.isdir(root): sdirs = [sd for sd in ioutil.subdirs(root)] sdirs = [ sd for sd in sdirs if not component.get_component_name_validation_error(sd) ] if excluding: sdirs = [sd for sd in sdirs if sd not in excluding] if bzr_only: sdirs = [ sd for sd in sdirs if os.path.isdir(os.path.join(root, sd, '.bzr')) ] return sdirs