[pypy-svn] r17719 - pypy/dist/pypy/tool

ericvrp at codespeak.net ericvrp at codespeak.net
Wed Sep 21 15:37:20 CEST 2005


Author: ericvrp
Date: Wed Sep 21 15:37:15 2005
New Revision: 17719

Modified:
   pypy/dist/pypy/tool/udir.py
Log:
Renamed /tmp/usession-current to /tmp/usession-<username> when available.
Still use /tmp/usession-current symlink when username unavailable.

The 'current' name was causing problems on multiuser systems where only
one user owns the symlink and others can not change it.


Modified: pypy/dist/pypy/tool/udir.py
==============================================================================
--- pypy/dist/pypy/tool/udir.py	(original)
+++ pypy/dist/pypy/tool/udir.py	Wed Sep 21 15:37:15 2005
@@ -5,14 +5,23 @@
 #
 
 import autopath
+import os
 
 from py.path import local 
 
 udir = local.make_numbered_dir(prefix='usession-', keep=3)
 
+try:
+    username = os.environ['LOGNAME']        #linux, et al
+except:
+    try:
+        username = os.environ['USERNAME']   #windows
+    except:
+        username = 'current'
+
 import os
 src  = str(udir)
-dest = src[:src.rfind('-')] + '-current'
+dest = src[:src.rfind('-')] + '-' + username
 try:
     os.unlink(dest)
 except:



More information about the Pypy-commit mailing list