+def install(source, target):
+ if not source:
+ return
+
+ if os.path.isdir(source):
+ if not target:
+ target = source
+ buildtarget = pathjoin(__BUILD__, target)
+ parentdir = os.path.normpath(pathjoin(buildtarget, '..'))
+ if not os.path.isdir(parentdir):
+ os.makedirs(parentdir)
+ shutil.copytree(source, buildtarget)
+
+ elif os.path.exists(source):
+ if not target:
+ target = os.path.dirname(source)
+ buildtarget = os.path.normpath(pathjoin(__BUILD__, target))
+ if not os.path.isdir(buildtarget):
+ os.makedirs(buildtarget)
+ shutil.copy(source, buildtarget)
+
+ else:
+ for item in glob.glob(source):
+ install(item, target)
+
+def main():
+ if os.path.isdir(__BUILD__):
+ shutil.rmtree(__BUILD__, False)
+
+ genscripts()
+