Hide keyboard shortcuts

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 Helpers around static files. 

4""" 

5import os 

6import shutil 

7 

8 

9def copy_static(dest): 

10 """ 

11 Copy static files into *dest/static*. 

12 """ 

13 dst = os.path.join(dest, "static") 

14 if not os.path.exists(dst): 

15 os.mkdir(dst) 

16 this = os.path.dirname(__file__) 

17 copied = 0 

18 for name in os.listdir(this): 

19 if os.path.splitext(name)[-1] in {'.png', '.ico', '.css', '.js'}: 

20 shutil.copy(os.path.join(this, name), dst) 

21 copied += 1 

22 if copied == 0: 

23 raise ValueError("No file found in '{0}'.".format(this))