[pypy-commit] pypy default: Include the user name in the temporary directory
arigo
noreply at buildbot.pypy.org
Tue Jun 17 09:49:50 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r72084:66e58e7fdc2b
Date: 2014-06-17 09:46 +0200
http://bitbucket.org/pypy/pypy/changeset/66e58e7fdc2b/
Log: Include the user name in the temporary directory
diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -13,7 +13,15 @@
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
More information about the pypy-commit
mailing list