Skip to content
Snippets Groups Projects
Commit da359fa3 authored by tuhe's avatar tuhe
Browse files

Merge branch 'devel' into 'main'

Devel

See merge request !2
parents 2afc957b 06a9f950
Branches
No related tags found
1 merge request!2Devel
......@@ -13,7 +13,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup(
name="coursebox",
version="0.1.19.6",
version="0.1.19.11",
author="Tue Herlau",
author_email="tuhe@dtu.dk",
description="A course management system currently used at DTU",
......
Metadata-Version: 2.1
Name: coursebox
Version: 0.1.19.5
Version: 0.1.19.11
Summary: A course management system currently used at DTU
Home-page: https://lab.compute.dtu.dk/tuhe/coursebox
Author: Tue Herlau
......
......@@ -94,7 +94,7 @@ def first_day_of_class(info):
if continuing_education():
first_day_of_class = datetime(year=year(), month=info['first-month'], day=info['first-day'], hour=info['hour'][0], minute=info['minute'][0])
else:
mo_first = datetime(year=year(), month=1 if semester() == 'spring' else 8, day=1, hour=13, minute=0)
mo_first = datetime(year=year(), month=1 if semester() == 'spring' else 8, day=1, hour=info.get('lecture_start_hour', 13), minute=0)
# scroll to monday
while mo_first.weekday() != 0: #strftime('%A') is not 'Monday':
mo_first -= timedelta(days=1)
......@@ -398,9 +398,7 @@ def class_information(verbose=False,
nd = d['lectures'][r-1]['date'] + timedelta(days=int(d['handin_day_delta']))
ri['date'] = nd
ri['html'] = f"{nd.day} {nd.strftime('%b')}"
ri = {**ri, **date2format(nd)}
d['reports_info'][k] = ri
......@@ -447,7 +445,7 @@ def class_information(verbose=False,
n = l['number']
date = l['date']
dd = timedelta(days=l.get('show_solutions_after', 1))
dd = timedelta(days=l.get('show_solutions_after', 1), hours=4)
d['release_rules'][str(n)] = dict(start=date+dd, end=date+timedelta(days=2000))
# Update with section information.
if sections is not None:
......
......@@ -14,11 +14,15 @@ def get_paths():
# num = cd[:cd.find("public")]
CDIR = core_conf['working_dir']
course_number = core_conf['course_number']
layout = core_conf.get('directory_layout', {})
if layout is None:
layout = {}
root_02450public = os.path.normpath(CDIR + "/../..")
root_02450private = os.path.normpath(root_02450public + "/../%sprivate"%num)
root_02450instructors = os.path.normpath(root_02450private + "/../%sinstructors"%num)
root_02450students = os.path.normpath(root_02450private + "/../%sstudents" % num)
root_02450private = os.path.normpath( layout.get('private', root_02450public + "/../%sprivate"%num ))
root_02450instructors = os.path.normpath( layout.get('instructors', root_02450private + "/../%sinstructors"%num))
root_02450students = os.path.normpath( layout.get('students', root_02450private + "/../%sstudents" % num) )
root_02450public = root_02450public.replace("\\", "/")
root_02450private = root_02450private.replace("\\", "/")
......
from tinydb import TinyDB, Query
import os
import zipfile
......
......@@ -126,6 +126,7 @@ def build_sphinx_documentation(cut_files=False, open_browser=True, build_and_cop
WEEKS = list(core_conf['weeks_all'].keys())
pdfs = []
for g in glob.glob(paths['pdf_out'] +"/handout/*.pdf"):
dst = paths['02450public'] + "/src/docs/assets/"+os.path.basename(g)[:-4] + "-handout.pdf"
......@@ -148,6 +149,16 @@ def build_sphinx_documentation(cut_files=False, open_browser=True, build_and_cop
shutil.copy(g, dst)
pdfs.append(dst)
for g in glob.glob(paths['02450public'] + "/pensum/*.pdf"):
if "02450" in g or "sutton" in g:
continue
dst = paths['02450public'] + "/src/docs/assets/" + os.path.basename(g)
if not os.path.isdir(os.path.dirname(dst)):
os.makedirs(os.path.dirname(dst))
shutil.copy(g, dst)
pdfs.append(dst)
# Copy shared templates.
if not os.path.isdir(paths['02450public'] + "/src/docs/source/templates_generated"):
os.mkdir(paths['02450public'] + "/src/docs/source/templates_generated")
......@@ -218,6 +229,7 @@ def build_sphinx_documentation(cut_files=False, open_browser=True, build_and_cop
my_env = os.environ.copy()
my_env['PYTHONPATH'] = (paths['02450students'] + '_complete').replace("\\", "/")
print("Running", cmd)
process = run(cmd, print_output=True, log_output=True, check=False, env=my_env)
"""r
......@@ -426,6 +438,7 @@ def fix_all_shared_files(paths=None, dosvg=False,compile_templates=True, verbose
if os.path.isdir(out):
# I feel we need to convert the SVG images?
fix_shared(paths, out, pdf2png=dosvg, dosvg=dosvg, compile_templates=compile_templates, verbose=verbose) # , dosvg=dosvg <--- please update coursebox (script broken as is)
else:
print("Coursebox> No documentation shared directory. This is very, very odd indeed. I am stopping now. ")
......@@ -15,6 +15,7 @@ def setup_coursebox(working_dir, course_number="02450", semester='spring', year=
continuing_education_month = "March", post_process_info=None,
setup_student_files=None,
fix_all_shared_files=None,
directory_layout=None, # Base layout of the project directories. Contains keys like public, private, students, etc.
**kwargs):
funcs['setup_student_files'] = setup_student_files
funcs['fix_all_shared_files'] = fix_all_shared_files
......@@ -29,6 +30,7 @@ def setup_coursebox(working_dir, course_number="02450", semester='spring', year=
info_paths.core_conf['continuing_education_month'] = continuing_education_month
info_paths.core_conf['slides_shownotes'] = slides_shownotes
info_paths.core_conf['post_process_info'] = post_process_info
info_paths.core_conf['directory_layout'] = directory_layout
for a, val in kwargs.items():
info_paths.core_conf[a] = val
......@@ -72,9 +72,10 @@ def setup_student_files(run_files=True,
censor_file(init_dest)
# Check for exclusion mask.
exclude = info_paths.core_conf.get('student_files', {}).get('exclude', [])
exclude = list( info_paths.core_conf.get('student_files', {}).get('exclude', []) )
if extra_dirs is None:
extra_dirs = info_paths.core_conf.get('student_files', {}).get('extra_dirs', [])
extra_dirs = list(info_paths.core_conf.get('student_files', {}).get('extra_dirs', []))
print("Extra dirs are", extra_dirs)
exclude += [f'tests_week{w if w >= 10 else f"0{w}"}.py' for w in range(0,14) if w not in week]
......@@ -222,6 +223,10 @@ def fix_hw(paths, info, hw, out, output_dir, run_files=False, cut_files=False, c
run_files=run_files, cut_files=cut_files, license_head=info.get('code_copyright', None),
censor_files=censor_files,verbose=verbose,package_base_dir=package_base_dir)
if "tests" in hw['base']:
print(hw)
print("Doing the base.")
if include_solutions:
wk = hw['base'].split("/")[-1]
sp = paths['02450students'] + "/solutions/"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment