summaryrefslogtreecommitdiff
path: root/scripts/template_verifier.py
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2010-01-15 12:35:10 +0200
committerMike Antipov <mantipov@productengine.com>2010-01-15 12:35:10 +0200
commit3cf98103561d79a6758bbb57662e1dc2e4a5198c (patch)
tree492ca7bd797c34ed29e927e649c5aa3582ff9f49 /scripts/template_verifier.py
parenteb12963eec5ffad5c8be59e97301fa98ef4dda7a (diff)
parent30a47979a13af8d6c3e89ce5dddb5d7c37011012 (diff)
Merge with default branch
--HG-- branch : product-engine
Diffstat (limited to 'scripts/template_verifier.py')
-rwxr-xr-xscripts/template_verifier.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/template_verifier.py b/scripts/template_verifier.py
index 8bb5e1d76d..d5fc119270 100755
--- a/scripts/template_verifier.py
+++ b/scripts/template_verifier.py
@@ -203,8 +203,13 @@ def getuser():
import getpass
return getpass.getuser()
except ImportError:
- import win32api
- return win32api.GetUserName()
+ import ctypes
+ MAX_PATH = 260 # according to a recent WinDef.h
+ name = ctypes.create_unicode_buffer(MAX_PATH)
+ namelen = ctypes.c_int(len(name)) # len in chars, NOT bytes
+ if not ctypes.windll.advapi32.GetUserNameW(name, ctypes.byref(namelen)):
+ raise ctypes.WinError()
+ return name.value
def local_master_cache_filename():
"""Returns the location of the master template cache (which is in the system tempdir)