forked from jclapis/quantum-course-labs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage_exercises.py
33 lines (29 loc) · 888 Bytes
/
package_exercises.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Script to package the course exercises in a .zip file
# Copyright 2021 The MITRE Corporation. All Rights Reserved.
import errno
import glob
import os
import shutil
INCLUDES = [
'Intro to Quantum Software Development.sln',
'global.json',
'CSharpExercises/CSharpExercises.csproj',
'CSharpExercises/Exercises.cs',
'CSharpExercises/Tests.cs',
'QSharpExercises/QSharpExercises.csproj',
'QSharpExercises/*.qs',
'QSharpExercises/Tests/*',
'ConsoleSandbox/*'
]
for path in INCLUDES:
for src in glob.glob(path):
dst = 'tmp/' + src
os.makedirs(os.path.dirname(dst), exist_ok=True)
try:
shutil.copytree(src, dst)
except OSError as exc:
if exc.errno == errno.ENOTDIR:
shutil.copy(src, dst)
else: raise
shutil.make_archive('exercises', 'zip', 'tmp')
shutil.rmtree('tmp')