コード例 #1
0
def main():
    mentors_data = Mentors()
    mentors_data.load(options.mentors)

    tasks = Tasks([], mentors_data=mentors_data, issues_dir = options.issues_dir)
    tasks.load(options.task_list)

    categories = tasks.categories
    difficulties = tasks.difficulties

    templ = Template(filename=options.template, output_encoding='utf-8')
    output = templ.render(tasks=tasks, categories=categories, difficulties=difficulties)

    with open(options.output_file, "w") as f:
        f.write(output)
        logging.info("")
        logging.info("File '%s' is generated." % options.output_file)
コード例 #2
0
def main():

    tasks = Tasks([])
    tasks.load(options.task_list)
    if "Id" not in tasks.fieldnames:
        print "It seems that the column with issues-id 'Id' is not filled."
        print "Run '1-pull_issues_id.py' firstly."
        sys.exit(1)

    for task in tasks:
        _id = task.Id
        if not _id:
            logging.warning("The task #%s has no issue_id. Skipped." % task.Key)
            continue

        val_is_inserted = None
        if task.has_key('is inserted'):
            val_is_inserted = task['is inserted']

        if ((val_is_inserted=="True") or (val_is_inserted=="False")) and not options.check_all:
            logging.debug("The information about inserting comments for the task #%s (issue %s) is present already. Skip" % (task.Key, _id))
            continue

        val_is_inserted = (False, True)[val_is_inserted=="True"]


        new_is_inserted = task.check_if_comment_is_inserted()
        if new_is_inserted==None:
            logging.warning("Can't check whether the comment is inserted for the task #%s (issue %s)." % (task.Key, _id))
            continue

        task['is inserted'] = ("False", "True")[new_is_inserted]

    tasks.extend_fieldnames(['is inserted'])
    tasks.save()
コード例 #3
0
def main():

    if options.recreate and os.path.exists(options.output_file):
        a = raw_input("Are you sure you want to delete '%s' file? : yes/[no] > " % options.output_file)
        if a != "yes":
            options.recreate = False

    if not ask_create_dir(options.output_file, False):
        sys.exit()

    mentors_data = Mentors()
    mentors_data.load(options.mentors)

    source_tasks = Tasks([], mentors_data=mentors_data, issues_dir = options.issues_dir)
    source_tasks.load(options.task_list)

    if os.path.exists(options.output_file) and not options.recreate:
        update_tasks = Tasks()
        update_tasks.load(options.output_file)
        update_tasks.update(source_tasks)
    else:
        update_tasks = source_tasks

    for task in update_tasks:
        _id = None
        try:
            _id = task.Id
        except:
            pass
        if not _id:
            _id = task.serach_issue_id()
            if _id:
                task["Id"] = _id

    update_tasks.extend_fieldnames(['Id'])
    update_tasks.save(options.output_file)
コード例 #4
0
def main():
    config = load_config_file()
    tracker = SympyIssueTracker(config)
    tracker.login()
    il = tracker.get_issues()

    tasks = Tasks([])
    tasks.load(options.task_list)
    if "Id" not in tasks.fieldnames:
        print "It seems that the column with issues-id 'Id' is not filled."
        print "Run '1-pull_issues_id.py' first, then '2-pull_is_inserted.py' to check"
        sys.exit(1)

    for task in tasks:
        _id = task.Id
        if not _id:
            logging.warning("The task #%s has no issue_id. Skipped." % task.Key)
            continue

        val_is_inserted = None
        if task.has_key('is inserted'):
            val_is_inserted = task['is inserted']

        if (val_is_inserted=="True") and not options.check_all:
            logging.debug("The comment for the task #%s (issue %s) has appearantly been inserted already. Skip" % (task.Key, _id))
            continue

        if val_is_inserted == None:
            continue

         # check it again in web
        _is_inserted = task.check_if_comment_is_inserted()

        if _is_inserted == True:
            logging.warning("For issue #%s the comment for task %s is already added" % _id)

        if (val_is_inserted == "False") and _is_inserted == False:
            # collect tasks of this issue, where 'task.is_inserted==False':
            _new = tasks.by_issue_id(_id)
            if _new:
                message_list = []
                for t in _new:
                    message_item = """%s
http://www.google-melange.com/gci/task/view/google/gci2011/%s
""" % (t.Title, t.Key)
                    t['is inserted'] = "True"

                    message_list.append(message_item)

                message = "".join(message_list)
                print
                print "For issue %s (http://code.google.com/p/sympy/issues/detail?id=%s) this comment will be added:" % (_id, _id)
                print
                print message
                print

                # insert comment
                if options.simulation_off:
                    a = raw_input("Insert comment? y/[n] > ")
                    if a=="y":
                        tracker.add_comment(_id, message)
                        print "Added."
            else:
                logging.warning("Tasks for issue #%s are not found" % _id)

    tasks.extend_fieldnames(['is_inserted'])
    tasks.save()