aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2014-06-17 09:46:48 +0200
committerArmin Rigo <arigo@tunes.org>2014-06-17 09:46:48 +0200
commitfb96ec0099ffc7a967a930eb6197b4546bcf8e64 (patch)
tree969c9280d733569a85c491597a5af9f9f48d0ab6 /lib_pypy/_pypy_testcapi.py
parentadd default value (diff)
downloadpypy-fb96ec0099ffc7a967a930eb6197b4546bcf8e64.tar.gz
pypy-fb96ec0099ffc7a967a930eb6197b4546bcf8e64.tar.bz2
pypy-fb96ec0099ffc7a967a930eb6197b4546bcf8e64.zip
Include the user name in the temporary directory
Diffstat (limited to 'lib_pypy/_pypy_testcapi.py')
-rw-r--r--lib_pypy/_pypy_testcapi.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
index 9edc20b5b0..be237e8d72 100644
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -13,7 +13,15 @@ def get_hashed_dir(cfile):
k1 = k1.lstrip('0x').rstrip('L')
k2 = hex(binascii.crc32(key[1::2]) & 0xffffffff)
k2 = k2.lstrip('0').rstrip('L')
- output_dir = tempfile.gettempdir() + os.path.sep + 'tmp_%s%s' %(k1, k2)
+ try:
+ username = os.environ['USER'] #linux, et al
+ except KeyError:
+ try:
+ username = os.environ['USERNAME'] #windows
+ except KeyError:
+ username = os.getuid()
+ output_dir = tempfile.gettempdir() + os.path.sep + 'tmp_%s_%s%s' % (
+ username, k1, k2)
if not os.path.exists(output_dir):
os.mkdir(output_dir)
return output_dir