Coverage for src/pymyinstall/win_installer/tutorial/__init__.py: 14%

14 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2023-07-19 01:47 +0200

1""" 

2@file 

3@brief Shortcuts to tutorial 

4""" 

5import os 

6 

7 

8def copy_tutorial(name, destination): 

9 """ 

10 copy files and scripts for a specific tutorial 

11 

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 

15 

16 The function will create a sub folder in *destination* 

17 using *name* or the last folder name in *name*. 

18 

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]) 

33 

34 if not os.path.exists(dest): 

35 os.mkdir(dest) 

36 

37 return synchronize_folder(fold, dest)