Skip to content

Commit

Permalink
Properly copies exam subfolders, part of fix for #61 and #44
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLeoni committed Jul 11, 2021
1 parent 324ba67 commit 697a475
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
6 changes: 4 additions & 2 deletions _templates/exam/solutions/exam-yyyy-mm-dd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
"source": [
"## Introduction\n",
"\n",
"* **Taking part to this exam erases any vote you had before**"
"* **Taking part to this exam erases any vote you had before**\n",
"\n",
"![](img/mountains.jpg)"
]
},
{
Expand Down Expand Up @@ -436,7 +438,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.10"
},
"toc": {
"base_numbering": 1,
Expand Down
21 changes: 10 additions & 11 deletions jupman_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,20 +1056,20 @@ def copy_code(self, source_dir, dest_dir, copy_solutions=False):

# creating folders
for dirpath, dirnames, filenames in os.walk(source_dir):

compath = os.path.commonpath([dirpath, source_dir])
dest_dir = os.path.join(dest_dir, dirpath[len(compath)+1:])
if not self.is_zip_ignored(dest_dir):
if not os.path.isdir(dest_dir) :
info("Creating dir %s" % dest_dir)
os.makedirs(dest_dir)



dest_subdir = os.path.join(dest_dir, dirpath[len(compath)+1:])

if not self.is_zip_ignored(dest_subdir):
if not os.path.isdir(dest_subdir) :
info("Creating dir %s" % dest_subdir)
os.makedirs(dest_subdir)

for source_fn in filenames:
if not self.is_zip_ignored(source_fn):

source_abs_fn = os.path.join(dirpath,source_fn)
dest_fn = os.path.join(dest_dir , source_fn)
dest_fn = os.path.join(dest_subdir , source_fn)
fileKind = FileKinds.detect(source_fn)

if fileKind == FileKinds.CHALLENGE_SOLUTION:
Expand All @@ -1086,7 +1086,7 @@ def copy_code(self, source_dir, dest_dir, copy_solutions=False):
if FileKinds.is_supported_ext( source_fn,
self.distrib_ext):
self.generate_exercise( os.path.join(dirpath,source_fn),
dest_dir=dest_dir)
dest_dir=dest_subdir)


elif fileKind == FileKinds.TEST:
Expand All @@ -1098,7 +1098,6 @@ def copy_code(self, source_dir, dest_dir, copy_solutions=False):
source_fn,
dest_fn)


def _common_files_maps(self, zip_name):
"""
@since 3.2 Created in order to make exam.py work
Expand Down

0 comments on commit 697a475

Please sign in to comment.