Mon, 04 May 2020 18:15:28 +0200
Added code to search the executable in virtual environment as well on Windows platforms.
--- a/ChangeLog Wed Jan 01 11:58:56 2020 +0100 +++ b/ChangeLog Mon May 04 18:15:28 2020 +0200 @@ -1,5 +1,9 @@ ChangeLog --------- +Version 1.1.0: +- added code to search the executable in virtual environment as well on + Windows platforms + Version 1.0.2: - updated Russion translations
--- a/PluginPyInstaller.e4p Wed Jan 01 11:58:56 2020 +0100 +++ b/PluginPyInstaller.e4p Mon May 04 18:15:28 2020 +0200 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Project SYSTEM "Project-5.1.dtd"> <!-- eric project file for project PluginPyInstaller --> -<!-- Copyright (C) 2018 Detlev Offenbach, detlev@die-offenbachs.de --> +<!-- Copyright (C) 2020 Detlev Offenbach, detlev@die-offenbachs.de --> <Project version="5.1"> <Language>en_US</Language> <Hash>3a7e5bc36f1ae73d45efc807f5aeb2c0236daa13</Hash> @@ -234,6 +234,34 @@ <value> <dict> <key> + <string>AnnotationsChecker</string> + </key> + <value> + <dict> + <key> + <string>MaximumComplexity</string> + </key> + <value> + <int>3</int> + </value> + <key> + <string>MinimumCoverage</string> + </key> + <value> + <int>75</int> + </value> + </dict> + </value> + <key> + <string>BlankLines</string> + </key> + <value> + <tuple> + <int>2</int> + <int>1</int> + </tuple> + </value> + <key> <string>BuiltinsChecker</string> </key> <value> @@ -265,6 +293,19 @@ </dict> </value> <key> + <string>CommentedCodeChecker</string> + </key> + <value> + <dict> + <key> + <string>Aggressive</string> + </key> + <value> + <bool>False</bool> + </value> + </dict> + </value> + <key> <string>CopyrightAuthor</string> </key> <value> @@ -292,7 +333,7 @@ <string>ExcludeMessages</string> </key> <value> - <string>C101, E265, E266, E305, E402, M811, N802, N803, N807, N808, N821, W293, M201</string> + <string>A, C101, E265, E266, E305, E402, M201, M811, N802, N803, N807, N808, N821, W293, W504</string> </value> <key> <string>FixCodes</string> @@ -343,6 +384,12 @@ <int>10</int> </value> <key> + <string>MaxDocLineLength</string> + </key> + <value> + <int>79</int> + </value> + <key> <string>MaxLineLength</string> </key> <value>
--- 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()
--- a/PyInstaller/PyInstallerConfigDialog.py Wed Jan 01 11:58:56 2020 +0100 +++ b/PyInstaller/PyInstallerConfigDialog.py Mon May 04 18:15:28 2020 +0200 @@ -211,17 +211,22 @@ parms["name"] = self.__parameters["name"] args.append("--name") args.append(self.__parameters["name"]) - if self.__parameters["encryptionKey"] != \ - self.__defaults["encryptionKey"]: + if ( + self.__parameters["encryptionKey"] != + self.__defaults["encryptionKey"] + ): parms["encryptionKey"] = self.__parameters["encryptionKey"] args.append("--key") args.append(self.__parameters["encryptionKey"]) # 2.3 Windows and macOS options - if self.__parameters["consoleApplication"] != \ - self.__defaults["consoleApplication"]: - parms["consoleApplication"] = \ + if ( + self.__parameters["consoleApplication"] != + self.__defaults["consoleApplication"] + ): + parms["consoleApplication"] = ( self.__parameters["consoleApplication"] + ) args.append("--windowed") if self.__parameters["iconFile"] != self.__defaults["iconFile"]: parms["iconFile"] = self.__parameters["iconFile"] @@ -238,18 +243,24 @@ args.append(self.__parameters["iconFile"]) # 2.4 macOS specific options - if self.__parameters["bundleIdentifier"] != \ - self.__defaults["bundleIdentifier"]: - parms["bundleIdentifier"] = \ + if ( + self.__parameters["bundleIdentifier"] != + self.__defaults["bundleIdentifier"] + ): + parms["bundleIdentifier"] = ( self.__parameters["bundleIdentifier"] + ) args.append("--osx-bundle-identifier") args.append(self.__parameters["bundleIdentifier"]) # 2.5 general options, part 2 - if self.__parameters["cleanBeforeBuilding"] != \ - self.__defaults["cleanBeforeBuilding"]: - parms["cleanBeforeBuilding"] = \ + if ( + self.__parameters["cleanBeforeBuilding"] != + self.__defaults["cleanBeforeBuilding"] + ): + parms["cleanBeforeBuilding"] = ( self.__parameters["cleanBeforeBuilding"] + ) args.append("--clean") # 3. always add these arguments @@ -272,28 +283,33 @@ """ # get data of general tab if self.__mode == "installer": - self.__parameters["pyinstaller"] = \ + self.__parameters["pyinstaller"] = ( self.executableCombo.currentText() + ) elif self.__mode == "spec": - self.__parameters["pyi-makespec"] = \ + self.__parameters["pyi-makespec"] = ( self.executableCombo.currentText() + ) self.__parameters["mainscript"] = self.mainScriptButton.isChecked() self.__parameters["inputFile"] = self.inputFilePicker.text() self.__parameters["oneDirectory"] = self.oneDirButton.isChecked() self.__parameters["name"] = self.nameEdit.text() self.__parameters["encryptionKey"] = self.keyEdit.text() - self.__parameters["cleanBeforeBuilding"] = \ + self.__parameters["cleanBeforeBuilding"] = ( self.cleanCheckBox.isChecked() + ) # get data of Windows and macOS tab - self.__parameters["consoleApplication"] = \ + self.__parameters["consoleApplication"] = ( self.consoleButton.isChecked() + ) self.__parameters["iconFile"] = self.iconFilePicker.text() self.__parameters["iconId"] = self.iconIdEdit.text() # get data of macOS specific tab - self.__parameters["bundleIdentifier"] = \ + self.__parameters["bundleIdentifier"] = ( self.bundleIdentifierEdit.text() + ) # call the accept slot of the base class super(PyInstallerConfigDialog, self).accept() @@ -306,14 +322,18 @@ # If not to be run with the project main script, a script or # spec file must be selected. - if self.selectedScriptButton.isChecked() and \ - not bool(self.inputFilePicker.text()): + if ( + self.selectedScriptButton.isChecked() and + not bool(self.inputFilePicker.text()) + ): enable = False # If the icon shall be picked from a .exe file, an icon ID # must be entered (Windows only). - if self.iconFilePicker.text().endswith(".exe") and \ - not bool(self.iconIdEdit.text()): + if ( + self.iconFilePicker.text().endswith(".exe") and + not bool(self.iconIdEdit.text()) + ): enable = False self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)