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 Copies files to the proper location.
4"""
6import os
7from pyquickhelper.filehelper import synchronize_folder
10def copy_jstool2notebook(tool, force=False):
11 """
12 Copies a tool to :epkg:`notebook` folder.
14 @param tool tool name (snap for example)
15 @param force do the copy even if the destination folder exists
16 @return list of copied files
17 """
18 import notebook
19 dest = os.path.join(os.path.dirname(notebook.__file__), "static")
20 src = os.path.join(os.path.dirname(__file__), tool)
21 if not os.path.exists(src):
22 raise FileNotFoundError("unable to find tool: " + tool)
23 dest = os.path.join(dest, tool)
24 if not os.path.exists(dest):
25 os.mkdir(dest)
26 return synchronize_folder(src, dest)
27 elif force:
28 return synchronize_folder(src, dest)
29 else:
30 return None