コード例 #1
0
ファイル: dialog.py プロジェクト: bbycode/tinyOs
def radio(title, description, entries, current):
    choice = None
    menu = ""

    for i in range(len(entries)):
        if current == entries[i]:
            status = "\"on\""
        else:
            status = "\"off\""

        menu += "\"" + entries[i] + "\"" + " " + "\"\"" + " " + status

        if (i + 1) < len(entries):
            menu += " "

    description = "\n" + description + "\n "

    env.launch("dialog", "--title \"" + title + "\" " +			\
                         " --radiolist \"" + description + "\" " +	\
                         str(WINDOW_HEIGHT) + " " + str(WINDOW_WIDTH) +	\
                         " " + str(MENU_HEIGHT) + " " + menu + " 2> " +	\
                         g_temporary, env.OPTION_NONE)

    choice = env.pull(g_temporary, env.OPTION_NONE)

    if not choice:
        return None

    return entries.index(choice)
コード例 #2
0
ファイル: dialog.py プロジェクト: fenollp/kaneton
def			menu(title, description, entries):
  choice = None
  height = None
  menu = ""

  for i in range(len(entries)):
    menu += "\"" + entries[i] + "\"" + " " + "\"\""

    if (i + 1) < len(entries):
      menu += " "

  description="\n" + description + "\n "

  env.launch("dialog", "--title \"" + title + "\" " +			\
                       "--menu \"" + description + "\" " +		\
                       str(WINDOW_HEIGHT) + " " + str(WINDOW_WIDTH) +	\
                       " " + str(MENU_HEIGHT) + " " + menu + " 2> " +	\
                       g_temporary, env.OPTION_NONE)

  choice = env.pull(g_temporary, env.OPTION_NONE)

  if not choice:
    return None

  return entries.index(choice)
コード例 #3
0
ファイル: dialog.py プロジェクト: bbycode/tinyOs
def menu(title, description, entries):
    choice = None
    height = None
    menu = ""

    for i in range(len(entries)):
        menu += "\"" + entries[i] + "\"" + " " + "\"\""

        if (i + 1) < len(entries):
            menu += " "

    description = "\n" + description + "\n "

    env.launch("dialog", "--title \"" + title + "\" " +			\
                         "--menu \"" + description + "\" " +		\
                         str(WINDOW_HEIGHT) + " " + str(WINDOW_WIDTH) +	\
                         " " + str(MENU_HEIGHT) + " " + menu + " 2> " +	\
                         g_temporary, env.OPTION_NONE)

    choice = env.pull(g_temporary, env.OPTION_NONE)

    if not choice:
        return None

    return entries.index(choice)
コード例 #4
0
ファイル: dialog.py プロジェクト: fenollp/kaneton
def			radio(title, description, entries, current):
  choice = None
  menu = ""

  for i in range(len(entries)):
    if current == entries[i]:
      status = "\"on\""
    else:
      status = "\"off\""

    menu += "\"" + entries[i] + "\"" + " " + "\"\"" + " " + status

    if (i + 1) < len(entries):
      menu += " "

  description="\n" + description + "\n "

  env.launch("dialog", "--title \"" + title + "\" " +			\
                       " --radiolist \"" + description + "\" " +	\
                       str(WINDOW_HEIGHT) + " " + str(WINDOW_WIDTH) +	\
                       " " + str(MENU_HEIGHT) + " " + menu + " 2> " +	\
                       g_temporary, env.OPTION_NONE)

  choice = env.pull(g_temporary, env.OPTION_NONE)

  if not choice:
    return None

  return entries.index(choice)
コード例 #5
0
ファイル: initialize.py プロジェクト: Jupotter/kaneton
def			prototypes():
  useless = None

  env.display(env.HEADER_OK,
              "generating the kaneton prototypes",
              env.OPTION_NONE)
  env.launch(env._SOURCE_DIR_ + "/Makefile", "prototypes", env.OPTION_QUIET)
コード例 #6
0
def module_action(export_dir, arg):
    env.display(env.HEADER_OK, 'action svnexport', env.OPTION_NONE)
    env.launch(
        "svn",
        "export svn+ssh://[email protected]/kaneton " +
        export_dir, env.OPTION_NONE)

    return 0
コード例 #7
0
ファイル: cheat.py プロジェクト: fenollp/kaneton
def                     compare():
  student = None
  target = None

  # display a message.
  env.display(env.HEADER_OK,
              "comparing the snapshots with each others",
              env.OPTION_NONE)

  # for every snapshot to test, generate the trace of comparisons against
  # other snapshots.
  if g_targets: 
    for target in g_targets:
      print target

      student = None

      # retrieve the student structure.
      for student in g_history:
        if target == student["student"]:
          break

      if not student:
        env.display(env.HEADER_ERROR,
                    "the student '" + target + "' does not seem to exist",
                    env.OPTION_NONE)
        sys.exit(42)

      print student

      if (student["year"] == g_year) and                     \
         (student["stage"] == g_stage):
        # message.
        env.display(env.HEADER_OK,
                    "  " + student["name"],
                    env.OPTION_NONE)

        # launch the program.
        env.launch(env._CTC_COMPARE_TOOL_,
                   student["trace"] + " " + student["database"] + " -r " +
                   student["fingerprint"],
                   env.OPTION_QUIET)
  else:
    for student in g_history:
      if (student["year"] == g_year) and                     \
         (student["stage"] == g_stage):
        # message.
        env.display(env.HEADER_OK,
                    "  " + student["name"],
                    env.OPTION_NONE)

        # launch the program.
        env.launch(env._CTC_COMPARE_TOOL_,
                   student["trace"] + " " + student["database"] + " -r " +
                   student["fingerprint"],
                   env.OPTION_QUIET)
コード例 #8
0
ファイル: cheat.py プロジェクト: fenollp/kaneton
def                     generate():
  snapshot = None
  student = None
  file = None

  # display a message.
  env.display(env.HEADER_OK,
              "generating the snapshots' fingerprints",
              env.OPTION_NONE)

  # generate the token files.
  for student in g_history:
    # message.
    env.display(env.HEADER_OK,
                "  " + student["name"],
                env.OPTION_NONE)

    # create the token file
    env.launch(env._CTC_BUILD_TOOL_,
               "'" + student["sources"] + "/kaneton/'" + " " +
               "'" + student["fingerprint"] + "'",
               env.OPTION_QUIET)

  # display a message.
  env.display(env.HEADER_OK,
              "generating the snapshots' tokens database",
              env.OPTION_NONE)

  # generate the database file.
  for student in g_history:
    # if this student is part of the ones to test, continue.
    if (student["year"] == g_year) and                          \
       (student["stage"] == g_stage):
      fingerprints = []

      # message.
      env.display(env.HEADER_OK,
                  "  " + student["name"],
                  env.OPTION_NONE)

      # find the list of student snaphosts that will be tested against it.
      for snapshot in g_history:
        # skip the previous stages of the same user.
        if (student["year"] == snapshot["year"]) and            \
           (student["student"] == snapshot["student"]) and      \
           (student["stage"] != snapshot["stage"]):
          continue

        # add the fingerprint to the list.
        fingerprints += [ snapshot["fingerprint"] ]

      # finally, gather the information into a single database.
      env.launch(env._CTC_GATHER_TOOL_,
                 student["database"] + " " + " ".join(fingerprints),
                 env.OPTION_QUIET)
コード例 #9
0
ファイル: cheat.py プロジェクト: bbycode/tinyOs
def compare():
    student = None
    target = None

    # display a message.
    env.display(env.HEADER_OK, "comparing the snapshots with each others",
                env.OPTION_NONE)

    # for every snapshot to test, generate the trace of comparisons against
    # other snapshots.
    if g_targets:
        for target in g_targets:
            print target

            student = None

            # retrieve the student structure.
            for student in g_history:
                if target == student["student"]:
                    break

            if not student:
                env.display(
                    env.HEADER_ERROR,
                    "the student '" + target + "' does not seem to exist",
                    env.OPTION_NONE)
                sys.exit(42)

            print student

            if (student["year"] == g_year) and                     \
               (student["stage"] == g_stage):
                # message.
                env.display(env.HEADER_OK, "  " + student["name"],
                            env.OPTION_NONE)

                # launch the program.
                env.launch(
                    env._CTC_COMPARE_TOOL_, student["trace"] + " " +
                    student["database"] + " -r " + student["fingerprint"],
                    env.OPTION_QUIET)
    else:
        for student in g_history:
            if (student["year"] == g_year) and                     \
               (student["stage"] == g_stage):
                # message.
                env.display(env.HEADER_OK, "  " + student["name"],
                            env.OPTION_NONE)

                # launch the program.
                env.launch(
                    env._CTC_COMPARE_TOOL_, student["trace"] + " " +
                    student["database"] + " -r " + student["fingerprint"],
                    env.OPTION_QUIET)
コード例 #10
0
ファイル: dialog.py プロジェクト: bbycode/tinyOs
def input(title, description, current):
    choice = None

    description = "\n" + description + "\n "

    env.launch("dialog", "--title \"" + title + "\" " +			\
                         " --inputbox \"" + description + "\" " +		\
                         str(WINDOW_HEIGHT) + " " + str(WINDOW_WIDTH) +	\
                         " " + current + " 2> " + g_temporary,
                         env.OPTION_NONE)

    choice = env.pull(g_temporary, env.OPTION_NONE)

    return choice
コード例 #11
0
ファイル: dialog.py プロジェクト: fenollp/kaneton
def			input(title, description, current):
  choice = None

  description="\n" + description + "\n "

  env.launch("dialog", "--title \"" + title + "\" " +			\
                       " --inputbox \"" + description + "\" " +		\
                       str(WINDOW_HEIGHT) + " " + str(WINDOW_WIDTH) +	\
                       " " + current + " 2> " +	g_temporary,
                       env.OPTION_NONE)

  choice = env.pull(g_temporary, env.OPTION_NONE)

  return choice
コード例 #12
0
ファイル: cheat.py プロジェクト: bbycode/tinyOs
def generate():
    snapshot = None
    student = None
    file = None

    # display a message.
    env.display(env.HEADER_OK, "generating the snapshots' fingerprints",
                env.OPTION_NONE)

    # generate the token files.
    for student in g_history:
        # message.
        env.display(env.HEADER_OK, "  " + student["name"], env.OPTION_NONE)

        # create the token file
        env.launch(
            env._CTC_BUILD_TOOL_, "'" + student["sources"] + "/kaneton/'" +
            " " + "'" + student["fingerprint"] + "'", env.OPTION_QUIET)

    # display a message.
    env.display(env.HEADER_OK, "generating the snapshots' tokens database",
                env.OPTION_NONE)

    # generate the database file.
    for student in g_history:
        # if this student is part of the ones to test, continue.
        if (student["year"] == g_year) and                          \
           (student["stage"] == g_stage):
            fingerprints = []

            # message.
            env.display(env.HEADER_OK, "  " + student["name"], env.OPTION_NONE)

            # find the list of student snaphosts that will be tested against it.
            for snapshot in g_history:
                # skip the previous stages of the same user.
                if (student["year"] == snapshot["year"]) and            \
                   (student["student"] == snapshot["student"]) and      \
                   (student["stage"] != snapshot["stage"]):
                    continue

                # add the fingerprint to the list.
                fingerprints += [snapshot["fingerprint"]]

            # finally, gather the information into a single database.
            env.launch(env._CTC_GATHER_TOOL_,
                       student["database"] + " " + " ".join(fingerprints),
                       env.OPTION_QUIET)
コード例 #13
0
ファイル: initialize.py プロジェクト: Jupotter/kaneton
def			headers():
  env.display(env.HEADER_OK,
              "generating the kaneton header dependencies",
              env.OPTION_NONE)
  env.launch(env._SOURCE_DIR_ + "/Makefile", "headers", env.OPTION_QUIET)
コード例 #14
0
ファイル: view.py プロジェクト: fenollp/kaneton
def			view():
  env.launch(g_path + "/Makefile", "view", env.OPTION_NONE)
コード例 #15
0
ファイル: view.py プロジェクト: fenollp/kaneton
def			build():
  env.launch(g_path + "/Makefile", "build", env.OPTION_NONE)
コード例 #16
0
ファイル: view.py プロジェクト: bbycode/tinyOs
def build():
    env.launch(g_path + "/Makefile", "build", env.OPTION_NONE)
コード例 #17
0
ファイル: view.py プロジェクト: bbycode/tinyOs
def view():
    env.launch(g_path + "/Makefile", "view", env.OPTION_NONE)
コード例 #18
0
ファイル: initenv.py プロジェクト: Jupotter/kaneton
def module_action(export_dir, arg):
    env.display(env.HEADER_OK, 'action initenv', env.OPTION_NONE)
    env.launch(export_dir + '/environment/initialize.py', "", env.OPTION_QUIET)
    env.launch(export_dir + '/Makefile', "clean", env.OPTION_QUIET)
    return 0
コード例 #19
0
ファイル: client.py プロジェクト: Jupotter/kaneton
def                     Test(server, capability, arguments):
  snapshot = None
  suite = None
  environment = None
  identifier = None

  # warning
  Warning()

  # check the arguments
  if len(arguments) != 2:
    Usage()
    sys.exit(42)

  # retrieve the arguments.
  environment = arguments[0]
  suite = arguments[1]

  # check if there is a 'snapshot.tar.bz2' in the client/ directory.
  if env.path(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2",
              env.OPTION_EXIST):
    # display a message.
    env.display(env.HEADER_OK,
                "loading the snapshot '" +                              \
                  env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2'",
                env.OPTION_NONE)

    # read the snapshot.
    snapshot = env.pull(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2",
                        env.OPTION_NONE)

    # warn the user.
    env.display(env.HEADER_NONE, "", env.OPTION_NONE)
    env.display(env.HEADER_INTERACTIVE,
                "are you sure you want the local snapshot to be submitted?",
                env.OPTION_NONE)
    env.display(env.HEADER_INTERACTIVE,
                "press CTRL^C to stop the script, ENTER to continue...",
                env.OPTION_NONE)
    env.input(env.OPTION_NONE)
  else:
    # display a message.
    env.display(env.HEADER_OK,
                "generating the kaneton snapshot",
                env.OPTION_NONE)

    # export the current kaneton implementation.
    env.launch(env._EXPORT_SCRIPT_,
               "test:" + capability["type"],
               env.OPTION_QUIET)

    # display a message.
    env.display(env.HEADER_OK,
                "loading the kaneton snapshot",
                env.OPTION_NONE)

    # read the snapshot.
    snapshot = env.pull(env._EXPORT_DIR_ + "/output/" +                 \
                          "test:" + capability["type"] + ".tar.bz2",
                        env.OPTION_NONE)

  # display a message.
  env.display(env.HEADER_OK,
              "requesting the server",
              env.OPTION_NONE)

  # trigger a test.
  identifier = ktp.xmlrpc.Call(server.Test(capability,
                                           ktp.miscellaneous.Binary(snapshot),
                                           g_platform,
                                           g_architecture,
                                           environment,
                                           suite))

  # display the received report.
  env.display(env.HEADER_OK,
              "the snapshot has been scheduled for testing under the "  \
              "identifier: " + identifier,
              env.OPTION_NONE)
コード例 #20
0
ファイル: initialize.py プロジェクト: bbycode/tinyOs
def headers():
    env.display(env.HEADER_OK, "generating the kaneton header dependencies",
                env.OPTION_NONE)
    env.launch(env._SOURCE_DIR_ + "/Makefile", "headers", env.OPTION_QUIET)
コード例 #21
0
ファイル: cheat.py プロジェクト: bbycode/tinyOs
def prepare():
    global g_history
    global g_directory
    global g_output
    global g_base
    years = None
    year = None
    stages = None
    stage = None
    base = None

    # a message.
    env.display(env.HEADER_OK, "preparing the verification process",
                env.OPTION_NONE)

    # create a temporary directory for holding unpacked snapshots.
    g_directory = env.temporary(env.OPTION_DIRECTORY)

    # set the output file path.
    g_output = env._HISTORY_DIR_ + "/" + g_school + "/" + g_year + "/" +  \
               g_stage + ".html"

    # build the CTC tool
    env.launch(env._CTC_DIR_ + "/Makefile", "", env.OPTION_QUIET)

    # look for a base snapshot.
    if env.path(env._HISTORY_DIR_ + "/" + g_school + "/" + g_year +       \
                "/snapshot.tar.bz2", env.OPTION_EXIST):
        g_base = { "snapshot": env._HISTORY_DIR_ + "/" + g_school + "/" + \
                     g_year + "/snapshot.tar.bz2",
                   "path": g_directory + "/snapshot" }

        env.mkdir(g_base["path"], env.OPTION_NONE)
    else:
        g_base = None

    # retreive the list of other snapshots to compare. neighbours are the
    # students in the same year while alumni are old students.
    years = sorted(
        env.list(env._HISTORY_DIR_ + "/" + g_school, env.OPTION_DIRECTORY))

    for year in years:
        # skip the younger works.
        if year > g_year:
            continue

        # for the work from the same year, simply compare the same stages.
        if year == g_year:
            # retrieve the students in this year.
            students = sorted(env.list(env._HISTORY_DIR_ + "/" +              \
                                         g_school + "/" + year,
                                       env.OPTION_DIRECTORY))

            # for every student.
            for student in students:
                # add the student to the list.
                g_history += [                                                  \
                  {
                    "name": year + "/" + student + "/" + g_stage,
                    "year": year,
                    "student": student,
                    "stage": g_stage,
                    "people": transform(env.pull(env._HISTORY_DIR_ + "/" +      \
                                                 g_school + "/" + year + "/" +  \
                                                 student + "/people",
                                                 env.OPTION_NONE)),
                    "snapshot": env._HISTORY_DIR_ + "/" + g_school + "/" + year + "/" +
                                student + "/sources/" + g_stage + ".tar.bz2",
                    "sources": g_directory + "/" + year + "/" +                 \
                               student + "/" + g_stage,
                    "fingerprint": g_directory + "/" + year + "/" + student + "/" +
                                   g_stage + ".ctf",
                    "base": base,
                    "database": g_directory + "/" + year + "/" + student + "/tokens",
                    "trace": g_directory + "/" + year + "/" + student + "/trace"
                  } ]

        # for older work, take the most recent work from every older student.
# XXX this feature has been disabled because it generates too much code to process.
        if (year < g_year) and (0 == 1):
            # retrieve the students in this year.
            students = sorted(
                env.list(env._HISTORY_DIR_ + "/" + g_school + "/" + year,
                         env.OPTION_DIRECTORY))

            # for every student.
            for student in students:
                # find the works for this student.
                stages = sorted(
                    env.list(
                        env._HISTORY_DIR_ + "/" + g_school + "/" + year + "/" +
                        student + "/sources/", env.OPTION_FILE))

                # ignore students that skipped the project.
                if len(stages) == 0:
                    continue

                # find the most recent work.
                match = re.match("^(.*)\.tar\.bz2$", stages[len(stages) - 1])

                if not match:
                    continue

                # retrieve the stage name.
                stage = match.group(1)

                # add the last student's work to the list.
                g_history += [                                                  \
                  {
                    "name": year + "/" + student + "/" + stage,
                    "year": year,
                    "student": student,
                    "stage": stage,
                    "people": transform(env.pull(env._HISTORY_DIR_ + "/" +      \
                                                 g_school + "/" + year + "/" +  \
                                                 student + "/people",
                                                 env.OPTION_NONE)),
                    "snapshot": env._HISTORY_DIR_ + "/" + g_school + "/" + year + "/" +
                                student + "/sources/" + stage + ".tar.bz2",
                    "sources": g_directory + "/" + year + "/" + student + "/" + stage,
                    "fingerprint": g_directory + "/" + year + "/" + student + "/" +
                                   stage + ".ctf",
                    "base": base
                  } ]
コード例 #22
0
def Submit(server, capability, arguments):
    snapshot = None
    stage = None

    # warning
    Warning()

    # check the arguments
    if len(arguments) != 1:
        Usage()
        sys.exit(42)

    # retrieve the arguments.
    stage = arguments[0]

    # check if there is a 'snapshot.tar.bz2' in the client/ directory.
    if env.path(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2", env.OPTION_EXIST):
        # display a message.
        env.display(env.HEADER_OK,
                    "loading the snapshot '" +                              \
                      env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2'",
                    env.OPTION_NONE)

        # read the snapshot.
        snapshot = env.pull(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2",
                            env.OPTION_NONE)

        # warn the user.
        env.display(env.HEADER_NONE, "", env.OPTION_NONE)
        env.display(
            env.HEADER_INTERACTIVE,
            "are you sure you want the local snapshot to be submitted?",
            env.OPTION_NONE)
        env.display(env.HEADER_INTERACTIVE,
                    "press CTRL^C to stop the script, ENTER to continue...",
                    env.OPTION_NONE)
        env.input(env.OPTION_NONE)
    else:
        # display a message.
        env.display(env.HEADER_OK, "generating the kaneton snapshot",
                    env.OPTION_NONE)

        # export the current kaneton implementation.
        env.launch(env._EXPORT_SCRIPT_, "test:" + capability["type"],
                   env.OPTION_QUIET)

        # display a message.
        env.display(env.HEADER_OK, "loading the kaneton snapshot",
                    env.OPTION_NONE)

        # read the snapshot.
        snapshot = env.pull(env._EXPORT_DIR_ + "/output/" +                 \
                              "test:" + capability["type"] + ".tar.bz2",
                            env.OPTION_NONE)

    # display a message.
    env.display(env.HEADER_OK, "requesting the server", env.OPTION_NONE)

    # submit the snapshot.
    ktp.xmlrpc.Call(
        server.Submit(capability, ktp.miscellaneous.Binary(snapshot), stage))

    # display a message.
    env.display(env.HEADER_OK, "the snapshot has been submitted successfully",
                env.OPTION_NONE)
コード例 #23
0
def Test(server, capability, arguments):
    snapshot = None
    suite = None
    environment = None
    identifier = None

    # warning
    Warning()

    # check the arguments
    if len(arguments) != 2:
        Usage()
        sys.exit(42)

    # retrieve the arguments.
    environment = arguments[0]
    suite = arguments[1]

    # check if there is a 'snapshot.tar.bz2' in the client/ directory.
    if env.path(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2", env.OPTION_EXIST):
        # display a message.
        env.display(env.HEADER_OK,
                    "loading the snapshot '" +                              \
                      env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2'",
                    env.OPTION_NONE)

        # read the snapshot.
        snapshot = env.pull(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2",
                            env.OPTION_NONE)

        # warn the user.
        env.display(env.HEADER_NONE, "", env.OPTION_NONE)
        env.display(
            env.HEADER_INTERACTIVE,
            "are you sure you want the local snapshot to be submitted?",
            env.OPTION_NONE)
        env.display(env.HEADER_INTERACTIVE,
                    "press CTRL^C to stop the script, ENTER to continue...",
                    env.OPTION_NONE)
        env.input(env.OPTION_NONE)
    else:
        # display a message.
        env.display(env.HEADER_OK, "generating the kaneton snapshot",
                    env.OPTION_NONE)

        # export the current kaneton implementation.
        env.launch(env._EXPORT_SCRIPT_, "test:" + capability["type"],
                   env.OPTION_QUIET)

        # display a message.
        env.display(env.HEADER_OK, "loading the kaneton snapshot",
                    env.OPTION_NONE)

        # read the snapshot.
        snapshot = env.pull(env._EXPORT_DIR_ + "/output/" +                 \
                              "test:" + capability["type"] + ".tar.bz2",
                            env.OPTION_NONE)

    # display a message.
    env.display(env.HEADER_OK, "requesting the server", env.OPTION_NONE)

    # trigger a test.
    identifier = ktp.xmlrpc.Call(
        server.Test(capability, ktp.miscellaneous.Binary(snapshot), g_platform,
                    g_architecture, environment, suite))

    # display the received report.
    env.display(env.HEADER_OK,
                "the snapshot has been scheduled for testing under the "  \
                "identifier: " + identifier,
                env.OPTION_NONE)
コード例 #24
0
ファイル: initialize.py プロジェクト: bbycode/tinyOs
def prototypes():
    useless = None

    env.display(env.HEADER_OK, "generating the kaneton prototypes",
                env.OPTION_NONE)
    env.launch(env._SOURCE_DIR_ + "/Makefile", "prototypes", env.OPTION_QUIET)
コード例 #25
0
ファイル: clean.py プロジェクト: Jupotter/kaneton
def			clear():
  env.display(env.HEADER_OK,
              "clearing the kaneton development tree",
              env.OPTION_NONE)
  env.launch(env._SOURCE_DIR_ + "/Makefile", "clear", env.OPTION_QUIET)
コード例 #26
0
ファイル: client.py プロジェクト: Jupotter/kaneton
def                     Submit(server, capability, arguments):
  snapshot = None
  stage = None

  # warning
  Warning()

  # check the arguments
  if len(arguments) != 1:
    Usage()
    sys.exit(42)

  # retrieve the arguments.
  stage = arguments[0]

  # check if there is a 'snapshot.tar.bz2' in the client/ directory.
  if env.path(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2",
              env.OPTION_EXIST):
    # display a message.
    env.display(env.HEADER_OK,
                "loading the snapshot '" +                              \
                  env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2'",
                env.OPTION_NONE)

    # read the snapshot.
    snapshot = env.pull(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2",
                        env.OPTION_NONE)

    # warn the user.
    env.display(env.HEADER_NONE, "", env.OPTION_NONE)
    env.display(env.HEADER_INTERACTIVE,
                "are you sure you want the local snapshot to be submitted?",
                env.OPTION_NONE)
    env.display(env.HEADER_INTERACTIVE,
                "press CTRL^C to stop the script, ENTER to continue...",
                env.OPTION_NONE)
    env.input(env.OPTION_NONE)
  else:
    # display a message.
    env.display(env.HEADER_OK,
                "generating the kaneton snapshot",
                env.OPTION_NONE)

    # export the current kaneton implementation.
    env.launch(env._EXPORT_SCRIPT_,
               "test:" + capability["type"],
               env.OPTION_QUIET)

    # display a message.
    env.display(env.HEADER_OK,
                "loading the kaneton snapshot",
                env.OPTION_NONE)

    # read the snapshot.
    snapshot = env.pull(env._EXPORT_DIR_ + "/output/" +                 \
                          "test:" + capability["type"] + ".tar.bz2",
                        env.OPTION_NONE)

  # display a message.
  env.display(env.HEADER_OK,
              "requesting the server",
              env.OPTION_NONE)

  # submit the snapshot.
  ktp.xmlrpc.Call(server.Submit(capability,
                                ktp.miscellaneous.Binary(snapshot),
                                stage))

  # display a message.
  env.display(env.HEADER_OK,
              "the snapshot has been submitted successfully",
              env.OPTION_NONE)
コード例 #27
0
def module_action(export_dir, arg):
    env.display(env.HEADER_OK, 'action initenv', env.OPTION_NONE)
    env.launch(export_dir + '/environment/initialize.py', "", env.OPTION_QUIET)
    env.launch(export_dir + '/Makefile', "clean", env.OPTION_QUIET)
    return 0
コード例 #28
0
ファイル: cheat.py プロジェクト: fenollp/kaneton
def                     prepare():
  global g_history
  global g_directory
  global g_output
  global g_base
  years = None
  year = None
  stages = None
  stage = None
  base = None

  # a message.
  env.display(env.HEADER_OK,
              "preparing the verification process",
              env.OPTION_NONE)

  # create a temporary directory for holding unpacked snapshots.
  g_directory = env.temporary(env.OPTION_DIRECTORY)

  # set the output file path.
  g_output = env._HISTORY_DIR_ + "/" + g_school + "/" + g_year + "/" +  \
             g_stage + ".html"

  # build the CTC tool
  env.launch(env._CTC_DIR_ + "/Makefile", "", env.OPTION_QUIET)

  # look for a base snapshot.
  if env.path(env._HISTORY_DIR_ + "/" + g_school + "/" + g_year +       \
              "/snapshot.tar.bz2", env.OPTION_EXIST):
    g_base = { "snapshot": env._HISTORY_DIR_ + "/" + g_school + "/" + \
                 g_year + "/snapshot.tar.bz2",
               "path": g_directory + "/snapshot" }

    env.mkdir(g_base["path"], env.OPTION_NONE)
  else:
    g_base = None

  # retreive the list of other snapshots to compare. neighbours are the
  # students in the same year while alumni are old students.
  years = sorted(env.list(env._HISTORY_DIR_ + "/" + g_school,
                          env.OPTION_DIRECTORY))

  for year in years:
    # skip the younger works.
    if year > g_year:
      continue

    # for the work from the same year, simply compare the same stages.
    if year == g_year:
      # retrieve the students in this year.
      students = sorted(env.list(env._HISTORY_DIR_ + "/" +              \
                                   g_school + "/" + year,
                                 env.OPTION_DIRECTORY))

      # for every student.
      for student in students:
        # add the student to the list.
        g_history += [                                                  \
          {
            "name": year + "/" + student + "/" + g_stage,
            "year": year,
            "student": student,
            "stage": g_stage,
            "people": transform(env.pull(env._HISTORY_DIR_ + "/" +      \
                                         g_school + "/" + year + "/" +  \
                                         student + "/people",
                                         env.OPTION_NONE)),
            "snapshot": env._HISTORY_DIR_ + "/" + g_school + "/" + year + "/" +
                        student + "/sources/" + g_stage + ".tar.bz2",
            "sources": g_directory + "/" + year + "/" +                 \
                       student + "/" + g_stage,
            "fingerprint": g_directory + "/" + year + "/" + student + "/" +
                           g_stage + ".ctf",
            "base": base,
            "database": g_directory + "/" + year + "/" + student + "/tokens",
            "trace": g_directory + "/" + year + "/" + student + "/trace"
          } ]

    # for older work, take the most recent work from every older student.
# XXX this feature has been disabled because it generates too much code to process.
    if (year < g_year) and (0 == 1):
      # retrieve the students in this year.
      students = sorted(env.list(env._HISTORY_DIR_ + "/" + g_school + "/" + year,
                                 env.OPTION_DIRECTORY))

      # for every student.
      for student in students:
        # find the works for this student.
        stages = sorted(env.list(env._HISTORY_DIR_ + "/" + g_school + "/" +
                                 year + "/" + student + "/sources/",
                                 env.OPTION_FILE))

        # ignore students that skipped the project.
        if len(stages) == 0:
          continue

        # find the most recent work.
        match = re.match("^(.*)\.tar\.bz2$", stages[len(stages) - 1])

        if not match:
          continue

        # retrieve the stage name.
        stage = match.group(1)

        # add the last student's work to the list.
        g_history += [                                                  \
          {
            "name": year + "/" + student + "/" + stage,
            "year": year,
            "student": student,
            "stage": stage,
            "people": transform(env.pull(env._HISTORY_DIR_ + "/" +      \
                                         g_school + "/" + year + "/" +  \
                                         student + "/people",
                                         env.OPTION_NONE)),
            "snapshot": env._HISTORY_DIR_ + "/" + g_school + "/" + year + "/" +
                        student + "/sources/" + stage + ".tar.bz2",
            "sources": g_directory + "/" + year + "/" + student + "/" + stage,
            "fingerprint": g_directory + "/" + year + "/" + student + "/" +
                           stage + ".ctf",
            "base": base
          } ]
コード例 #29
0
ファイル: svnexport.py プロジェクト: Jupotter/kaneton
def module_action(export_dir, arg):
    env.display(env.HEADER_OK, 'action svnexport', env.OPTION_NONE)
    env.launch("svn", "export svn+ssh://[email protected]/kaneton " + export_dir,env.OPTION_NONE)

    return 0