Extended the search for pyuic[45] to cope with the way openSUSE does it. They name it py[23]uic[45].

Fri, 15 Sep 2017 19:41:33 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 15 Sep 2017 19:41:33 +0200
changeset 5878
74d02cd37185
parent 5877
42482d9025af
child 5879
cb3e20c44546

Extended the search for pyuic[45] to cope with the way openSUSE does it. They name it py[23]uic[45].

APIs/Python3/eric6.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Source/eric6.Utilities.__init__.html file | annotate | diff | comparison | revisions
Preferences/ProgramsDialog.py file | annotate | diff | comparison | revisions
Project/ProjectFormsBrowser.py file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric6.api	Tue Sep 05 19:32:23 2017 +0200
+++ b/APIs/Python3/eric6.api	Fri Sep 15 19:41:33 2017 +0200
@@ -9217,7 +9217,7 @@
 eric6.Utilities.fromNativeSeparators?4(path)
 eric6.Utilities.generateDistroInfo?4(linesep='\n')
 eric6.Utilities.generatePluginsVersionInfo?4(linesep='\n')
-eric6.Utilities.generatePyQtToolPath?4(toolname)
+eric6.Utilities.generatePyQtToolPath?4(toolname, alternatives=None)
 eric6.Utilities.generatePySideToolPath?4(toolname)
 eric6.Utilities.generateQtToolName?4(toolname)
 eric6.Utilities.generateVersionInfo?4(linesep='\n')
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Source/eric6.Utilities.__init__.html	Tue Sep 05 19:32:23 2017 +0200
+++ b/Documentation/Source/eric6.Utilities.__init__.html	Fri Sep 15 19:41:33 2017 +0200
@@ -824,13 +824,16 @@
 <hr /><hr />
 <a NAME="generatePyQtToolPath" ID="generatePyQtToolPath"></a>
 <h2>generatePyQtToolPath</h2>
-<b>generatePyQtToolPath</b>(<i>toolname</i>)
+<b>generatePyQtToolPath</b>(<i>toolname, alternatives=None</i>)
 <p>
     Module function to generate the executable path for a PyQt tool.
 </p><dl>
 <dt><i>toolname</i> (str)</dt>
 <dd>
 base name of the tool
+</dd><dt><i>alternatives</i> (list of str)</dt>
+<dd>
+list of alternative tool names to try
 </dd>
 </dl><dl>
 <dt>Returns:</dt>
--- a/Preferences/ProgramsDialog.py	Tue Sep 05 19:32:23 2017 +0200
+++ b/Preferences/ProgramsDialog.py	Fri Sep 15 19:41:33 2017 +0200
@@ -143,7 +143,7 @@
         # 2.1b. Forms Compiler PyQt4
         self.__createProgramEntry(
             self.tr("Forms Compiler (Python, PyQt4)"),
-            Utilities.generatePyQtToolPath("pyuic4"),
+            Utilities.generatePyQtToolPath("pyuic4", ["py3uic4", "py2uic4"]),
             '--version', 'Python User', 4)
         # 2.1c. Resource Compiler PyQt4
         self.__createProgramEntry(
@@ -160,7 +160,7 @@
         # 2.2b. Forms Compiler PyQt5
         self.__createProgramEntry(
             self.tr("Forms Compiler (Python, PyQt5)"),
-            Utilities.generatePyQtToolPath("pyuic5"),
+            Utilities.generatePyQtToolPath("pyuic5", ["py3uic5", "py2uic5"]),
             '--version', 'Python User', 4)
         # 2.2c. Resource Compiler PyQt5
         self.__createProgramEntry(
--- a/Project/ProjectFormsBrowser.py	Tue Sep 05 19:32:23 2017 +0200
+++ b/Project/ProjectFormsBrowser.py	Fri Sep 15 19:41:33 2017 +0200
@@ -745,14 +745,18 @@
         if self.project.getProjectLanguage() in \
                 ["Python", "Python2", "Python3"]:
             if self.project.getProjectType() in ["Qt4", ]:
-                self.uicompiler = Utilities.generatePyQtToolPath('pyuic4')
+                self.uicompiler = Utilities.generatePyQtToolPath(
+                    'pyuic4', ["py3uic4", "py2uic4"])
             elif self.project.getProjectType() in ["PyQt5"]:
-                self.uicompiler = Utilities.generatePyQtToolPath('pyuic5')
+                self.uicompiler = Utilities.generatePyQtToolPath(
+                    'pyuic5', ["py3uic5", "py2uic5"])
             elif self.project.getProjectType() in ["E6Plugin"]:
                 if PYQT_VERSION < 0x050000:
-                    self.uicompiler = Utilities.generatePyQtToolPath('pyuic4')
+                    self.uicompiler = Utilities.generatePyQtToolPath(
+                        'pyuic4', ["py3uic4", "py2uic4"])
                 else:
-                    self.uicompiler = Utilities.generatePyQtToolPath('pyuic5')
+                    self.uicompiler = Utilities.generatePyQtToolPath(
+                        'pyuic5', ["py3uic5", "py2uic5"])
             elif self.project.getProjectType() == "PySide":
                 self.uicompiler = \
                     Utilities.generatePySideToolPath('pyside-uic')
--- a/Utilities/__init__.py	Tue Sep 05 19:32:23 2017 +0200
+++ b/Utilities/__init__.py	Fri Sep 15 19:41:33 2017 +0200
@@ -1693,12 +1693,14 @@
 ###############################################################################
 
 
-def generatePyQtToolPath(toolname):
+def generatePyQtToolPath(toolname, alternatives=None):
     """
     Module function to generate the executable path for a PyQt tool.
     
     @param toolname base name of the tool
     @type str
+    @param alternatives list of alternative tool names to try
+    @type list of str
     @return executable path name of the tool
     @rtype str
     """
@@ -1713,6 +1715,12 @@
             exe = getWindowsExecutablePath(toolname)
         else:
             exe = toolname
+    
+    if not isinpath(exe) and alternatives:
+        ex_ = generatePyQtToolPath(alternatives[0], alternatives[1:])
+        if isinpath(ex_):
+            exe = ex_
+    
     return exe
 
 ###############################################################################

eric ide

mercurial