diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2018-10-11 00:46:00 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2018-10-11 00:46:00 +0200 |
commit | 03c2305e4acafb159c732612e3631e2553ff5ff1 (patch) | |
tree | 52ad7521a681152952108cd53ce4b162e065ee55 | |
parent | 46f2d091510d129aac14b7d43ef66845649968dc (diff) |
Write kpov_util.py to disk template in default config
-rw-r--r-- | kpov_judge/util.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/kpov_judge/util.py b/kpov_judge/util.py index f92c7c9..f465329 100644 --- a/kpov_judge/util.py +++ b/kpov_judge/util.py @@ -1,12 +1,22 @@ +import os import yaml def write_default_config(disk, global_params): - default_params = dict() + home = '/home/tester' + params_file = os.path.join(home, '.kpov_params.yaml') + default_params = {} for k in [ 'task_name', 'username', 'task_url']: if k in global_params: default_params[k] = global_params[k] - disk.write('/home/tester/.kpov_params.yaml', yaml.dump(default_params)) - disk.chown(1001, 1001, "/home/tester/.kpov_params.yaml") + disk.write(params_file, yaml.dump(default_params)) + disk.chown(1001, 1001, params_file) + + # write testing script and helper + for f in ['test_task.py', 'kpov_util.py']: + src = os.path.join(os.path.dirname(os.path.abspath(__file__)), f) + dst = os.path.join('/home/tester', f) + disk.write(dst, open(src).read()) + disk.chown(1001, 1001, dst) |