Changed the getUserName() function.

Sun, 14 Feb 2010 13:33:03 +0000

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 14 Feb 2010 13:33:03 +0000
changeset 114
f6e7cec11168
parent 113
33afff70d8ee
child 115
13d58f643b43

Changed the getUserName() function.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Utilities.__init__.html file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Sun Feb 14 11:28:47 2010 +0000
+++ b/APIs/Python3/eric5.api	Sun Feb 14 13:33:03 2010 +0000
@@ -5248,7 +5248,6 @@
 eric5.Utilities.parseEnvironmentString?4(s)
 eric5.Utilities.parseOptionString?4(s)
 eric5.Utilities.parseString?4(s, rx)
-eric5.Utilities.posix_GetUserName?4()
 eric5.Utilities.prepareQtMacBundle?4(toolname, version, args)
 eric5.Utilities.pwDecode?4(epw)
 eric5.Utilities.pwEncode?4(pw)
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Sun Feb 14 11:28:47 2010 +0000
+++ b/Documentation/Help/source.qhp	Sun Feb 14 13:33:03 2010 +0000
@@ -2466,7 +2466,6 @@
       <keyword name="parseEnvironmentString" id="parseEnvironmentString" ref="eric5.Utilities.__init__.html#parseEnvironmentString" />
       <keyword name="parseOptionString" id="parseOptionString" ref="eric5.Utilities.__init__.html#parseOptionString" />
       <keyword name="parseString" id="parseString" ref="eric5.Utilities.__init__.html#parseString" />
-      <keyword name="posix_GetUserName" id="posix_GetUserName" ref="eric5.Utilities.__init__.html#posix_GetUserName" />
       <keyword name="prepareQtMacBundle" id="prepareQtMacBundle" ref="eric5.Utilities.__init__.html#prepareQtMacBundle" />
       <keyword name="pwDecode" id="pwDecode" ref="eric5.Utilities.__init__.html#pwDecode" />
       <keyword name="pwEncode" id="pwEncode" ref="eric5.Utilities.__init__.html#pwEncode" />
--- a/Documentation/Source/eric5.Utilities.__init__.html	Sun Feb 14 11:28:47 2010 +0000
+++ b/Documentation/Source/eric5.Utilities.__init__.html	Sun Feb 14 13:33:03 2010 +0000
@@ -167,9 +167,6 @@
 <td><a href="#parseString">parseString</a></td>
 <td>Function used to convert a string into a list.</td>
 </tr><tr>
-<td><a href="#posix_GetUserName">posix_GetUserName</a></td>
-<td>Function to get the user name under Posix systems.</td>
-</tr><tr>
 <td><a href="#prepareQtMacBundle">prepareQtMacBundle</a></td>
 <td>Module function for starting Qt tools that are Mac OS X bundles.</td>
 </tr><tr>
@@ -1065,19 +1062,6 @@
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
-<a NAME="posix_GetUserName" ID="posix_GetUserName"></a>
-<h2>posix_GetUserName</h2>
-<b>posix_GetUserName</b>(<i></i>)
-<p>
-    Function to get the user name under Posix systems.
-</p><dl>
-<dt>Returns:</dt>
-<dd>
-user name (string)
-</dd>
-</dl>
-<div align="right"><a href="#top">Up</a></div>
-<hr /><hr />
 <a NAME="prepareQtMacBundle" ID="prepareQtMacBundle"></a>
 <h2>prepareQtMacBundle</h2>
 <b>prepareQtMacBundle</b>(<i>toolname, version, args</i>)
--- a/Utilities/__init__.py	Sun Feb 14 11:28:47 2010 +0000
+++ b/Utilities/__init__.py	Sun Feb 14 13:33:03 2010 +0000
@@ -14,6 +14,7 @@
 import glob
 import random
 import base64
+import getpass
 
 import warnings
 warnings.filterwarnings("error", category=SyntaxWarning)
@@ -839,10 +840,10 @@
     
     @return user name (string)
     """
-    if isWindowsPlatform():
+    user = getpass.getuser()
+    
+    if not user and isWindowsPlatform():
         return win32_GetUserName()
-    else:
-        return posix_GetUserName()
 
 def getHomeDir():
     """
@@ -1195,21 +1196,7 @@
 # posix compatibility functions below
 ################################################################################
 
-def posix_GetUserName():
-    """
-    Function to get the user name under Posix systems.
-    
-    @return user name (string)
-    """
-    try:
-        import pwd
-        return pwd.getpwuid(os.getuid())[0]
-    except ImportError:
-        try:
-            u = getEnvironmentEntry('USER')
-        except KeyError:
-            u = getEnvironmentEntry('user', None)
-        return u
+# None right now
 
 ################################################################################
 # win32 compatibility functions below

eric ide

mercurial