summaryrefslogtreecommitdiff
path: root/scripts/template_verifier.py
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2010-01-14 16:46:20 -0500
committerNat Goodspeed <nat@lindenlab.com>2010-01-14 16:46:20 -0500
commit5c0f263403ebd213c325f7d9f41c65f150a8153a (patch)
tree0518f4b369505c9743638cf6bf618ad8cda51fc5 /scripts/template_verifier.py
parent86d1b0b67eb8901c269f7710606ef97c84732348 (diff)
Replace scripts dependency on win32api module with bundled ctypes.
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)