Merged remote changes.

Mon, 01 Apr 2013 17:53:25 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 01 Apr 2013 17:53:25 +0200
changeset 2556
425b01c6a69d
parent 2555
e7a799c3b9c6 (current diff)
parent 2553
2ef00ee163a8 (diff)
child 2559
56b91939d319

Merged remote changes.

--- a/APIs/Python3/eric5.api	Mon Apr 01 17:52:35 2013 +0200
+++ b/APIs/Python3/eric5.api	Mon Apr 01 17:53:25 2013 +0200
@@ -8023,6 +8023,7 @@
 eric5.Utilities.getDirs?4(path, excludeDirs)
 eric5.Utilities.getEnvironmentEntry?4(key, default=None)
 eric5.Utilities.getExecutablePath?4(file)
+eric5.Utilities.getExecutablePaths?4(file)
 eric5.Utilities.getHomeDir?4()
 eric5.Utilities.getPercentReplacement?4(code)
 eric5.Utilities.getPercentReplacementHelp?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Mon Apr 01 17:52:35 2013 +0200
+++ b/Documentation/Help/source.qhp	Mon Apr 01 17:53:25 2013 +0200
@@ -12453,6 +12453,7 @@
       <keyword name="getEditorTyping" id="getEditorTyping" ref="eric5.Preferences.__init__.html#getEditorTyping" />
       <keyword name="getEnvironmentEntry" id="getEnvironmentEntry" ref="eric5.Utilities.__init__.html#getEnvironmentEntry" />
       <keyword name="getExecutablePath" id="getExecutablePath" ref="eric5.Utilities.__init__.html#getExecutablePath" />
+      <keyword name="getExecutablePaths" id="getExecutablePaths" ref="eric5.Utilities.__init__.html#getExecutablePaths" />
       <keyword name="getExistingDirectory" id="getExistingDirectory" ref="eric5.E5Gui.E5FileDialog.html#getExistingDirectory" />
       <keyword name="getExporter" id="getExporter" ref="eric5.QScintilla.Exporters.__init__.html#getExporter" />
       <keyword name="getFileNameFromUrl" id="getFileNameFromUrl" ref="eric5.Helpviewer.HelpUtilities.html#getFileNameFromUrl" />
--- a/Documentation/Source/eric5.Utilities.__init__.html	Mon Apr 01 17:52:35 2013 +0200
+++ b/Documentation/Source/eric5.Utilities.__init__.html	Mon Apr 01 17:53:25 2013 +0200
@@ -112,6 +112,9 @@
 <td><a href="#getExecutablePath">getExecutablePath</a></td>
 <td>Function to build the full path of an executable file from the environment.</td>
 </tr><tr>
+<td><a href="#getExecutablePaths">getExecutablePaths</a></td>
+<td>Function to build all full path of an executable file from the environment.</td>
+</tr><tr>
 <td><a href="#getHomeDir">getHomeDir</a></td>
 <td>Function to get a users home directory</td>
 </tr><tr>
@@ -823,6 +826,26 @@
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
+<a NAME="getExecutablePaths" ID="getExecutablePaths"></a>
+<h2>getExecutablePaths</h2>
+<b>getExecutablePaths</b>(<i>file</i>)
+<p>
+    Function to build all full path of an executable file from the environment.
+</p><dl>
+<dt><i>file</i></dt>
+<dd>
+filename of the executable (string)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+list of full executable names (list of strings), if the executable file
+        is accessible via the searchpath defined by the PATH environment variable,
+        or an empty list otherwise.
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
 <a NAME="getHomeDir" ID="getHomeDir"></a>
 <h2>getHomeDir</h2>
 <b>getHomeDir</b>(<i></i>)
--- a/Utilities/__init__.py	Mon Apr 01 17:52:35 2013 +0200
+++ b/Utilities/__init__.py	Mon Apr 01 17:53:25 2013 +0200
@@ -769,6 +769,41 @@
     return ""
     
 
+def getExecutablePaths(file):
+    """
+    Function to build all full path of an executable file from the environment.
+    
+    @param file filename of the executable (string)
+    @return list of full executable names (list of strings), if the executable file
+        is accessible via the searchpath defined by the PATH environment variable,
+        or an empty list otherwise.
+    """
+    paths = []
+    
+    if os.path.isabs(file):
+        if os.access(file, os.X_OK):
+            return [file]
+        else:
+            return []
+        
+    cur_path = os.path.join(os.curdir, file)
+    if os.path.exists(cur_path):
+        if os.access(cur_path, os.X_OK):
+            paths.append(cur_path)
+
+    path = os.getenv('PATH')
+    
+    # environment variable not defined
+    if path is not None:
+        dirs = path.split(os.pathsep)
+        for dir in dirs:
+            exe = os.path.join(dir, file)
+            if os.access(exe, os.X_OK) and exe not in paths:
+                paths.append(exe)
+    
+    return paths
+    
+
 def isExecutable(exe):
     """
     Function to check, if a file is executable.

eric ide

mercurial