summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2010-01-14 16:47:46 -0500
committerNat Goodspeed <nat@lindenlab.com>2010-01-14 16:47:46 -0500
commit7aaf9919034e2097f27b7e99f3920a66d9a093ef (patch)
treec8ebe2828e05cc8df73f171182299873db833c0e
parent23a266521ead539cb3e8c2c76e7ead46847b70ca (diff)
parent5c0f263403ebd213c325f7d9f41c65f150a8153a (diff)
Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0/
-rwxr-xr-xscripts/install.py9
-rwxr-xr-xscripts/template_verifier.py9
2 files changed, 14 insertions, 4 deletions
diff --git a/scripts/install.py b/scripts/install.py
index 78b8880b95..7368af0b37 100755
--- a/scripts/install.py
+++ b/scripts/install.py
@@ -793,8 +793,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 _default_installable_cache():
"""In general, the installable files do not change much, so find a
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)