diff --git a/docs/build_docs.py b/docs/build_docs.py index 0f674b25fdb1c7c029d26c072d306733a922b4b5..867c7d9c4385e8777a16fcb930cf222fde7fcd0a 100644 --- a/docs/build_docs.py +++ b/docs/build_docs.py @@ -1,13 +1,11 @@ - import jinja2 + if __name__ == "__main__": from jinjafy.bibliography_maker import make_bibliography bib = make_bibliography("../setup.py", "./") - # bib = '' data = {'bibtex': bib} with open("README.jinja.md", 'r') as f: s = jinja2.Environment().from_string(f.read()).render(data) with open("../README.md", 'w') as f: f.write(s) - diff --git a/setup.py b/setup.py index 941b7abf91e781f05653c16b7aaad0bc0e120b26..493939007ae7912c0f90b93485ddaaa4098b4ed6 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ with open("README.md", "r", encoding="utf-8") as fh: # beamer-slider setuptools.setup( name="coursebox", - version="0.1.9", + version="0.1.13", author="Tue Herlau", author_email="tuhe@dtu.dk", description="A course management system currently used at DTU", diff --git a/src/coursebox.egg-info/PKG-INFO b/src/coursebox.egg-info/PKG-INFO index 18831e30bd744cbaa07dc43ee01ade1b262a134b..1ee6aabe77345ff30ba58c183f72a71f53b3b5fe 100644 --- a/src/coursebox.egg-info/PKG-INFO +++ b/src/coursebox.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: coursebox -Version: 0.1.9 +Version: 0.1.13 Summary: A course management system currently used at DTU Home-page: https://lab.compute.dtu.dk/tuhe/coursebox Author: Tue Herlau diff --git a/src/coursebox/book/irlc_main.py.pclprof b/src/coursebox/book/irlc_main.py.pclprof new file mode 100644 index 0000000000000000000000000000000000000000..a970559ed29bf6a45bbe280a86ee6ff8fd3bb6b5 --- /dev/null +++ b/src/coursebox/book/irlc_main.py.pclprof @@ -0,0 +1 @@ +{"profiledFunctions": [{"file": "/home/tuhe/Documents/02465public/pythontools/irlc_box/material/student_files.py", "lineNo": 19, "functionName": "setup_student_files", "profiledLines": []}], "unit": 1e-09} \ No newline at end of file diff --git a/src/coursebox/core/info.py b/src/coursebox/core/info.py index a80d792cd773d538312bf4aee6f6d03011f9ff55..5074b65e1244651813011e6450a7f0fb8e36c536 100644 --- a/src/coursebox/core/info.py +++ b/src/coursebox/core/info.py @@ -12,10 +12,10 @@ from coursebox.core.info_paths import core_conf # import pybtex.database.input.bibtex # import pybtex.plugin # import io -from line_profiler_pycharm import profile +# from line_profiler_pycharm import profile import time -@profile +# @profile def xlsx_to_dicts(xlsx_file,sheet=None, as_dict_list=False): # print("Loading...", xlsx_file, sheet, as_dict_list) t0 = time.time() @@ -245,7 +245,7 @@ def get_forum(paths): d2.append({k: v[i] for k, v in dd.items()}) return d2 -@profile +# @profile def class_information(): course_number = core_conf['course_number'] piazza = 'https://piazza.com/dtu.dk/%s%s/%s' % (semester().lower(), year(), course_number) diff --git a/src/coursebox/core/info_paths.py b/src/coursebox/core/info_paths.py index 8a0c02fcc9dad55fe47865ddf95eb293d3a7625f..96668314afaca3e7f944f659aab649a932edc1df 100644 --- a/src/coursebox/core/info_paths.py +++ b/src/coursebox/core/info_paths.py @@ -43,7 +43,11 @@ def get_paths(): _files = [] sCE = "CE" if core_conf['continuing_education_mode'] else "" - paths ={'02450private': root_02450private, + + paths ={ + # 'docs': + # 'docs': + '02450private': root_02450private, '02450public': root_02450public, '02450instructors': root_02450instructors, '02450students': root_02450students, diff --git a/src/coursebox/core/projects_info.py b/src/coursebox/core/projects_info.py index bae377d3613ea835231c7770cdecfc56566240da..a716c8ae8d60dcdf60d95ecc141c9289fed5f71d 100644 --- a/src/coursebox/core/projects_info.py +++ b/src/coursebox/core/projects_info.py @@ -3,7 +3,7 @@ import os import re import openpyxl import numpy as np -from line_profiler_pycharm import profile +# from line_profiler_pycharm import profile INSTRUCTOR_ROW = 6 INSTRUCTOR_CHECKER_ROW = 31 diff --git a/src/coursebox/material/homepage_lectures_exercises.py b/src/coursebox/material/homepage_lectures_exercises.py index 0a6b39571752473887020d86b39a649fc7dd1b47..d4ba93e4eb4d8d9df343f1b4ecf5c20b43d58609 100644 --- a/src/coursebox/material/homepage_lectures_exercises.py +++ b/src/coursebox/material/homepage_lectures_exercises.py @@ -4,7 +4,7 @@ from datetime import datetime, timedelta import calendar import pickle import time -from line_profiler_pycharm import profile +# from line_profiler_pycharm import profile from coursebox.thtools_base import partition_list import slider @@ -233,7 +233,7 @@ from pathlib import Path from jinjafy.cache.simplecache import hash_file_ -@profile +# @profile def get_hash_from_base(base): if not os.path.exists(base + "/sharedcache.pkl"): source = {} @@ -262,8 +262,11 @@ def get_hash_from_base(base): actual_files[rel]['hash'] = source[rel]['hash'] return actual_files +def _ensure_target_dir_exists(out): + if not os.path.isdir(os.path.dirname(out)): + os.makedirs(os.path.dirname(out)) -@profile +# @profile def fix_shared(paths, output_dir, pdf2png=False,dosvg=True,verbose=False, compile_templates=True,shallow=True): ''' Copy shared files into lecture directories @@ -272,7 +275,7 @@ def fix_shared(paths, output_dir, pdf2png=False,dosvg=True,verbose=False, compil from jinjafy.cache import cache_contains_file, cache_update_file from slider.convert import svg2pdf, pdfcrop from slider import convert - import filecmp + # import filecmp t0 = time.time() shared_base = paths['shared'] @@ -290,7 +293,7 @@ def fix_shared(paths, output_dir, pdf2png=False,dosvg=True,verbose=False, compil source_extra = {} for rel in source: if rel.endswith(".svg") and source[rel]['modified']: - pdf_file = svg2pdf(shared_base + "/"+rel, crop=True, text_to_path=True, verbose=True) + pdf_file = svg2pdf(shared_base + "/"+rel, crop=True, text_to_path=True) rel = os.path.relpath(pdf_file, shared_base) source_extra[rel] = dict(mtime=os.path.getmtime(pdf_file), hash=hash_file_(pdf_file), modified=True) @@ -300,11 +303,13 @@ def fix_shared(paths, output_dir, pdf2png=False,dosvg=True,verbose=False, compil # update_source_cache = True # Perform sync here. + for rel in source: if rel.endswith("_partial.tex"): continue if rel not in target or target[rel]['hash'] != source[rel]['hash']: + _ensure_target_dir_exists( output_dir + "/" + rel) print(" -> ", output_dir + "/" + rel) shutil.copy(shared_base +"/" + rel, output_dir + "/" + rel) target[rel] = source[rel].copy() @@ -320,8 +325,6 @@ def fix_shared(paths, output_dir, pdf2png=False,dosvg=True,verbose=False, compil target[rel]['hash'] = hash_file_(output_dir + "/" + rel) target[rel]['mtime'] = os.path.getmtime(output_dir + "/" + rel) - # Save the cache. - with open(shared_base + "/sharedcache.pkl", 'wb') as f: pickle.dump(source, f) @@ -551,7 +554,7 @@ def mvfiles(source_dir, dest_dir): if (os.path.isfile(full_file_name)): shutil.copy(full_file_name, os.path.dirname(dest_dir)) -@profile +# @profile def make_webpage(dosvg=True): cinfo = class_information() paths = get_paths() diff --git a/src/coursebox/thtools_base.py b/src/coursebox/thtools_base.py index b04434e2346c92e33939efd49f0dadcb24a5f304..3b42df839167c393b00b998feb3d3bb84c579250 100644 --- a/src/coursebox/thtools_base.py +++ b/src/coursebox/thtools_base.py @@ -9,7 +9,7 @@ def is_win(): return platform.uname()[0].startswith("Windows") -def is_compute():f +def is_compute(): return platform.uname()[1] == "linuxterm1"