summaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
authorRama Krishnan Raghupathy <ramarag@microsoft.com>2015-12-30 20:16:02 -0800
committerDDCloud <ramarag@microsoft.com>2015-12-31 12:58:27 -0800
commit466edeb78359da01422e165fbd81285091c74c03 (patch)
tree16a96807112022fdb15853fca17b46b98be0bb5a /src/scripts
parent908bdd9db9ce3680301004b62fd42f58b8984b97 (diff)
downloadcoreclr-466edeb78359da01422e165fbd81285091c74c03.tar.gz
coreclr-466edeb78359da01422e165fbd81285091c74c03.tar.bz2
coreclr-466edeb78359da01422e165fbd81285091c74c03.zip
Enable Incremental build For Generated Files
Diffstat (limited to 'src/scripts')
-rw-r--r--src/scripts/Utilities.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/scripts/Utilities.py b/src/scripts/Utilities.py
new file mode 100644
index 0000000000..0de1cafdbd
--- /dev/null
+++ b/src/scripts/Utilities.py
@@ -0,0 +1,48 @@
+from filecmp import dircmp
+import shutil
+import os
+
+def walk_recursively_and_update(dcmp):
+ #for different Files Copy from right to left
+ for name in dcmp.diff_files:
+ srcpath = dcmp.right + "/" + name
+ destpath = dcmp.left + "/" + name
+ print "Updating %s" % (destpath)
+ if os.path.isfile(srcpath):
+ shutil.copyfile(srcpath, destpath)
+ else :
+ raise Exception("path: " + srcpath + "is neither a file or folder")
+
+ #copy right only files
+ for name in dcmp.right_only:
+ srcpath = dcmp.right + "/" + name
+ destpath = dcmp.left + "/" + name
+ print "Updating %s" % (destpath)
+ if os.path.isfile(srcpath):
+ shutil.copyfile(srcpath, destpath)
+ elif os.path.isdir(srcpath):
+ shutil.copytree(srcpath, destpath)
+ else :
+ raise Exception("path: " + srcpath + "is neither a file or folder")
+
+ #delete left only files
+ for name in dcmp.left_only:
+ path = dcmp.left + "/" + name
+ print "Deleting " % (path)
+ if os.path.isfile(path):
+ os.remove(path)
+ elif os.path.isdir(path):
+ shutil.rmtree(path)
+ else :
+ raise Exception("path: " + path + "is neither a file or folder")
+
+ #call recursively
+ for sub_dcmp in dcmp.subdirs.values():
+ walk_recursively_and_update(sub_dcmp)
+
+def UpdateDirectory(destpath,srcpath):
+
+ if not os.path.exists(destpath):
+ os.makedirs(destpath)
+ dcmp = dircmp(destpath,srcpath)
+ walk_recursively_and_update(dcmp)