Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2@file
3@brief Shortcuts to tutorial
4"""
5import os
8def copy_tutorial(name, destination):
9 """
10 copy files and scripts for a specific tutorial
12 @param name tutorial name or folder
13 @param destination destination
14 @return list of operations done by the function list of 3-uple: action, source_file, dest_file
16 The function will create a sub folder in *destination*
17 using *name* or the last folder name in *name*.
19 This function requires modules
20 `pyquickhelper <http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/>`_.
21 """
22 from pyquickhelper.filehelper import synchronize_folder
23 if os.path.exists(name):
24 dest = os.path.join(destination, name)
25 else:
26 this = os.path.abspath(os.path.dirname(__file__))
27 fold = os.path.join(this, name)
28 if not os.path.exists(fold):
29 raise FileNotFoundError(
30 "unable to find tutorial {0}\n{1} not here".format(name, fold))
31 spl = os.path.split(fold)
32 dest = os.path.join(destination, spl[-1])
34 if not os.path.exists(dest):
35 os.mkdir(dest)
37 return synchronize_folder(fold, dest)