From 3e9d0b119bee40b3d8603a8ce06b6715e50ba6eb Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Fri, 21 Sep 2018 15:43:01 +0200 Subject: [PATCH] Add tool for fetching all student projects by group --- build-config.sh => tools/build-config.sh | 0 tools/groups.py | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+) rename build-config.sh => tools/build-config.sh (100%) create mode 100755 tools/groups.py diff --git a/build-config.sh b/tools/build-config.sh similarity index 100% rename from build-config.sh rename to tools/build-config.sh diff --git a/tools/groups.py b/tools/groups.py new file mode 100755 index 0000000..066d2ff --- /dev/null +++ b/tools/groups.py @@ -0,0 +1,22 @@ +#!/bin/python + +from sys import argv +from subprocess import run +from os import chdir +from os.path import isdir + +course_url = argv[1] + +with open(argv[2], 'r', encoding="latin-1") as csv: + for line in csv: + tokens = line.split(';') + student = tokens[5].replace('"', "").split(" ")[0] + group = tokens[0].replace('"', "").split(" ")[0] + url = course_url + "/solutions/" + student + "/solutions" + path = "solutions/" + group + "/" + student + if isdir(path): + chdir(path) + run(["git", "pull"]) + chdir("../../..") + else: + run(["git", "clone", url, path])