From 24dbd9f360be1a533bb33e2506a88fd9af85eac2 Mon Sep 17 00:00:00 2001 From: jwansek Date: Tue, 26 Apr 2022 20:10:36 +0100 Subject: Added installing dependencies in docker images, and fixed docker images --- Smarker/misc_classes.py | 1 + Smarker/smarker.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'Smarker') diff --git a/Smarker/misc_classes.py b/Smarker/misc_classes.py index 17ad36a..7ab37de 100644 --- a/Smarker/misc_classes.py +++ b/Smarker/misc_classes.py @@ -20,6 +20,7 @@ latex_jinja_env = jinja2.Environment( loader = jinja2.FileSystemLoader(os.path.abspath(os.path.join(os.path.split(__file__)[0], "templates"))) ) +# https://stackoverflow.com/questions/10551117/setting-options-from-environment-variables-when-using-argparse class EnvDefault(argparse.Action): def __init__(self, envvar, required=True, default=None, **kwargs): if not default and envvar: diff --git a/Smarker/smarker.py b/Smarker/smarker.py index 106d426..46feb5f 100644 --- a/Smarker/smarker.py +++ b/Smarker/smarker.py @@ -72,7 +72,7 @@ if __name__ == "__main__": action = misc_classes.EnvDefault, envvar = "assessment", help = "Path to an assessment .yml file", - type = os.path.abspath, + # type = os.path.abspath, required = True ) parser.add_argument( @@ -80,7 +80,7 @@ if __name__ == "__main__": action = misc_classes.EnvDefault, envvar = "submission", help = "Path to a zip of a student's code", - type = os.path.abspath, + # type = os.path.abspath, required = True ) parser.add_argument( @@ -110,6 +110,12 @@ if __name__ == "__main__": help = "Optional argument inherited from config file. Read smarker.conf for details." ) + try: + for dependency in os.environ["SMARKERDEPS"].split(","): + subprocess.run(["pip", "install", dependency]) + except KeyError: + pass + args = vars(parser.parse_args()) main(**args) \ No newline at end of file -- cgit v1.2.3