Fri, 18 May 2012 16:03:58 +0200
Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
25
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
2 | |
31
d8b18ded68ce
Updated copyright for 2012.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
28
diff
changeset
|
3 | # Copyright (c) 2010 - 2012 Detlev Offenbach <detlev@die-offenbachs.de> |
25
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
4 | # |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
5 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
6 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
7 | Module implementing the CxFreeze plugin. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
8 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
9 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
10 | import os |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
11 | import sys |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
12 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
13 | from PyQt4.QtCore import QObject, QTranslator, QCoreApplication |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
14 | from PyQt4.QtGui import QDialog, QMessageBox |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
15 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
16 | from E5Gui.E5Action import E5Action |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
17 | from E5Gui.E5Application import e5App |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
18 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
19 | from CxFreeze.CxfreezeConfigDialog import CxfreezeConfigDialog |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
20 | from CxFreeze.CxfreezeExecDialog import CxfreezeExecDialog |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
21 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
22 | import Utilities |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
23 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
24 | # Start-of-Header |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
25 | name = "CxFreeze Plugin" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
26 | author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
27 | autoactivate = True |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
28 | deactivateable = True |
33
2a3b4b7a633f
Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
32
diff
changeset
|
29 | version = "5.0.7" |
25
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
30 | className = "CxFreezePlugin" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
31 | packageName = "CxFreeze" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
32 | shortDescription = "Show the CxFreeze dialogs." |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
33 | longDescription = """This plugin implements the CxFreeze dialogs.""" \ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
34 | """ CxFreeze is used to generate a distribution package.""" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
35 | needsRestart = False |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
36 | pyqtApi = 2 |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
37 | # End-of-Header |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
38 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
39 | error = "" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
40 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
41 | def exeDisplayData(): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
42 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
43 | Public method to support the display of some executable info. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
44 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
45 | @return dictionary containing the data to query the presence of |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
46 | the executable |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
47 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
48 | data = { |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
49 | "programEntry" : True, |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
50 | "header" : QCoreApplication.translate("CxFreezePlugin", |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
51 | "Packagers - cx_freeze"), |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
52 | "exe" : 'dummyfreeze', |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
53 | "versionCommand" : '--version', |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
54 | "versionStartsWith" : 'dummyfreeze', |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
55 | "versionPosition" : -1, |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
56 | "version" : "", |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
57 | "versionCleanup" : None, |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
58 | } |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
59 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
60 | exe = _findExecutable() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
61 | if exe: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
62 | data["exe"] = exe |
30
153f0acb2ebb
Corrected some more stuff in the main plug-in file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
28
diff
changeset
|
63 | data["versionStartsWith"] = "cxfreeze" |
25
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
64 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
65 | return data |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
66 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
67 | def _findExecutable(): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
68 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
69 | Restricted function to determine the name of the executable. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
70 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
71 | @return name of the executable (string) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
72 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
73 | if Utilities.isWindowsPlatform(): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
74 | # |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
75 | # Windows |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
76 | # |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
77 | exe = 'cxfreeze.bat' |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
78 | if Utilities.isinpath(exe): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
79 | return exe |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
80 | try: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
81 | #only since python 3.2 |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
82 | import sysconfig |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
83 | scripts = sysconfig.get_path('scripts','nt') |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
84 | return os.path.join(scripts, exe) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
85 | except ImportError: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
86 | try: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
87 | import winreg |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
88 | except ImportError: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
89 | # give up ... |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
90 | return None |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
91 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
92 | def getExePath(branch): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
93 | version = str(sys.version_info.major) + '.' + \ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
94 | str(sys.version_info.minor) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
95 | try: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
96 | software = winreg.OpenKey(branch, 'Software') |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
97 | python = winreg.OpenKey(software, 'Python') |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
98 | pcore = winreg.OpenKey(python, 'PythonCore') |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
99 | version = winreg.OpenKey(pcore, version) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
100 | installpath = winreg.QueryValue(version, 'InstallPath') |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
101 | return os.path.join(installpath, 'Scripts', exe) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
102 | except WindowsError: # __IGNORE_WARNING__ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
103 | return None |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
104 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
105 | exePath = getExePath(winreg.HKEY_CURRENT_USER) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
106 | if not exePath: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
107 | exePath = getExePath(winreg.HKEY_LOCAL_MACHINE) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
108 | return exePath |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
109 | else: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
110 | # |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
111 | # Linux, Unix ... |
28
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
112 | cxfreezeScript = 'cxfreeze' |
33
2a3b4b7a633f
Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
32
diff
changeset
|
113 | scriptSuffixes = ["", |
2a3b4b7a633f
Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
32
diff
changeset
|
114 | "-python{0}".format(sys.version[:1]), |
2a3b4b7a633f
Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
32
diff
changeset
|
115 | "-python{0}".format(sys.version[:3])] |
30
153f0acb2ebb
Corrected some more stuff in the main plug-in file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
28
diff
changeset
|
116 | # There could be multiple cxfreeze executables in the path |
28
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
117 | # e.g. for different python variants |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
118 | path = Utilities.getEnvironmentEntry('PATH') |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
119 | # environment variable not defined |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
120 | if path is None: |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
121 | return None |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
122 | |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
123 | # step 1: determine possible candidates |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
124 | exes = [] |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
125 | dirs = path.split(os.pathsep) |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
126 | for dir in dirs: |
33
2a3b4b7a633f
Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
32
diff
changeset
|
127 | for suffix in scriptSuffixes: |
2a3b4b7a633f
Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
32
diff
changeset
|
128 | exe = os.path.join(dir, cxfreezeScript + suffix) |
2a3b4b7a633f
Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
32
diff
changeset
|
129 | if os.access(exe, os.X_OK): |
2a3b4b7a633f
Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
32
diff
changeset
|
130 | exes.append(exe) |
28
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
131 | |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
132 | # step 2: determine the Python 3 variant |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
133 | found = False |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
134 | if Utilities.isMacPlatform(): |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
135 | checkStr = "Python.framework/Versions/3".lower() |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
136 | else: |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
137 | checkStr = "python3" |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
138 | for exe in exes: |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
139 | try: |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
140 | f = open(exe, "r") |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
141 | line0 = f.readline() |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
142 | if checkStr in line0.lower(): |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
143 | found = True |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
144 | finally: |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
145 | f.close() |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
146 | if found: |
bbcf4437e32a
Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
147 | return exe |
25
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
148 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
149 | return None |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
150 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
151 | def _checkProgram(): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
152 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
153 | Restricted function to check the availability of cxfreeze. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
154 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
155 | @return flag indicating availability (boolean) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
156 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
157 | global error |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
158 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
159 | if _findExecutable() is None: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
160 | error = QCoreApplication.translate("CxFreezePlugin", |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
161 | "The cxfreeze executable could not be found.") |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
162 | return False |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
163 | else: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
164 | return True |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
165 | _checkProgram() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
166 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
167 | class CxFreezePlugin(QObject): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
168 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
169 | Class implementing the CxFreeze plugin. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
170 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
171 | def __init__(self, ui): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
172 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
173 | Constructor |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
174 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
175 | @param ui reference to the user interface object (UI.UserInterface) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
176 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
177 | QObject.__init__(self, ui) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
178 | self.__ui = ui |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
179 | self.__initialize() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
180 | _checkProgram() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
181 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
182 | self.__translator = None |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
183 | self.__loadTranslator() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
184 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
185 | def __initialize(self): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
186 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
187 | Private slot to (re)initialize the plugin. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
188 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
189 | self.__projectAct = None |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
190 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
191 | def activate(self): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
192 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
193 | Public method to activate this plugin. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
194 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
195 | @return tuple of None and activation status (boolean) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
196 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
197 | global error |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
198 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
199 | # cxfreeze is only activated if it is available |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
200 | if not _checkProgram(): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
201 | return None, False |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
202 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
203 | menu = e5App().getObject("Project").getMenu("Packagers") |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
204 | if menu: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
205 | self.__projectAct = E5Action(self.trUtf8('Use cx_freeze'), |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
206 | self.trUtf8('Use cx_&freeze'), 0, 0, |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
207 | self, 'packagers_cxfreeze') |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
208 | self.__projectAct.setStatusTip( |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
209 | self.trUtf8('Generate a distribution package using cx_freeze')) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
210 | self.__projectAct.setWhatsThis(self.trUtf8( |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
211 | """<b>Use cx_freeze</b>""" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
212 | """<p>Generate a distribution package using cx_freeze.""" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
213 | """ The command is executed in the project path. All""" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
214 | """ files and directories must be given absolute or""" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
215 | """ relative to the project directory.</p>""" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
216 | )) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
217 | self.__projectAct.triggered[()].connect(self.__cxfreeze) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
218 | e5App().getObject("Project").addE5Actions([self.__projectAct]) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
219 | menu.addAction(self.__projectAct) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
220 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
221 | error = "" |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
222 | return None, True |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
223 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
224 | def deactivate(self): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
225 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
226 | Public method to deactivate this plugin. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
227 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
228 | menu = e5App().getObject("Project").getMenu("Packagers") |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
229 | if menu: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
230 | if self.__projectAct: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
231 | menu.removeAction(self.__projectAct) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
232 | e5App().getObject("Project").removeE5Actions([self.__projectAct]) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
233 | self.__initialize() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
234 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
235 | def __loadTranslator(self): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
236 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
237 | Private method to load the translation file. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
238 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
239 | if self.__ui is not None: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
240 | loc = self.__ui.getLocale() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
241 | if loc and loc != "C": |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
242 | locale_dir = \ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
243 | os.path.join(os.path.dirname(__file__), "CxFreeze", "i18n") |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
244 | translation = "cxfreeze_{0}".format(loc) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
245 | translator = QTranslator(None) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
246 | loaded = translator.load(translation, locale_dir) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
247 | if loaded: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
248 | self.__translator = translator |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
249 | e5App().installTranslator(self.__translator) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
250 | else: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
251 | print("Warning: translation file '{0}' could not be loaded."\ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
252 | .format(translation)) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
253 | print("Using default.") |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
254 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
255 | def __cxfreeze(self): |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
256 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
257 | Private slot to handle the cxfreeze execution. |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
258 | """ |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
259 | project = e5App().getObject("Project") |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
260 | if len(project.pdata["MAINSCRIPT"]) == 0: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
261 | # no main script defined |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
262 | QMessageBox.critical(None, |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
263 | self.trUtf8("cxfreeze"), |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
264 | self.trUtf8( |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
265 | """There is no main script defined for the current project."""), |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
266 | QMessageBox.StandardButtons( |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
267 | QMessageBox.Abort)) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
268 | return |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
269 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
270 | parms = project.getData('PACKAGERSPARMS', "CXFREEZE") |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
271 | exe = _findExecutable() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
272 | if exe is None: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
273 | QMessageBox.critical(None, |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
274 | self.trUtf8("cxfreeze"), |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
275 | self.trUtf8("""The cxfreeze executable could not be found.""")) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
276 | return |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
277 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
278 | dlg = CxfreezeConfigDialog(project, exe, parms) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
279 | if dlg.exec_() == QDialog.Accepted: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
280 | args, parms = dlg.generateParameters() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
281 | project.setData('PACKAGERSPARMS', "CXFREEZE", parms) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
282 | |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
283 | # now do the call |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
284 | dia = CxfreezeExecDialog("cxfreeze") |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
285 | dia.show() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
286 | res = dia.start(args, |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
287 | os.path.join(project.ppath, project.pdata["MAINSCRIPT"][0])) |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
288 | if res: |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
289 | dia.exec_() |
737c623c90df
Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents:
24
diff
changeset
|
290 |