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

Updates

parent e708411e
Branches
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ with open("README.md", "r", encoding="utf-8") as fh: ...@@ -13,7 +13,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup( setuptools.setup(
name="coursebox", name="coursebox",
version="0.1.20.6", version="0.1.20.9",
author="Tue Herlau", author="Tue Herlau",
author_email="tuhe@dtu.dk", author_email="tuhe@dtu.dk",
description="A course management system currently used at DTU", description="A course management system currently used at DTU",
......
Metadata-Version: 2.1 Metadata-Version: 2.2
Name: coursebox Name: coursebox
Version: 0.1.20.4 Version: 0.1.20.9
Summary: A course management system currently used at DTU Summary: A course management system currently used at DTU
Home-page: https://lab.compute.dtu.dk/tuhe/coursebox Home-page: https://lab.compute.dtu.dk/tuhe/coursebox
Author: Tue Herlau Author: Tue Herlau
...@@ -23,6 +23,17 @@ Requires-Dist: langdetect ...@@ -23,6 +23,17 @@ Requires-Dist: langdetect
Requires-Dist: beamer-slider Requires-Dist: beamer-slider
Requires-Dist: tinydb Requires-Dist: tinydb
Requires-Dist: python-gitlab Requires-Dist: python-gitlab
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary
# Coursebox DTU # Coursebox DTU
DTU course management software. DTU course management software.
......
...@@ -98,7 +98,7 @@ def first_day_of_class(info): ...@@ -98,7 +98,7 @@ def first_day_of_class(info):
mo_first = datetime(year=year(), month=1 if semester() == 'spring' else 8, day=1, hour=info.get('lecture_start_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 # scroll to monday
while mo_first.weekday() != 0: #strftime('%A') is not 'Monday': while mo_first.weekday() != 0: #strftime('%A') is not 'Monday':
mo_first -= timedelta(days=1) mo_first += timedelta(days=1) # Don't subtract here.
# add 4 weeks to get into 13 week period # add 4 weeks to get into 13 week period
for _ in range(4): for _ in range(4):
mo_first += timedelta(days=7) mo_first += timedelta(days=7)
...@@ -169,6 +169,7 @@ def lectures(info, pensum=None): ...@@ -169,6 +169,7 @@ def lectures(info, pensum=None):
l['day'] = d.day l['day'] = d.day
l['date'] = d l['date'] = d
l['preceded_by_holiday'] = i == holiday l['preceded_by_holiday'] = i == holiday
l['followed_by_holiday'] = i+1 == holiday
l = {**l, **date2format(d)} l = {**l, **date2format(d)}
if not continuing_education(): if not continuing_education():
...@@ -469,6 +470,14 @@ def class_information(verbose=False, ...@@ -469,6 +470,14 @@ def class_information(verbose=False,
d['sections'] = sections d['sections'] = sections
current_lecture = -2
for k, l in enumerate(d['lectures']):
current_lecture = k - 1
if l['date'] >= datetime.now():
break
d['current_lecture_number'] = current_lecture
return d return d
def _update_with_core_conf(d): def _update_with_core_conf(d):
......
...@@ -93,6 +93,10 @@ def build_sphinx_documentation(cut_files=False, open_browser=True, build_and_cop ...@@ -93,6 +93,10 @@ def build_sphinx_documentation(cut_files=False, open_browser=True, build_and_cop
# print(">>> k class is: ") # print(">>> k class is: ")
# print(info_paths.core_conf['projects_all'][k]) # print(info_paths.core_conf['projects_all'][k])
if "class" not in info_paths.core_conf['projects_all'][k]:
print(f"Warning: I was unable to find project with number {k}. Probably the class raise an Exception. ")
print(info_paths.core_conf['projects_all'][k])
f = info_paths.core_conf['projects_all'][k]['class'].mfile() f = info_paths.core_conf['projects_all'][k]['class'].mfile()
with open(f.split("_grade.py")[0], 'r') as ff: with open(f.split("_grade.py")[0], 'r') as ff:
l = [l for l in ff.read().splitlines() if "(Report)" in l].pop().split("(")[0].split(" ")[-1] l = [l for l in ff.read().splitlines() if "(Report)" in l].pop().split("(")[0].split(" ")[-1]
...@@ -232,12 +236,13 @@ def build_sphinx_documentation(cut_files=False, open_browser=True, build_and_cop ...@@ -232,12 +236,13 @@ def build_sphinx_documentation(cut_files=False, open_browser=True, build_and_cop
my_env['PYTHONPATH'] = (paths['02450students'] + '_complete').replace("\\", "/") my_env['PYTHONPATH'] = (paths['02450students'] + '_complete').replace("\\", "/")
print("Running", cmd) print("Running", cmd)
process = run(cmd, print_output=True, log_output=True, check=False, env=my_env) process = run(cmd, print_output=True, log_output=True, check=False, env=my_env)
print("Done running sphinx build command.")
"""r """r
cd /home/tuhe/Documents/02465students_complete/ && sphinx-build -b html docs/source ./public cd /home/tuhe/Documents/02465students_complete/ && sphinx-build -b html docs/source ./public
cd "/home/tuhe/Documents/02465students_complete/docs" && sphinx-build -b html source "../../02465public/public" -a cd "/home/tuhe/Documents/02465students_complete/docs" && sphinx-build -b html source "../../02465public/public" -a
""" """
if os.name == 'nt': if os.name == 'nt':
print("This is windows. Building again:")
process = run(cmd, print_output=True, log_output=True, check=False, env=my_env) process = run(cmd, print_output=True, log_output=True, check=False, env=my_env)
print("TH 2023 Juli: Running sphinx compilation job twice bc of path error on windows. This should be easy to fix but I don't know enough about windows to do so.") print("TH 2023 Juli: Running sphinx compilation job twice bc of path error on windows. This should be easy to fix but I don't know enough about windows to do so.")
print(process.stderr.getvalue()) print(process.stderr.getvalue())
...@@ -270,7 +275,7 @@ Below is a summary of the problems we found: """) ...@@ -270,7 +275,7 @@ Below is a summary of the problems we found: """)
for im in ["gb.png", "dk.png"]: for im in ["gb.png", "dk.png"]:
shutil.copy(f"{paths['shared']}/figures/{im}", f"{_FINAL_BUILD_DEST}/_images/{im}") shutil.copy(f"{paths['shared']}/figures/{im}", f"{_FINAL_BUILD_DEST}/_images/{im}")
print("Running and building censored version of files:")
if build_and_copy_censored: if build_and_copy_censored:
verbose = False verbose = False
setup_student_files(run_files=False, cut_files=False, censor_files=True, setup_lectures=cut_files, setup_student_files(run_files=False, cut_files=False, censor_files=True, setup_lectures=cut_files,
......
...@@ -15,7 +15,8 @@ def setup_student_files(run_files=True, ...@@ -15,7 +15,8 @@ def setup_student_files(run_files=True,
week=None, extra_dirs=None, week=None, extra_dirs=None,
include_solutions=None, include_solutions=None,
projects=None, projects=None,
setup_lectures=False, strict=True, setup_lectures=False,
strict=True,
fix_shared_files=True, fix_shared_files=True,
include_exam_examples=False, # Include the directory with exam-related examples. include_exam_examples=False, # Include the directory with exam-related examples.
verbose=True, verbose=True,
...@@ -33,21 +34,11 @@ def setup_student_files(run_files=True, ...@@ -33,21 +34,11 @@ def setup_student_files(run_files=True,
from coursebox.core.info import class_information from coursebox.core.info import class_information
# info = class_information() # info = class_information()
from coursebox.core.info import core_conf from coursebox.core.info import core_conf
# <<<<<<< HEAD
# if 'package' not in core_conf:
if len(core_conf['projects_all']) > 0: if len(core_conf['projects_all']) > 0:
PACKAGE = list(core_conf['projects_all'].values()).pop()['module_public'].split(".")[0] PACKAGE = list(core_conf['projects_all'].values()).pop()['module_public'].split(".")[0]
else: else:
PACKAGE = [w for w in core_conf['weeks_all'].values() if 'module_public' in w][0]['module_public'].split(".")[0] PACKAGE = [w for w in core_conf['weeks_all'].values() if 'module_public' in w][0]['module_public'].split(".")[0]
# =======
# try:
# if len(core_conf['projects_all']) > 0:
# PACKAGE = list(core_conf['projects_all'].values()).pop()['module_public'].split(".")[0]
# else:
# PACKAGE = list(core_conf['weeks_all'].values()).pop()['module_public'].split(".")[0]
# except Exception as e:
# PACKAGE = core_conf['package']
# >>>>>>> 5f0cf05ea2c51749713d10331847fbe062613bab
if censor_files: if censor_files:
assert not run_files, "You cannot run files while you are censoring them -- your scripts will crash. Call with run_files=False." assert not run_files, "You cannot run files while you are censoring them -- your scripts will crash. Call with run_files=False."
...@@ -94,7 +85,7 @@ def setup_student_files(run_files=True, ...@@ -94,7 +85,7 @@ def setup_student_files(run_files=True,
exclude += [f'tests_week{w if w >= 10 else f"0{w}"}.py' for w in range(0,14) if w not in week] exclude += [f'tests_week{w if w >= 10 else f"0{w}"}.py' for w in range(0,14) if w not in week]
exclude = exclude + ["**/" + ex for ex in exclude] exclude = exclude + ["**/" + ex for ex in exclude]
if not include_exam_examples: if not include_exam_examples:
exclude += ['exam_tabular_examples'] exclude += ['*/exam_tabular_examples/*']
inclusion = [] # 'ex09old/cache'] inclusion = [] # 'ex09old/cache']
hws = [] hws = []
for m in midterms: for m in midterms:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment