forked from giuspen/cherrytree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_sources_folder.py
More file actions
executable file
·33 lines (25 loc) · 984 Bytes
/
create_sources_folder.py
File metadata and controls
executable file
·33 lines (25 loc) · 984 Bytes
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
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
import os, sys, shutil, glob, __builtin__
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
MODULES_DIR = os.path.join(SCRIPT_DIR, "modules")
sys.path.insert(0, MODULES_DIR)
__builtin__.SHARE_PATH = SCRIPT_DIR
import cons
BLACKLIST = [".hg", ".hgtags", ".hgignore", ".gitignore"]
DEST_DIR = os.path.join(os.path.dirname(SCRIPT_DIR), "cherrytree-"+cons.VERSION)
if len(sys.argv) > 1:
DEST_DIR += "+r" + sys.argv[1]
#print DEST_DIR
if not os.path.isdir(DEST_DIR):
os.mkdir(DEST_DIR)
for pycfilepath in glob.glob(os.path.join(MODULES_DIR, "*.pyc")):
os.remove(pycfilepath)
for element in os.listdir(SCRIPT_DIR):
if not element in BLACKLIST:
src_abspath = os.path.join(SCRIPT_DIR, element)
dst_abspath = os.path.join(DEST_DIR, element)
if os.path.isdir(src_abspath):
shutil.copytree(src_abspath, dst_abspath)
else:
shutil.copy2(src_abspath, dst_abspath)