aboutsummaryrefslogtreecommitdiff
path: root/win/wb.py
diff options
context:
space:
mode:
authorJames Yonan <james@openvpn.net>2010-08-20 20:24:42 +0000
committerJames Yonan <james@openvpn.net>2010-08-20 20:24:42 +0000
commit5f866d914c71f010988fd85d5b178f3b8c3e2987 (patch)
tree88c2699ab799ac3270e0e8510867e89b60dc233c /win/wb.py
parentWindows security issue: (diff)
downloadopenvpn-2.1.3.tar.xz
Attempt to fix issue where domake-win build system was not properlyv2.1.3
signing drivers and .exe files. Added win/tap_span.py for building multiple versions of the TAP driver and tapinstall binaries using different DDK versions to span from Win2K to Win7 and beyond. Version 2.1.3 git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@6404 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'win/wb.py')
-rw-r--r--win/wb.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/win/wb.py b/win/wb.py
index 7c2c8b9..8e23684 100644
--- a/win/wb.py
+++ b/win/wb.py
@@ -1,7 +1,7 @@
# Python module containing general build functions
# for OpenVPN on Windows
-import os, re, shutil
+import os, re, shutil, stat
autogen = "Automatically generated by OpenVPN Windows build system"
@@ -182,4 +182,34 @@ def cp(src, dest, dest_is_dir=True):
print "COPY %s %s" % (src, dest)
shutil.copyfile(src, dest)
+def rm_rf(path):
+ try:
+ shutil.rmtree(path, onerror=onerror)
+ except:
+ pass
+
+def onerror(func, path, exc_info):
+ """
+ Error handler for ``shutil.rmtree``.
+
+ If the error is due to an access error (read only file)
+ it attempts to add write permission and then retries.
+
+ If the error is for another reason it re-raises the error.
+
+ Usage : ``shutil.rmtree(path, onerror=onerror)``
+ """
+ if not os.access(path, os.W_OK):
+ # Is the error an access error ?
+ os.chmod(path, stat.S_IWUSR)
+ func(path)
+ else:
+ raise
+
+def mkdir_silent(dir):
+ try:
+ os.mkdir(dir)
+ except:
+ pass
+
config = get_config()