PluginPyInstaller.py

changeset 27
25ff8953e335
parent 26
e4135114d483
child 28
3c8dbc198753
--- a/PluginPyInstaller.py	Wed Jan 01 11:58:56 2020 +0100
+++ b/PluginPyInstaller.py	Mon May 04 18:15:28 2020 +0200
@@ -17,8 +17,9 @@
 import platform
 import shutil
 
-from PyQt5.QtCore import pyqtSlot, QObject, QCoreApplication, QTranslator, \
-    QProcess
+from PyQt5.QtCore import (
+    pyqtSlot, QObject, QCoreApplication, QTranslator, QProcess
+)
 from PyQt5.QtWidgets import QDialog
 
 from E5Gui import E5MessageBox
@@ -32,7 +33,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "1.0.2"
+version = "1.1.0"
 className = "PyInstallerPlugin"
 packageName = "PyInstaller"
 shortDescription = "Show dialogs to configure and execute PyInstaller."
@@ -71,7 +72,7 @@
         "versionPosition": -1,
         "version": "",
         "versionCleanup": None,
-        "versionRe": "^\d",
+        "versionRe": "^\\d",
     }
     
     if _checkProgram():
@@ -161,6 +162,18 @@
                         winreg.KEY_WOW64_64KEY | winreg.KEY_READ, versionStr)
                     for exePath in exePaths:
                         executables.add(exePath)
+        
+        if not executables and majorVersion >= 3:
+            # check the PATH environment variable if nothing was found
+            # Python 3 only
+            path = Utilities.getEnvironmentEntry('PATH')
+            if path:
+                dirs = path.split(os.pathsep)
+                for directory in dirs:
+                    for prog in ("pyinstaller.exe", "pyi-makespec.exe"):
+                        exe = os.path.join(directory, prog)
+                        if os.access(exe, os.X_OK):
+                            executables.add(exe)
     else:
         #
         # Linux, Unix ...
@@ -374,8 +387,8 @@
         @type QMenu
         """
         if menuName == "Packagers":
-            enable = e5App().getObject("Project").getProjectLanguage() in \
-                ["Python", "Python2", "Python3"]
+            enable = e5App().getObject("Project").getProjectLanguage() in [
+                "Python", "Python2", "Python3"]
             for act in self.__projectActs:
                 act.setEnabled(enable)
     
@@ -386,9 +399,8 @@
         if self.__ui is not None:
             loc = self.__ui.getLocale()
             if loc and loc != "C":
-                locale_dir = \
-                    os.path.join(os.path.dirname(__file__),
-                                 "PyInstaller", "i18n")
+                locale_dir = os.path.join(os.path.dirname(__file__),
+                                          "PyInstaller", "i18n")
                 translation = "pyinstaller_{0}".format(loc)
                 translator = QTranslator(None)
                 loaded = translator.load(translation, locale_dir)
@@ -489,8 +501,9 @@
         """
         project = e5App().getObject("Project")
         
-        from PyInstaller.PyInstallerCleanupDialog import \
+        from PyInstaller.PyInstallerCleanupDialog import (
             PyInstallerCleanupDialog
+        )
         dlg = PyInstallerCleanupDialog()
         if dlg.exec_() == QDialog.Accepted:
             removeDirs = dlg.getDirectories()

eric ide

mercurial