forked from ncsu-geoforall-lab/tangible-landscape-talk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy-common-files.py
executable file
·45 lines (33 loc) · 1.24 KB
/
copy-common-files.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
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
# builds pages from source
from __future__ import print_function
import os
import sys
import shutil
import argparse
import re
def error_message(*objs):
print("ERROR: ", *objs, file=sys.stderr)
def main():
directories = ['css', 'js', 'lib', 'plugin']
parser = argparse.ArgumentParser(
description='Copies the common files for all presentations to one directory')
parser.add_argument('--src-dir', dest='common_srcdir', action='store',
help='Directory with common files to copy from')
parser.add_argument('--dst-dir', dest='common_dstdir', action='store',
required=True,
help='Directory to copy common files to')
args = parser.parse_args()
srcdir = args.common_srcdir
dstdir = args.common_dstdir
if os.path.abspath(dstdir) != os.getcwd():
for directory in directories:
if srcdir:
directory = os.path.join(srcdir, directory)
destination = os.path.join(dstdir, directory)
if os.path.exists(destination):
shutil.rmtree(destination)
shutil.copytree(directory, destination)
return 0
if __name__ == '__main__':
sys.exit(main())