install.py

Sat, 01 Sep 2018 10:39:08 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 01 Sep 2018 10:39:08 +0200
branch
maintenance
changeset 6490
7bbc72701f0a
parent 6476
d13d573c2da4
child 6495
6e73d31af3af
permissions
-rw-r--r--

Re-merged with "default" branch in order to include some last minute fixes in the next release.

12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1 #!/usr/bin/env python3
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3
6048
82ad8ec9548c Updated copyright for 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5992
diff changeset
4 # Copyright (c) 2002 - 2018 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5 #
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
6 # This is the install script for eric6.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
9 Installation script for the eric6 IDE and all eric6 related tools.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
12 from __future__ import unicode_literals, print_function
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
13 try:
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
14 # Python2 only
2846
b852fe4d153a Fix for the installer script
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2791
diff changeset
15 import cStringIO as io
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6360
diff changeset
16 try:
6365
85f8745427a6 Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6364
diff changeset
17 from PyQt5 import sip
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6360
diff changeset
18 except ImportError:
6365
85f8745427a6 Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6364
diff changeset
19 import sip
3942
a79c9261e7a8 Changed the last fix slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3939
diff changeset
20 sip.setapi('QString', 2)
a79c9261e7a8 Changed the last fix slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3939
diff changeset
21 sip.setapi('QVariant', 2)
a79c9261e7a8 Changed the last fix slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3939
diff changeset
22 sip.setapi('QTextStream', 2)
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
23 input = raw_input # __IGNORE_WARNING__
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
24 except (ImportError):
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
25 import io # __IGNORE_WARNING__
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2480
diff changeset
26
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 import sys
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 import re
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 import compileall
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 import py_compile
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 import glob
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 import shutil
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 import fnmatch
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
35 import codecs
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
36 import subprocess
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
37 import time
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 # Define the globals.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 progName = None
1658
c61997a63efe Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1538
diff changeset
41 currDir = os.getcwd()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 modDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 pyModDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 platBinDir = None
4455
ca13a6f6c452 Prepared the Python3 debug client for some obsolescences of the inspect.py module.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4435
diff changeset
45 platBinDirOld = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 distDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 apisDir = None
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
48 installApis = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 doCleanup = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 doCompile = True
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
51 includePythonVariant = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 cfg = {}
3468
869d0b6e1e16 Added an API file for QSS and corrected an issue in the APIs manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
53 progLanguages = ["Python", "Ruby", "QSS"]
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
54 sourceDir = "eric"
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
55 configName = 'eric6config.py'
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
56 defaultMacAppBundleName = "eric6.app"
3714
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
57 defaultMacAppBundlePath = "/Applications"
3955
9c3e54d351e2 Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3950
diff changeset
58 defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
59 sys.exec_prefix)
3955
9c3e54d351e2 Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3950
diff changeset
60 macAppBundleName = defaultMacAppBundleName
9c3e54d351e2 Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3950
diff changeset
61 macAppBundlePath = defaultMacAppBundlePath
9c3e54d351e2 Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3950
diff changeset
62 macPythonExe = defaultMacPythonExe
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
63 pyqtVariant = ""
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3936
diff changeset
64 pyqtOverride = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
66 # Define blacklisted versions of the prerequisites
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
67 BlackLists = {
1188
87c12a25512c Added a blacklisted sip version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1161
diff changeset
68 "sip": ["4.11", "4.12.3"],
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
69 "PyQt4": [],
3657
ae833e7fcd6c Adopted the install script for PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
70 "PyQt5": [],
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
71 "QScintilla2": [],
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
72 }
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
73 PlatformsBlackLists = {
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
74 "windows": {
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
75 "sip": [],
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
76 "PyQt4": [],
3657
ae833e7fcd6c Adopted the install script for PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
77 "PyQt5": [],
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
78 "QScintilla2": [],
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
79 },
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
80
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
81 "linux": {
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
82 "sip": [],
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
83 "PyQt4": [],
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3628
diff changeset
84 "PyQt5": [],
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
85 "QScintilla2": [],
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
86 },
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
87
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
88 "mac": {
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
89 "sip": [],
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
90 "PyQt4": [],
3657
ae833e7fcd6c Adopted the install script for PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
91 "PyQt5": [],
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
92 "QScintilla2": [],
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
93 },
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
94 }
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
95
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
96 # Define file name markers for Python variants
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
97 PythonMarkers = {
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
98 2: "_py2",
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
99 3: "_py3",
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
100 }
4054
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
101 # Define a mapping of markers to full text
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
102 PythonTextMarkers = {
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
103 "_py2": "Python 2",
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
104 "_py3": "Python 3",
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
105 }
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
106
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
107
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
108 def exit(rcode=0):
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
109 """
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
110 Exit the install script.
3019
7912530a33e2 Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3003
diff changeset
111
7912530a33e2 Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3003
diff changeset
112 @param rcode result code to report back (integer)
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
113 """
1658
c61997a63efe Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1538
diff changeset
114 global currDir
c61997a63efe Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1538
diff changeset
115
5963
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
116 print()
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
117
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
118 if sys.platform.startswith("win"):
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
119 # different meaning of input between Py2 and Py3
2428
11e6e63a89d0 Wrapped calls to input() by try-except in install.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2423
diff changeset
120 try:
11e6e63a89d0 Wrapped calls to input() by try-except in install.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2423
diff changeset
121 input("Press enter to continue...")
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
122 except (EOFError, SyntaxError):
2428
11e6e63a89d0 Wrapped calls to input() by try-except in install.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2423
diff changeset
123 pass
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
124
1658
c61997a63efe Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1538
diff changeset
125 os.chdir(currDir)
c61997a63efe Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1538
diff changeset
126
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
127 sys.exit(rcode)
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
128
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
129
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
130 def usage(rcode=2):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 Display a usage message and exit.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 @param rcode the return code passed back to the calling process.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 """
3507
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
136 global progName, modDir, distDir, apisDir
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
137 global macAppBundleName, macAppBundlePath, macPythonExe
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
138 global pyqtVariant
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
140 print()
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
141 print("Usage:")
2306
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
142 if sys.platform == "darwin":
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
143 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
144 " [-m name] [-p python] [--pyqt=version]".format(progName))
2306
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
145 elif sys.platform.startswith("win"):
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
146 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file]"
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
147 " [--pyqt=version]"
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
148 .format(progName))
2306
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
149 else:
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
150 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
151 " [--pyqt=version]"
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
152 .format(progName))
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
153 print("where:")
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
154 print(" -h, --help display this help message")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
155 print(" -a dir where the API files will be installed")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 if apisDir:
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
157 print(" (default: {0})".format(apisDir))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 else:
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
159 print(" (no default value)")
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
160 print(" --noapis don't install API files")
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
161 print(" -b dir where the binaries will be installed")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
162 print(" (default: {0})".format(platBinDir))
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
163 print(" -d dir where eric6 python files will be installed")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
164 print(" (default: {0})".format(modDir))
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
165 print(" -f file configuration file naming the various installation"
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
166 " paths")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 if not sys.platform.startswith("win"):
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
168 print(" -i dir temporary install prefix")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
169 print(" (default: {0})".format(distDir))
2306
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
170 if sys.platform == "darwin":
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
171 print(" -m name name of the Mac app bundle")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
172 print(" (default: {0})".format(macAppBundleName))
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
173 print(" -n path path of the directory the Mac app bundle will")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
174 print(" be created in")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
175 print(" (default: {0})".format(macAppBundlePath))
3955
9c3e54d351e2 Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3950
diff changeset
176 print(" -p python path of the python executable")
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
177 print(" (default: {0})".format(macPythonExe))
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
178 print(" -c don't cleanup old installation first")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
179 print(" -x don't perform dependency checks (use on your own"
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
180 " risk)")
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
181 print(" -y add the Python variant to the executable names")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
182 print(" -z don't compile the installed python files")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
183 print(" --pyqt=version version of PyQt to be used (one of 4 or 5)")
4380
d79c055a12cc Enhanced the install.py help info in case no PyQt variant can be found.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4374
diff changeset
184 if pyqtVariant:
d79c055a12cc Enhanced the install.py help info in case no PyQt variant can be found.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4374
diff changeset
185 print(" (default: {0})".format(pyqtVariant[-1]))
d79c055a12cc Enhanced the install.py help info in case no PyQt variant can be found.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4374
diff changeset
186 else:
d79c055a12cc Enhanced the install.py help info in case no PyQt variant can be found.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4374
diff changeset
187 print(" (no PyQt variant found)")
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
188 print()
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
189 print("The file given to the -f option must be valid Python code"
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
190 " defining a")
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
191 print("dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir',"
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
192 " 'ericIconDir',")
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
193 print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir',"
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
194 " 'ericExamplesDir',")
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
195 print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',")
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
196 print("'ericOthersDir','bindir', 'mdir' and 'apidir.")
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
197 print("These define the directories for the installation of the various"
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
198 " parts of eric6.")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
200 exit(rcode)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
203 def determinePyQtVariant():
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
204 """
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
205 Module function to determine the PyQt variant to be used.
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
206 """
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3936
diff changeset
207 global pyqtVariant, pyqtOverride
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
208
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
209 pyqtVariant = ""
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
210 # need to handle the --pyqt= option here
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
211 if "--pyqt=4" in sys.argv:
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
212 pyqtVariant = "PyQt4"
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3936
diff changeset
213 pyqtOverride = True
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
214 elif "--pyqt=5" in sys.argv:
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
215 pyqtVariant = "PyQt5"
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3936
diff changeset
216 pyqtOverride = True
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
217 else:
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
218 try:
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
219 import PyQt5 # __IGNORE_WARNING__
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
220 pyqtVariant = "PyQt5"
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
221 del sys.modules["PyQt5"]
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
222 except ImportError:
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
223 try:
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
224 import PyQt4 # __IGNORE_WARNING__
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
225 pyqtVariant = "PyQt4"
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
226 del sys.modules["PyQt4"]
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
227 except ImportError:
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
228 # default to PyQt5, installation will be asked for
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
229 pyqtVariant = "PyQt5"
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
230
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
231
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 def initGlobals():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
234 Module function to set the values of globals that need more than a
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
235 simple assignment.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 """
4456
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
237 global platBinDir, modDir, pyModDir, apisDir, pyqtVariant, platBinDirOld
6304
68f9aa03bf75 install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6275
diff changeset
238
68f9aa03bf75 install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6275
diff changeset
239 try:
68f9aa03bf75 install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6275
diff changeset
240 import distutils.sysconfig
68f9aa03bf75 install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6275
diff changeset
241 except ImportError:
68f9aa03bf75 install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6275
diff changeset
242 print("Please install the 'distutils' package first.")
68f9aa03bf75 install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6275
diff changeset
243 exit(5)
68f9aa03bf75 install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6275
diff changeset
244
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 if sys.platform.startswith("win"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 platBinDir = sys.exec_prefix
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 if platBinDir.endswith("\\"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 platBinDir = platBinDir[:-1]
4456
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
249 platBinDirOld = platBinDir
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
250 platBinDir = os.path.join(platBinDir, "Scripts")
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
251 if not os.path.exists(platBinDir):
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
252 platBinDir = platBinDirOld
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 else:
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
254 pyBinDir = os.path.normpath(os.path.dirname(sys.executable))
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
255 if os.access(pyBinDir, os.W_OK):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
256 # install the eric scripts along the python executable
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
257 platBinDir = pyBinDir
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
258 else:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
259 # install them in the user's bin directory
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
260 platBinDir = os.path.expanduser("~/bin")
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
261 if platBinDir != "/usr/local/bin" and \
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
262 os.access("/usr/local/bin", os.W_OK):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
263 platBinDirOld = "/usr/local/bin"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 modDir = distutils.sysconfig.get_python_lib(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 pyModDir = modDir
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
268 pyqtDataDir = os.path.join(modDir, pyqtVariant)
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
269 if os.path.exists(os.path.join(pyqtDataDir, "qsci")):
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
270 # it's the installer
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
271 qtDataDir = pyqtDataDir
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
272 elif os.path.exists(os.path.join(pyqtDataDir, "Qt", "qsci")):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
273 # it's the wheel
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
274 qtDataDir = os.path.join(pyqtDataDir, "Qt")
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
275 else:
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
276 # determine dynamically
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
277 try:
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
278 if pyqtVariant == "PyQt4":
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
279 from PyQt4.QtCore import QLibraryInfo
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
280 else:
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
281 from PyQt5.QtCore import QLibraryInfo
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
282 qtDataDir = QLibraryInfo.location(QLibraryInfo.DataPath)
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
283 except ImportError:
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
284 qtDataDir = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 if qtDataDir:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 apisDir = os.path.join(qtDataDir, "qsci", "api")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 apisDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 def copyToFile(name, text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 Copy a string to a file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 @param name the name of the file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 @param text the contents to copy to the file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 """
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
298 f = open(name, "w")
2846
b852fe4d153a Fix for the installer script
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2791
diff changeset
299 if sys.version_info[0] == 2:
b852fe4d153a Fix for the installer script
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2791
diff changeset
300 text = codecs.encode(text, "utf-8")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 f.write(text)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 f.close()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
305 def copyDesktopFile(src, dst, marker):
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
306 """
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
307 Modify a desktop file and write it to its destination.
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
308
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
309 @param src source file name (string)
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
310 @param dst destination file name (string)
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
311 @param marker marker to be used (string)
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
312 """
6275
8ce9f9c467ec Fixed some install script issues related to defining the bin dir via -b switch.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6216
diff changeset
313 global cfg, platBinDir
6216
2a0eeba143e7 install script: corrected the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6214
diff changeset
314
3939
fc1ea4bbb201 Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3937
diff changeset
315 if sys.version_info[0] == 2:
fc1ea4bbb201 Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3937
diff changeset
316 f = codecs.open(src, "r", "utf-8")
fc1ea4bbb201 Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3937
diff changeset
317 else:
3962
b75057280077 Little fix in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3955
diff changeset
318 f = open(src, "r", encoding="utf-8")
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
319 text = f.read()
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
320 f.close()
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
321
6275
8ce9f9c467ec Fixed some install script issues related to defining the bin dir via -b switch.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6216
diff changeset
322 text = text.replace("@BINDIR@", platBinDir)
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
323 text = text.replace("@MARKER@", marker)
4054
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
324 if marker:
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
325 t_marker = " ({0})".format(PythonTextMarkers[marker])
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
326 else:
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
327 t_marker = ""
3ef699270e61 Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4033
diff changeset
328 text = text.replace("@PY_MARKER@", t_marker)
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
329
3939
fc1ea4bbb201 Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3937
diff changeset
330 if sys.version_info[0] == 2:
fc1ea4bbb201 Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3937
diff changeset
331 f = codecs.open(dst, "w", "utf-8")
fc1ea4bbb201 Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3937
diff changeset
332 else:
3962
b75057280077 Little fix in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3955
diff changeset
333 f = open(dst, "w", encoding="utf-8")
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
334 f.write(text)
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
335 f.close()
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
336 os.chmod(dst, 0o644)
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
337
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
338
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
339 def copyAppStreamFile(src, dst, marker):
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
340 """
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
341 Modify an appstream file and write it to its destination.
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
342
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
343 @param src source file name (string)
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
344 @param dst destination file name (string)
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
345 @param marker marker to be used (string)
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
346 """
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
347 if os.path.exists(os.path.join("eric", "UI", "Info.py")):
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
348 # Installing from archive
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
349 from eric.UI.Info import Version
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
350 elif os.path.exists(os.path.join("UI", "Info.py")):
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
351 # Installing from source tree
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
352 from UI.Info import Version
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
353 else:
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
354 Version = "Unknown"
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
355
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
356 if sys.version_info[0] == 2:
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
357 f = codecs.open(src, "r", "utf-8")
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
358 else:
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
359 f = open(src, "r", encoding="utf-8")
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
360 text = f.read()
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
361 f.close()
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
362
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
363 text = text.replace("@MARKER@", marker)\
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
364 .replace("@VERSION@", Version.split(None, 1)[0])\
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
365 .replace("@DATE@", time.strftime("%Y-%m-%d"))
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
366
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
367 if sys.version_info[0] == 2:
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
368 f = codecs.open(dst, "w", "utf-8")
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
369 else:
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
370 f = open(dst, "w", encoding="utf-8")
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
371 f.write(text)
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
372 f.close()
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
373 os.chmod(dst, 0o644)
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
374
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
375
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 def wrapperName(dname, wfile):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 Create the platform specific name for the wrapper script.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 @param dname name of the directory to place the wrapper into
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 @param wfile basename (without extension) of the wrapper script
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 @return the name of the wrapper script
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 if sys.platform.startswith("win"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 wname = dname + "\\" + wfile + ".bat"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 wname = dname + "/" + wfile
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 return wname
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391
3613
47e29cc0f29c Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3612
diff changeset
392 def createPyWrapper(pydir, wfile, isGuiScript=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 Create an executable wrapper for a Python script.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395
899
4687532058ba Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
396 @param pydir the name of the directory where the Python script will
3612
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
397 eventually be installed (string)
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
398 @param wfile the basename of the wrapper (string)
902
c06241839b12 Fixed a source docu string in the new installer script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 900
diff changeset
399 @param isGuiScript flag indicating a wrapper script for a GUI
c06241839b12 Fixed a source docu string in the new installer script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 900
diff changeset
400 application (boolean)
3612
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
401 @return the platform specific name of the wrapper (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 """
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3936
diff changeset
403 global includePythonVariant, pyqtVariant, pyqtOverride
3613
47e29cc0f29c Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3612
diff changeset
404
47e29cc0f29c Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3612
diff changeset
405 if includePythonVariant:
47e29cc0f29c Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3612
diff changeset
406 marker = PythonMarkers[sys.version_info.major]
47e29cc0f29c Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3612
diff changeset
407 else:
47e29cc0f29c Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3612
diff changeset
408 marker = ""
47e29cc0f29c Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3612
diff changeset
409
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3936
diff changeset
410 if pyqtOverride and pyqtVariant == "PyQt4":
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
411 pyqt4opt = " --pyqt4"
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
412 else:
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
413 pyqt4opt = ""
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
414
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 # all kinds of Windows systems
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 if sys.platform.startswith("win"):
3612
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
417 wname = wfile + marker + ".bat"
899
4687532058ba Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
418 if isGuiScript:
900
c5d8b27ac6c1 Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 899
diff changeset
419 wrapper = \
1402
474db48f495c Fixed an issue in creating the startup scripts for Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1400
diff changeset
420 '''@echo off\n''' \
2583
92b902f6455e Fixed the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2577
diff changeset
421 '''start "" "{2}\\pythonw.exe"''' \
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
422 ''' "{0}\\{1}.pyw"{3}''' \
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
423 ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format(
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
424 pydir, wfile, sys.exec_prefix, pyqt4opt)
899
4687532058ba Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
425 else:
900
c5d8b27ac6c1 Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 899
diff changeset
426 wrapper = \
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
427 '''@"{0}\\python" "{1}\\{2}.py"{3}''' \
1402
474db48f495c Fixed an issue in creating the startup scripts for Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1400
diff changeset
428 ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format(
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
429 sys.exec_prefix, pydir, wfile, pyqt4opt)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 # Mac OS X
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 elif sys.platform == "darwin":
3612
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
433 major = sys.version_info.major
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
434 pyexec = "{0}/bin/pythonw{1}".format(sys.exec_prefix, major)
2618
bc7339209500 Fixed an issue in the install script related to the usage of a virtual environment on Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2608
diff changeset
435 if not os.path.exists(pyexec):
3612
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
436 pyexec = "{0}/bin/python{1}".format(sys.exec_prefix, major)
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
437 wname = wfile + marker
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
438 wrapper = ('''#!/bin/sh\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
439 '''\n'''
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
440 '''exec "{0}" "{1}/{2}.py"{3} "$@"\n'''
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
441 .format(pyexec, pydir, wfile, pyqt4opt))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 # *nix systems
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 else:
3612
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
445 wname = wfile + marker
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
446 wrapper = ('''#!/bin/sh\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
447 '''\n'''
3936
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
448 '''exec "{0}" "{1}/{2}.py"{3} "$@"\n'''
93fb2fd523f1 Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
449 .format(sys.executable, pydir, wfile, pyqt4opt))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 copyToFile(wname, wrapper)
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
452 os.chmod(wname, 0o755)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 return wname
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456
5651
982465f8389c Fixed a few code style issues related to the usage of mutable types for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5628
diff changeset
457 def copyTree(src, dst, filters, excludeDirs=None, excludePatterns=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 Copy Python, translation, documentation, wizards configuration,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 designer template files and DTDs of a directory tree.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 @param src name of the source directory
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 @param dst name of the destination directory
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 @param filters list of filter pattern determining the files to be copied
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 @param excludeDirs list of (sub)directories to exclude from copying
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
466 @keyparam excludePatterns list of filter pattern determining the files to
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
467 be skipped
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 """
5651
982465f8389c Fixed a few code style issues related to the usage of mutable types for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5628
diff changeset
469 if excludeDirs is None:
982465f8389c Fixed a few code style issues related to the usage of mutable types for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5628
diff changeset
470 excludeDirs = []
982465f8389c Fixed a few code style issues related to the usage of mutable types for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5628
diff changeset
471 if excludePatterns is None:
982465f8389c Fixed a few code style issues related to the usage of mutable types for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5628
diff changeset
472 excludePatterns = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 names = os.listdir(src)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 except OSError:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
476 # ignore missing directories (most probably the i18n directory)
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
477 return
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 for name in names:
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
480 skipIt = False
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
481 for excludePattern in excludePatterns:
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
482 if fnmatch.fnmatch(name, excludePattern):
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
483 skipIt = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 break
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
485 if not skipIt:
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
486 srcname = os.path.join(src, name)
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
487 dstname = os.path.join(dst, name)
5597
3d88d53f8c2b Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
488 for fileFilter in filters:
3d88d53f8c2b Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
489 if fnmatch.fnmatch(srcname, fileFilter):
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
490 if not os.path.isdir(dst):
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
491 os.makedirs(dst)
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
492 shutil.copy2(srcname, dstname)
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
493 os.chmod(dstname, 0o644)
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
494 break
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
495 else:
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3613
diff changeset
496 if os.path.isdir(srcname) and srcname not in excludeDirs:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
497 copyTree(srcname, dstname, filters,
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
498 excludePatterns=excludePatterns)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 def createGlobalPluginsDir():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 Create the global plugins directory, if it doesn't exist.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 global cfg, distDir
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
507 pdir = os.path.join(cfg['mdir'], "eric6plugins")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 fname = os.path.join(pdir, "__init__.py")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 if not os.path.exists(fname):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 if not os.path.exists(pdir):
3507
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
511 os.mkdir(pdir, 0o755)
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
512 f = open(fname, "w")
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 473
diff changeset
513 f.write(
4830
f609a22f43bd Fixed a few code style issues detected by the updated pep8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
514 '''# -*- coding: utf-8 -*-
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 Package containing the global plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
519 '''
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 f.close()
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
522 os.chmod(fname, 0o644)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524
3593
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
525 def cleanupSource(dirName):
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
526 """
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
527 Cleanup the sources directory to get rid of leftover files
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
528 and directories.
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
529
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
530 @param dirName name of the directory to prune (string)
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
531 """
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
532 # step 1: delete all Ui_*.py files without a corresponding
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
533 # *.ui file
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
534 dirListing = os.listdir(dirName)
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
535 for formName, sourceName in [
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
536 (f.replace('Ui_', "").replace(".py", ".ui"), f)
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
537 for f in dirListing if fnmatch.fnmatch(f, "Ui_*.py")]:
3594
778ae276540f Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3593
diff changeset
538 if not os.path.exists(os.path.join(dirName, formName)):
3593
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
539 os.remove(os.path.join(dirName, sourceName))
3594
778ae276540f Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3593
diff changeset
540 if os.path.exists(os.path.join(dirName, sourceName + "c")):
3593
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
541 os.remove(os.path.join(dirName, sourceName + "c"))
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
542
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4915
diff changeset
543 # step 2: delete the __pycache__ directory and all remaining *.pyc files
3594
778ae276540f Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3593
diff changeset
544 if os.path.exists(os.path.join(dirName, "__pycache__")):
3593
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
545 shutil.rmtree(os.path.join(dirName, "__pycache__"))
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4915
diff changeset
546 for name in [f for f in os.listdir(dirName)
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4915
diff changeset
547 if fnmatch.fnmatch(f, "*.pyc")]:
3612
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
548 os.remove(os.path.join(dirName, name))
3593
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
549
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
550 # step 3: descent into subdirectories and delete them if empty
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
551 for name in os.listdir(dirName):
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
552 name = os.path.join(dirName, name)
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
553 if os.path.isdir(name):
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
554 cleanupSource(name)
3595
a8433c7a0d8c Fixed another issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3594
diff changeset
555 if len(os.listdir(name)) == 0:
a8433c7a0d8c Fixed another issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3594
diff changeset
556 os.rmdir(name)
3593
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
557
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
558
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 def cleanUp():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 Uninstall the old eric files.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 """
4456
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
563 global platBinDir, platBinDirOld, includePythonVariant
2306
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
564
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 try:
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
566 from eric6config import getConfig
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 except ImportError:
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
568 # eric6 wasn't installed previously
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571 global pyModDir, progLanguages
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572
146
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 133
diff changeset
573 # Remove the menu entry for Linux systems
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
574 if sys.platform.startswith("linux"):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
575 if os.getuid() == 0:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
576 for name in ["/usr/share/pixmaps/eric.png",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
577 "/usr/share/pixmaps/ericWeb.png"]:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
578 if os.path.exists(name):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
579 os.remove(name)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
580 if includePythonVariant:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
581 marker = PythonMarkers[sys.version_info.major]
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
582 else:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
583 marker = ""
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
584 for name in [
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
585 "/usr/share/applications/eric6" + marker + ".desktop",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
586 "/usr/share/appdata/eric6" + marker + ".appdata.xml",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
587 "/usr/share/metainfo/eric6" + marker + ".appdata.xml",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
588 "/usr/share/applications/eric6_webbrowser" + marker +
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
589 ".desktop",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
590 "/usr/share/applications/eric6_browser" + marker +
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
591 ".desktop",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
592 "/usr/share/pixmaps/eric" + marker + ".png",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
593 "/usr/share/pixmaps/ericWeb" + marker + ".png",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
594 ]:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
595 if os.path.exists(name):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
596 os.remove(name)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
597 elif os.getuid() >= 1000:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
598 # it is assumed that user ids start at 1000
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
599 for name in ["~/.local/share/pixmaps/eric.png",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
600 "~/.local/share/pixmaps/ericWeb.png"]:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
601 path = os.path.expanduser(name)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
602 if os.path.exists(path):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
603 os.remove(path)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
604 if includePythonVariant:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
605 marker = PythonMarkers[sys.version_info.major]
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
606 else:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
607 marker = ""
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
608 for name in [
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
609 "~/.local/share/applications/eric6" + marker + ".desktop",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
610 "~/.local/share/appdata/eric6" + marker + ".appdata.xml",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
611 "~/.local/share/metainfo/eric6" + marker + ".appdata.xml",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
612 "~/.local/share/applications/eric6_webbrowser" + marker +
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
613 ".desktop",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
614 "~/.local/share/applications/eric6_browser" + marker +
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
615 ".desktop",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
616 "~/.local/share/pixmaps/eric" + marker + ".png",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
617 "~/.local/share/pixmaps/ericWeb" + marker + ".png",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
618 ]:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
619 path = os.path.expanduser(name)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
620 if os.path.exists(path):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
621 os.remove(path)
146
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 133
diff changeset
622
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 # Remove the wrapper scripts
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 rem_wnames = [
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
625 "eric6_api", "eric6_compare",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
626 "eric6_configure", "eric6_diff",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
627 "eric6_doc", "eric6_qregularexpression",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
628 "eric6_qregexp", "eric6_re",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
629 "eric6_trpreviewer", "eric6_uipreviewer",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
630 "eric6_unittest", "eric6",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
631 "eric6_tray", "eric6_editor",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
632 "eric6_plugininstall", "eric6_pluginuninstall",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
633 "eric6_pluginrepository", "eric6_sqlbrowser",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
634 "eric6_webbrowser", "eric6_iconeditor",
4806
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
635 "eric6_snap", "eric6_hexeditor", "eric6_browser",
5711
50b6867ffcd3 Finished implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5675
diff changeset
636 "eric6_shell",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 ]
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
638 if includePythonVariant:
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
639 marker = PythonMarkers[sys.version_info.major]
3678
2866383fd342 Adjusted the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
640 rem_wnames = [n + marker for n in rem_wnames]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641
1381
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
642 try:
4456
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
643 dirs = [platBinDir, getConfig('bindir')]
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
644 if platBinDirOld:
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
645 dirs.append(platBinDirOld)
1381
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
646 for rem_wname in rem_wnames:
4456
9a2304647d95 Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4455
diff changeset
647 for d in dirs:
2577
14296525eff5 Changed the installation directory on Windows to be the 'Scripts' subdirectory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2480
diff changeset
648 rwname = wrapperName(d, rem_wname)
14296525eff5 Changed the installation directory on Windows to be the 'Scripts' subdirectory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2480
diff changeset
649 if os.path.exists(rwname):
14296525eff5 Changed the installation directory on Windows to be the 'Scripts' subdirectory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2480
diff changeset
650 os.remove(rwname)
1381
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
651
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
652 # Cleanup our config file(s)
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
653 for name in ['eric6config.py', 'eric6config.pyc', 'eric6.pth']:
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
654 e6cfile = os.path.join(pyModDir, name)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
655 if os.path.exists(e6cfile):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
656 os.remove(e6cfile)
1381
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
657 e5cfile = os.path.join(pyModDir, "__pycache__", name)
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
658 path, ext = os.path.splitext(e5cfile)
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
659 for f in glob.glob("{0}.*{1}".format(path, ext)):
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
660 os.remove(f)
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
661
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
662 # Cleanup the install directories
3003
cb43c34239b1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
663 for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir',
cb43c34239b1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
664 'ericCSSDir', 'ericIconDir', 'ericPixDir',
cb43c34239b1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
665 'ericTemplatesDir', 'ericCodeTemplatesDir',
cb43c34239b1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
666 'ericOthersDir', 'ericStylesDir', 'ericDir']:
1381
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
667 if os.path.exists(getConfig(name)):
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
668 shutil.rmtree(getConfig(name), True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669
1381
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
670 # Cleanup translations
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
671 for name in glob.glob(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
672 os.path.join(getConfig('ericTranslationsDir'), 'eric6_*.qm')):
1381
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
673 if os.path.exists(name):
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
674 os.remove(name)
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
675
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
676 # Cleanup API files
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
677 try:
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
678 apidir = getConfig('apidir')
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
679 for progLanguage in progLanguages:
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
680 for name in getConfig('apis'):
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
681 apiname = os.path.join(apidir, progLanguage.lower(), name)
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
682 if os.path.exists(apiname):
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
683 os.remove(apiname)
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
684 for apiname in glob.glob(
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
685 os.path.join(apidir, progLanguage.lower(), "*.bas")):
3758
19866b4e9027 Some more places adapted to eric6 and Qt5/PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3751
diff changeset
686 if os.path.basename(apiname) != "eric6.bas":
3697
c947a7eaace4 Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3693
diff changeset
687 os.remove(apiname)
1381
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
688 except AttributeError:
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
689 pass
b66bcd609f83 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1346
diff changeset
690
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
691 if sys.platform == "darwin":
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
692 # delete the Mac app bundle
3509
bf0673c8f155 Fixed the install script again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3508
diff changeset
693 try:
bf0673c8f155 Fixed the install script again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3508
diff changeset
694 macAppBundlePath = getConfig("macAppBundlePath")
bf0673c8f155 Fixed the install script again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3508
diff changeset
695 macAppBundleName = getConfig("macAppBundleName")
bf0673c8f155 Fixed the install script again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3508
diff changeset
696 except AttributeError:
3714
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
697 macAppBundlePath = defaultMacAppBundlePath
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
698 macAppBundleName = defaultMacAppBundleName
3955
9c3e54d351e2 Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3950
diff changeset
699 for bundlePath in [os.path.join(defaultMacAppBundlePath,
3714
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
700 macAppBundleName),
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
701 os.path.join(macAppBundlePath,
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
702 macAppBundleName),
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
703 ]:
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
704 if os.path.exists(bundlePath):
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
705 shutil.rmtree(bundlePath)
2420
c5a0bc75d5b6 Fixed an issue in the install script.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2411
diff changeset
706 except (IOError, OSError) as msg:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
707 sys.stderr.write(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
708 'Error: {0}\nTry install with admin rights.\n'.format(msg))
1385
9eaf0cda4fb4 Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1381
diff changeset
709 exit(7)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711
2177
a59ffbc5fe4c Fixed an error in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2160
diff changeset
712 def shutilCopy(src, dst, perm=0o644):
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
713 """
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
714 Wrapper function around shutil.copy() to ensure the permissions.
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
715
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
716 @param src source file name (string)
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
717 @param dst destination file name or directory name (string)
2177
a59ffbc5fe4c Fixed an error in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2160
diff changeset
718 @keyparam perm permissions to be set (integer)
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
719 """
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
720 shutil.copy(src, dst)
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
721 if os.path.isdir(dst):
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
722 dst = os.path.join(dst, os.path.basename(src))
2177
a59ffbc5fe4c Fixed an error in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2160
diff changeset
723 os.chmod(dst, perm)
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
724
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
725
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726 def installEric():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 Actually perform the installation steps.
2383
e999256385bd Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2312
diff changeset
729
e999256385bd Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2312
diff changeset
730 @return result code (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 """
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
732 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
733 global includePythonVariant, installApis
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 # Create the platform specific wrappers.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 wnames = []
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
737 for name in ["eric6_api", "eric6_doc"]:
3613
47e29cc0f29c Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3612
diff changeset
738 wnames.append(createPyWrapper(cfg['ericDir'], name, False))
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
739 for name in ["eric6_compare", "eric6_configure", "eric6_diff",
4673
6fa2418f010c Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
740 "eric6_editor", "eric6_hexeditor", "eric6_iconeditor",
6fa2418f010c Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
741 "eric6_plugininstall", "eric6_pluginrepository",
6fa2418f010c Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
742 "eric6_pluginuninstall", "eric6_qregexp",
6fa2418f010c Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
743 "eric6_qregularexpression", "eric6_re", "eric6_snap",
6fa2418f010c Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
744 "eric6_sqlbrowser", "eric6_tray", "eric6_trpreviewer",
6fa2418f010c Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
745 "eric6_uipreviewer", "eric6_unittest", "eric6_webbrowser",
5711
50b6867ffcd3 Finished implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5675
diff changeset
746 "eric6_browser", "eric6_shell", "eric6"]:
3613
47e29cc0f29c Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3612
diff changeset
747 wnames.append(createPyWrapper(cfg['ericDir'], name))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 # set install prefix, if not None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 if distDir:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
751 for key in list(cfg.keys()):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 cfg[key] = os.path.normpath(distDir + os.sep + cfg[key])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 # Install the files
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 # make the install directories
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
757 for key in cfg.keys():
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
758 if cfg[key] and not os.path.isdir(cfg[key]):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 os.makedirs(cfg[key])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
761 # copy the eric6 config file
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 if distDir:
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
763 shutilCopy(configName, cfg['mdir'])
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
764 if os.path.exists(configName + 'c'):
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
765 shutilCopy(configName + 'c', cfg['mdir'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 else:
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
767 shutilCopy(configName, modDir)
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
768 if os.path.exists(configName + 'c'):
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
769 shutilCopy(configName + 'c', modDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
771 # copy the various parts of eric6
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
772 copyTree(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
773 sourceDir, cfg['ericDir'],
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
774 ['*.py', '*.pyc', '*.pyo', '*.pyw'],
4033
46084f695e10 Fixed install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
775 ['{1}{0}Examples'.format(os.sep, sourceDir),
46084f695e10 Fixed install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
776 '{1}{0}.ropeproject'.format(os.sep, sourceDir)],
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
777 excludePatterns=["eric6config.py*"])
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
778 copyTree(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
779 sourceDir, cfg['ericDir'], ['*.rb'],
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
780 ['{1}{0}Examples'.format(os.sep, sourceDir)])
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
781 copyTree(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
782 '{1}{0}Plugins'.format(os.sep, sourceDir),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
783 '{0}{1}Plugins'.format(cfg['ericDir'], os.sep),
3724
0848df91249f Fixed the install script for the new Mercurial templates.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3714
diff changeset
784 ['*.png', '*.style', '*.tmpl'])
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
785 copyTree(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
786 '{1}{0}Documentation'.format(os.sep, sourceDir), cfg['ericDocDir'],
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 390
diff changeset
787 ['*.html', '*.qch'])
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
788 copyTree(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
789 '{1}{0}DTDs'.format(os.sep, sourceDir), cfg['ericDTDDir'],
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
790 ['*.dtd'])
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
791 copyTree(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
792 '{1}{0}CSSs'.format(os.sep, sourceDir), cfg['ericCSSDir'],
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
793 ['*.css'])
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
794 copyTree(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
795 '{1}{0}Styles'.format(os.sep, sourceDir), cfg['ericStylesDir'],
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
796 ['*.qss'])
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
797 copyTree(
5976
549918576245 Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5963
diff changeset
798 '{1}{0}Styles'.format(os.sep, sourceDir), cfg['ericStylesDir'],
549918576245 Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5963
diff changeset
799 ['*.e4h'])
549918576245 Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5963
diff changeset
800 copyTree(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
801 '{1}{0}i18n'.format(os.sep, sourceDir), cfg['ericTranslationsDir'],
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
802 ['*.qm'])
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
803 copyTree(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
804 '{1}{0}icons'.format(os.sep, sourceDir), cfg['ericIconDir'],
2217
e80c74f2a25a Added some icons to the "Languages" and "End-of-Line Type" context menus of the editor and changed the status labels for programming language and end-of-line type of the main window to show an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2177
diff changeset
805 ['*.png', 'LICENSE*.*', 'readme.txt'])
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
806 copyTree(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
807 '{1}{0}pixmaps'.format(os.sep, sourceDir), cfg['ericPixDir'],
1538
c14a5ecdb6f4 Fixed install script (forgot to install the *.gif icons).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1525
diff changeset
808 ['*.png', '*.xpm', '*.ico', '*.gif'])
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
809 copyTree(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
810 '{1}{0}DesignerTemplates'.format(os.sep, sourceDir),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
811 cfg['ericTemplatesDir'],
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 390
diff changeset
812 ['*.tmpl'])
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
813 copyTree(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
814 '{1}{0}CodeTemplates'.format(os.sep, sourceDir),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
815 cfg['ericCodeTemplatesDir'],
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 390
diff changeset
816 ['*.tmpl'])
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
817 copyTree(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
818 '{1}{0}Examples'.format(os.sep, sourceDir), cfg['ericExamplesDir'],
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 390
diff changeset
819 ['*.py', '*.pyc', '*.pyo'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821 # copy the wrappers
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
822 for wname in wnames:
2177
a59ffbc5fe4c Fixed an error in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2160
diff changeset
823 shutilCopy(wname, cfg['bindir'], perm=0o755)
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
824 os.remove(wname)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
825
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
826 # copy the license file
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
827 shutilCopy(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
828 '{1}{0}LICENSE.GPL3'.format(os.sep, sourceDir), cfg['ericDir'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
829
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830 # create the global plugins directory
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831 createGlobalPluginsDir()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832
2420
c5a0bc75d5b6 Fixed an issue in the install script.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2411
diff changeset
833 except (IOError, OSError) as msg:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
834 sys.stderr.write(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
835 'Error: {0}\nTry install with admin rights.\n'.format(msg))
2383
e999256385bd Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2312
diff changeset
836 return(7)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 # copy some text files to the doc area
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839 for name in ["LICENSE.GPL3", "THANKS", "changelog"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 try:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
841 shutilCopy(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
842 '{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericDocDir'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
843 except EnvironmentError:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
844 print("Could not install '{2}{0}{1}'.".format(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
845 os.sep, name, sourceDir))
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
846 for name in glob.glob(os.path.join(sourceDir, 'README*.*')):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 try:
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
848 shutilCopy(name, cfg['ericDocDir'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 except EnvironmentError:
4512
23e8b848efb0 Fixed some incorrect string format strings using the new checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4456
diff changeset
850 print("Could not install '{0}'.".format(name))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 # copy some more stuff
1455
f708ac785a89 Corrected the install script for the QScintilla 2.6 changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1410
diff changeset
853 for name in ['default.e4k', 'default_Mac.e4k']:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 try:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
855 shutilCopy(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
856 '{2}{0}{1}'.format(os.sep, name, sourceDir),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
857 cfg['ericOthersDir'])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 except EnvironmentError:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
859 print("Could not install '{2}{0}{1}'.".format(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
860 os.sep, name, sourceDir))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
861
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
862 # install the API file
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
863 if installApis:
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
864 for progLanguage in progLanguages:
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
865 apidir = os.path.join(cfg['apidir'], progLanguage.lower())
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
866 print("Installing {0} API files to '{1}'.".format(
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
867 progLanguage, apidir))
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
868 if not os.path.exists(apidir):
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
869 os.makedirs(apidir)
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
870 for apiName in glob.glob(os.path.join(sourceDir, "APIs",
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
871 progLanguage, "*.api")):
40
c2e5472b112c Changed some code to adjust eric5 to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 21
diff changeset
872 try:
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
873 shutilCopy(apiName, apidir)
40
c2e5472b112c Changed some code to adjust eric5 to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 21
diff changeset
874 except EnvironmentError:
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
875 print("Could not install '{0}' (no permission)."
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
876 .format(apiName))
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
877 for apiName in glob.glob(os.path.join(sourceDir, "APIs",
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
878 progLanguage, "*.bas")):
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
879 try:
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
880 shutilCopy(apiName, apidir)
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
881 except EnvironmentError:
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
882 print("Could not install '{0}' (no permission)."
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
883 .format(apiName))
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
884 if progLanguage == "Python":
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
885 # copy Python3 API files to the same destination
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
886 for apiName in glob.glob(os.path.join(sourceDir, "APIs",
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
887 "Python3", "*.api")):
3697
c947a7eaace4 Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3693
diff changeset
888 try:
c947a7eaace4 Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3693
diff changeset
889 shutilCopy(apiName, apidir)
c947a7eaace4 Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3693
diff changeset
890 except EnvironmentError:
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
891 print("Could not install '{0}' (no permission)."
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
892 .format(apiName))
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
893 for apiName in glob.glob(os.path.join(sourceDir, "APIs",
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
894 "Python3", "*.bas")):
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
895 if os.path.exists(os.path.join(
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
896 apidir, os.path.basename(
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
897 apiName.replace(".bas", ".api")))):
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
898 try:
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
899 shutilCopy(apiName, apidir)
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
900 except EnvironmentError:
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
901 print("Could not install '{0}' (no permission)."
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
902 .format(apiName))
146
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 133
diff changeset
903
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 133
diff changeset
904 # create menu entry for Linux systems
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 133
diff changeset
905 if sys.platform.startswith("linux"):
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
906 if includePythonVariant:
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
907 marker = PythonMarkers[sys.version_info.major]
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
908 else:
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
909 marker = ""
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
910
386
58c14f563abc Fixed an issue in the install.py script where some paths didn't honour the distDir settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 382
diff changeset
911 if distDir:
473
b314592e3d79 Corrected an issue in the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 441
diff changeset
912 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps"))
b314592e3d79 Corrected an issue in the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 441
diff changeset
913 if not os.path.exists(dst):
b314592e3d79 Corrected an issue in the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 441
diff changeset
914 os.makedirs(dst)
3607
0baeb7c76a5b Corrected an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3597
diff changeset
915 shutilCopy(
0baeb7c76a5b Corrected an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3597
diff changeset
916 os.path.join(sourceDir, "icons", "default", "eric.png"),
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
917 os.path.join(dst, "eric" + marker + ".png"))
3607
0baeb7c76a5b Corrected an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3597
diff changeset
918 shutilCopy(
0baeb7c76a5b Corrected an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3597
diff changeset
919 os.path.join(sourceDir, "icons", "default", "ericWeb48.png"),
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
920 os.path.join(dst, "ericWeb" + marker + ".png"))
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
921 dst = os.path.normpath(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
922 os.path.join(distDir, "usr/share/applications"))
473
b314592e3d79 Corrected an issue in the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 441
diff changeset
923 if not os.path.exists(dst):
b314592e3d79 Corrected an issue in the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 441
diff changeset
924 os.makedirs(dst)
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
925 copyDesktopFile(os.path.join(sourceDir, "eric6.desktop"),
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
926 os.path.join(dst, "eric6" + marker + ".desktop"),
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
927 marker)
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
928 copyDesktopFile(
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
929 os.path.join(sourceDir, "eric6_webbrowser.desktop"),
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
930 os.path.join(dst, "eric6_webbrowser" + marker + ".desktop"),
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
931 marker)
4806
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
932 copyDesktopFile(
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
933 os.path.join(sourceDir, "eric6_browser.desktop"),
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
934 os.path.join(dst, "eric6_browser" + marker + ".desktop"),
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
935 marker)
3609
5f17196652d5 Added an appdata file for the IDE to be installed on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3607
diff changeset
936 dst = os.path.normpath(
5102
9cc5217881ab Changed install script to install the metadata file in the new standard location.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
937 os.path.join(distDir, "usr/share/metainfo"))
3609
5f17196652d5 Added an appdata file for the IDE to be installed on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3607
diff changeset
938 if not os.path.exists(dst):
5f17196652d5 Added an appdata file for the IDE to be installed on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3607
diff changeset
939 os.makedirs(dst)
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
940 copyAppStreamFile(
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
941 os.path.join(sourceDir, "eric6.appdata.xml"),
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
942 os.path.join(dst, "eric6" + marker + ".appdata.xml"),
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
943 marker)
3751
3b5476d5420c Improved install script for non-root installations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3724
diff changeset
944 elif os.getuid() == 0:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
945 shutilCopy(os.path.join(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
946 sourceDir, "icons", "default", "eric.png"),
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
947 "/usr/share/pixmaps/eric" + marker + ".png")
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
948 copyDesktopFile(
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
949 os.path.join(sourceDir, "eric6.desktop"),
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
950 "/usr/share/applications/eric6" + marker + ".desktop",
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
951 marker)
5102
9cc5217881ab Changed install script to install the metadata file in the new standard location.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
952 if os.path.exists("/usr/share/metainfo"):
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
953 copyAppStreamFile(
5102
9cc5217881ab Changed install script to install the metadata file in the new standard location.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
954 os.path.join(sourceDir, "eric6.appdata.xml"),
9cc5217881ab Changed install script to install the metadata file in the new standard location.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
955 "/usr/share/metainfo/eric6" + marker + ".appdata.xml",
9cc5217881ab Changed install script to install the metadata file in the new standard location.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
956 marker)
9cc5217881ab Changed install script to install the metadata file in the new standard location.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
957 elif os.path.exists("/usr/share/appdata"):
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
958 copyAppStreamFile(
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
959 os.path.join(sourceDir, "eric6.appdata.xml"),
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
960 "/usr/share/appdata/eric6" + marker + ".appdata.xml",
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
961 marker)
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
962 shutilCopy(os.path.join(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
963 sourceDir, "icons", "default", "ericWeb48.png"),
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
964 "/usr/share/pixmaps/ericWeb" + marker + ".png")
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
965 copyDesktopFile(
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
966 os.path.join(sourceDir, "eric6_webbrowser.desktop"),
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
967 "/usr/share/applications/eric6_webbrowser" + marker +
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
968 ".desktop",
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
969 marker)
4806
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
970 copyDesktopFile(
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
971 os.path.join(sourceDir, "eric6_browser.desktop"),
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
972 "/usr/share/applications/eric6_browser" + marker +
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
973 ".desktop",
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4800
diff changeset
974 marker)
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
975 elif os.getuid() >= 1000:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
976 # it is assumed, that user ids start at 1000
6216
2a0eeba143e7 install script: corrected the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6214
diff changeset
977 localPath = os.path.join(os.path.expanduser("~"),
2a0eeba143e7 install script: corrected the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6214
diff changeset
978 ".local", "share")
6214
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
979 # create directories first
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
980 for directory in [os.path.join(localPath, name)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
981 for name in ("pixmaps", "applications",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
982 "metainfo", "appdata")]:
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
983 if not os.path.isdir(directory):
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
984 os.makedirs(directory)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
985 # now copy the files
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
986 shutilCopy(
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
987 os.path.join(sourceDir, "icons", "default", "eric.png"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
988 os.path.join(localPath, "pixmaps", "eric" + marker + ".png"))
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
989 copyDesktopFile(
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
990 os.path.join(sourceDir, "eric6.desktop"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
991 os.path.join(localPath, "applications",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
992 "eric6" + marker + ".desktop"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
993 marker)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
994 copyAppStreamFile(
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
995 os.path.join(sourceDir, "eric6.appdata.xml"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
996 os.path.join(localPath, "metainfo",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
997 "eric6" + marker + ".appdata.xml"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
998 marker)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
999 copyAppStreamFile(
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1000 os.path.join(sourceDir, "eric6.appdata.xml"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1001 os.path.join(localPath, "appdata",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1002 "eric6" + marker + ".appdata.xml"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1003 marker)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1004 shutilCopy(
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1005 os.path.join(sourceDir, "icons", "default", "ericWeb48.png"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1006 os.path.join(localPath, "pixmaps",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1007 "ericWeb" + marker + ".png"))
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1008 copyDesktopFile(
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1009 os.path.join(sourceDir, "eric6_webbrowser.desktop"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1010 os.path.join(localPath, "applications",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1011 "eric6_webbrowser" + marker + ".desktop"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1012 marker)
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1013 copyDesktopFile(
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1014 os.path.join(sourceDir, "eric6_browser.desktop"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1015 os.path.join(localPath, "applications",
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1016 "eric6_browser" + marker + ".desktop"),
89a53d80e729 install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6213
diff changeset
1017 marker)
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1018
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1019 # Create a Mac application bundle
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1020 if sys.platform == "darwin":
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1021 createMacAppBundle(cfg['ericDir'])
2383
e999256385bd Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2312
diff changeset
1022
e999256385bd Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2312
diff changeset
1023 return 0
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1024
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1025
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1026 def createMacAppBundle(pydir):
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1027 """
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1028 Create a Mac application bundle.
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1029
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1030 @param pydir the name of the directory where the Python script will
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1031 eventually be installed (string)
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1032 """
4374
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1033 global cfg, sourceDir, macAppBundleName, macPythonExe, macAppBundlePath, \
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1034 pyqtVariant
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1035
3507
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1036 dirs = {
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1037 "contents": "{0}/{1}/Contents/".format(
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1038 macAppBundlePath, macAppBundleName),
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1039 "exe": "{0}/{1}/Contents/MacOS".format(
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1040 macAppBundlePath, macAppBundleName),
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1041 "icns": "{0}/{1}/Contents/Resources".format(
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1042 macAppBundlePath, macAppBundleName)
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1043 }
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1044 os.makedirs(dirs["contents"])
3510
31d7e522ecb2 Yet another fix for the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3509
diff changeset
1045 os.makedirs(dirs["exe"])
31d7e522ecb2 Yet another fix for the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3509
diff changeset
1046 os.makedirs(dirs["icns"])
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1047
3955
9c3e54d351e2 Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3950
diff changeset
1048 if macPythonExe == defaultMacPythonExe:
2308
f83826045e51 Change install.py for Mac again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2307
diff changeset
1049 starter = os.path.join(dirs["exe"], "eric")
f83826045e51 Change install.py for Mac again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2307
diff changeset
1050 os.symlink(macPythonExe, starter)
f83826045e51 Change install.py for Mac again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2307
diff changeset
1051 else:
3612
786d97a08a14 Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3609
diff changeset
1052 starter = "python{0}".format(sys.version_info.major)
1488
de290ce82a75 Finally managed the issue with showing the correct name for the Mac OS X application menu entry in the main menu bar.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1474
diff changeset
1053
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1054 wname = os.path.join(dirs["exe"], "eric6")
4374
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1055
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1056 # determine entry for DYLD_FRAMEWORK_PATH
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1057 dyldLine = ""
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1058 try:
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1059 if pyqtVariant == "PyQt4":
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1060 from PyQt4.QtCore import QLibraryInfo
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1061 else:
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1062 from PyQt5.QtCore import QLibraryInfo
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1063 qtLibraryDir = QLibraryInfo.location(QLibraryInfo.LibrariesPath)
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1064 except ImportError:
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1065 qtLibraryDir = ""
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1066 if qtLibraryDir:
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1067 dyldLine = "DYLD_FRAMEWORK_PATH={0}\n".format(qtLibraryDir)
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1068
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1069 # determine entry for PATH
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1070 pathLine = ""
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1071 path = os.getenv("PATH", "")
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1072 if path:
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1073 pybin = os.path.join(sys.exec_prefix, "bin")
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1074 pathlist = path.split(os.pathsep)
4911
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1075 pathlist_n = [pybin]
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1076 for path_ in pathlist:
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1077 if path_ and path_ not in pathlist_n:
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1078 pathlist_n.append(path_)
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1079 pathLine = "PATH={0}\n".format(os.pathsep.join(pathlist_n))
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1080
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1081 # create the wrapper script
4374
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1082 wrapper = ('''#!/bin/sh\n'''
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1083 '''\n'''
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1084 '''{0}'''
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1085 '''{1}'''
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1086 '''exec "{2}" "{3}/{4}.py" "$@"\n'''
627e3d0b4ba1 Changed the installer to create a Mac app bundle script containg a DYLD_FRAMEWORK_PATH line as recommended by PyQt for Qt 5.5.0 and newer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4307
diff changeset
1087 .format(pathLine, dyldLine, starter, pydir, "eric6"))
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1088 copyToFile(wname, wrapper)
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1089 os.chmod(wname, 0o755)
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1090
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
1091 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"),
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
1092 os.path.join(dirs["icns"], "eric.icns"))
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1093
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
1094 copyToFile(
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1095 os.path.join(dirs["contents"], "Info.plist"),
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1096 '''<?xml version="1.0" encoding="UTF-8"?>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1097 '''<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1098 ''' "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1099 '''<plist version="1.0">\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1100 '''<dict>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1101 ''' <key>CFBundleExecutable</key>\n'''
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1102 ''' <string>eric6</string>\n'''
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1103 ''' <key>CFBundleIconFile</key>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1104 ''' <string>eric.icns</string>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1105 ''' <key>CFBundleInfoDictionaryVersion</key>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1106 ''' <string>1.0</string>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1107 ''' <key>CFBundleName</key>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1108 ''' <string>{0}</string>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1109 ''' <key>CFBundleDisplayName</key>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1110 ''' <string>{0}</string>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1111 ''' <key>CFBundlePackageType</key>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1112 ''' <string>APPL</string>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1113 ''' <key>CFBundleSignature</key>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1114 ''' <string>????</string>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1115 ''' <key>CFBundleVersion</key>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1116 ''' <string>1.0</string>\n'''
3950
6819272cafd5 Fixed an issue in the install script creating the Mac application bundle file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3948
diff changeset
1117 ''' <key>CFBundleIdentifier</key>\n'''
3897
ae4d4d69ad40 Extended the Mac Info.plist file contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3807
diff changeset
1118 ''' <string>org.python-projects.eric-ide</string>\n'''
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1119 '''</dict>\n'''
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1120 '''</plist>\n'''.format(macAppBundleName.replace(".app", "")))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1121
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1122
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1123 def createInstallConfig():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1124 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1125 Create the installation config dictionary.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1126 """
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1127 global modDir, platBinDir, cfg, apisDir, installApis
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1128
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1129 ericdir = os.path.join(modDir, "eric6")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1130 cfg = {
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1131 'ericDir': ericdir,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1132 'ericPixDir': os.path.join(ericdir, "pixmaps"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1133 'ericIconDir': os.path.join(ericdir, "icons"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1134 'ericDTDDir': os.path.join(ericdir, "DTDs"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1135 'ericCSSDir': os.path.join(ericdir, "CSSs"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1136 'ericStylesDir': os.path.join(ericdir, "Styles"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1137 'ericDocDir': os.path.join(ericdir, "Documentation"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1138 'ericExamplesDir': os.path.join(ericdir, "Examples"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1139 'ericTranslationsDir': os.path.join(ericdir, "i18n"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1140 'ericTemplatesDir': os.path.join(ericdir, "DesignerTemplates"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1141 'ericCodeTemplatesDir': os.path.join(ericdir, 'CodeTemplates'),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1142 'ericOthersDir': ericdir,
2586
d6daabefb7a6 Reverted some of the install.py changes for Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2583
diff changeset
1143 'bindir': platBinDir,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1144 'mdir': modDir,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1145 }
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1146 if installApis:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1147 if apisDir:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1148 cfg['apidir'] = apisDir
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1149 else:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1150 cfg['apidir'] = os.path.join(ericdir, "api")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1151 else:
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1152 cfg['apidir'] = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1153 configLength = 15
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1154
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1155
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1156 def createConfig():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1157 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1158 Create a config file with the respective config entries.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1159 """
3507
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1160 global cfg, sourceDir, macAppBundlePath
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1161
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1162 apis = []
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1163 if installApis:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1164 for progLanguage in progLanguages:
5810
12d917813110 Little change to the install script to support the reproducible builds effort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5711
diff changeset
1165 for apiName in sorted(glob.glob(
12d917813110 Little change to the install script to support the reproducible builds effort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5711
diff changeset
1166 os.path.join(sourceDir, "APIs", progLanguage, "*.api"))):
40
c2e5472b112c Changed some code to adjust eric5 to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 21
diff changeset
1167 apis.append(os.path.basename(apiName))
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1168 if progLanguage == "Python":
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1169 # treat Python3 API files the same as Python API files
5810
12d917813110 Little change to the install script to support the reproducible builds effort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5711
diff changeset
1170 for apiName in sorted(glob.glob(
12d917813110 Little change to the install script to support the reproducible builds effort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5711
diff changeset
1171 os.path.join(sourceDir, "APIs", "Python3", "*.api"))):
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1172 apis.append(os.path.basename(apiName))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1173
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1174 fn = 'eric6config.py'
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1175 config = (
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1176 """# -*- coding: utf-8 -*-\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1177 """#\n"""
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1178 """# This module contains the configuration of the individual eric6"""
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1179 """ installation\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1180 """#\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1181 """\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1182 """_pkg_config = {{\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1183 """ 'ericDir': r'{0}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1184 """ 'ericPixDir': r'{1}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1185 """ 'ericIconDir': r'{2}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1186 """ 'ericDTDDir': r'{3}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1187 """ 'ericCSSDir': r'{4}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1188 """ 'ericStylesDir': r'{5}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1189 """ 'ericDocDir': r'{6}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1190 """ 'ericExamplesDir': r'{7}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1191 """ 'ericTranslationsDir': r'{8}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1192 """ 'ericTemplatesDir': r'{9}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1193 """ 'ericCodeTemplatesDir': r'{10}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1194 """ 'ericOthersDir': r'{11}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1195 """ 'bindir': r'{12}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1196 """ 'mdir': r'{13}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1197 """ 'apidir': r'{14}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1198 """ 'apis': {15},\n"""
3508
4861f0bb3509 Corrected the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3507
diff changeset
1199 """ 'macAppBundlePath': r'{16}',\n"""
4861f0bb3509 Corrected the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3507
diff changeset
1200 """ 'macAppBundleName': r'{17}',\n"""
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1201 """}}\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1202 """\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1203 """def getConfig(name):\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1204 """ '''\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1205 """ Module function to get a configuration value.\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1206 """\n"""
5628
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1207 """ @param name name of the configuration value"""
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1208 """ @type str\n"""
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1209 """ @exception AttributeError raised to indicate an invalid"""
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1210 """ config entry\n"""
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1211 """ '''\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1212 """ try:\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1213 """ return _pkg_config[name]\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1214 """ except KeyError:\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1215 """ pass\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1216 """\n"""
5628
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1217 """ raise AttributeError(\n"""
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1218 """ '"{{0}}" is not a valid configuration value'"""
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1219 """.format(name))\n"""
3507
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1220 ).format(
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1221 cfg['ericDir'], cfg['ericPixDir'], cfg['ericIconDir'],
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1222 cfg['ericDTDDir'], cfg['ericCSSDir'],
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1223 cfg['ericStylesDir'], cfg['ericDocDir'],
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1224 cfg['ericExamplesDir'], cfg['ericTranslationsDir'],
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1225 cfg['ericTemplatesDir'],
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1226 cfg['ericCodeTemplatesDir'], cfg['ericOthersDir'],
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1227 cfg['bindir'], cfg['mdir'],
5652
d1b65f380408 Introduced a change in the install.py script for the Reproducible Builds effort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5651
diff changeset
1228 cfg['apidir'], sorted(apis),
3507
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1229 macAppBundlePath, macAppBundleName,
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1230 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1231 copyToFile(fn, config)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1232
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1233
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1234 def pipInstall(packageName, message):
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1235 """
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1236 Install the given package via pip.
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1237
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1238 @param packageName name of the package to be installed
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1239 @type str
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1240 @param message message to be shown to the user
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1241 @type str
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1242 @return flag indicating a successful installation
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1243 @rtype bool
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1244 """
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1245 ok = False
6316
ee88310f0334 install.py: fix for input() overwriting some variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6304
diff changeset
1246 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)"
ee88310f0334 install.py: fix for input() overwriting some variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6304
diff changeset
1247 .format(message, packageName), end=" ")
6347
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1248 if sys.version_info[0] == 2:
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1249 answer = raw_input() # __IGNORE_WARNING__
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1250 else:
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1251 answer = input()
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1252 if answer in ("", "Y", "y"):
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1253 exitCode = subprocess.call(
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1254 [sys.executable, "-m", "pip", "install", packageName])
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1255 ok = (exitCode == 0)
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1256
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1257 return ok
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1258
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1259
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1260 def doDependancyChecks():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1261 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1262 Perform some dependency checks.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1263 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1264 print('Checking dependencies')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1265
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1266 # perform dependency checks
4173
10336d4d1488 Modified install script to show the version info before giving an error in case of unsuitable versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4054
diff changeset
1267 print("Python Version: {0:d}.{1:d}.{2:d}".format(*sys.version_info[:3]))
5675
c6bfe7b10b01 Increased minimum required Python versions to prevent usage with very old versions (i.e. eric was never tested with).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5652
diff changeset
1268 if sys.version_info < (2, 7, 10):
c6bfe7b10b01 Increased minimum required Python versions to prevent usage with very old versions (i.e. eric was never tested with).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5652
diff changeset
1269 print('Sorry, you must have Python 2.7.10 or higher or '
c6bfe7b10b01 Increased minimum required Python versions to prevent usage with very old versions (i.e. eric was never tested with).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5652
diff changeset
1270 'Python 3.4.0 or higher.')
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
1271 exit(5)
5675
c6bfe7b10b01 Increased minimum required Python versions to prevent usage with very old versions (i.e. eric was never tested with).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5652
diff changeset
1272 elif sys.version_info < (3, 4, 0) and sys.version_info[0] == 3:
c6bfe7b10b01 Increased minimum required Python versions to prevent usage with very old versions (i.e. eric was never tested with).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5652
diff changeset
1273 print('Sorry, you must have Python 3.4.0 or higher.')
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
1274 exit(5)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
1275 if sys.version_info > (3, 9, 9):
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1276 print('Sorry, eric6 requires Python 3 or Python 2 for running.')
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
1277 exit(5)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1278
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1279 try:
1525
1c7bd9144f43 Updated the install script to check for the presence of the xml.etree package, which is sometimes included in a separate installation package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1280 import xml.etree # __IGNORE_WARNING__
6360
73033fa6a99c Fixed some pyflakes warnings detected by the upgraded version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6347
diff changeset
1281 except ImportError:
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
1282 print('Your Python installation is missing the XML module.')
1525
1c7bd9144f43 Updated the install script to check for the presence of the xml.etree package, which is sometimes included in a separate installation package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1283 print('Please install it and try again.')
1c7bd9144f43 Updated the install script to check for the presence of the xml.etree package, which is sometimes included in a separate installation package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1284 exit(5)
1c7bd9144f43 Updated the install script to check for the presence of the xml.etree package, which is sometimes included in a separate installation package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1285
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1286 if pyqtVariant == "PyQt4":
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1287 try:
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1288 from PyQt4.QtCore import qVersion
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1289 except ImportError as msg:
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1290 print('Sorry, please install PyQt4.')
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1291 print('Error: {0}'.format(msg))
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1292 exit(1)
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1293 print("Found PyQt4")
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1294 else:
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1295 try:
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1296 from PyQt5.QtCore import qVersion
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1297 except ImportError as msg:
6347
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1298 if sys.version_info[0] == 2:
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1299 # no PyQt5 wheels available for Python 2
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1300 installed = False
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1301 else:
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1302 installed = pipInstall(
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1303 "PyQt5",
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1304 "PyQt5 could not be detected.\nError: {0}".format(msg)
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1305 )
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1306 if installed:
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1307 # try to import it again
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1308 try:
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1309 from PyQt5.QtCore import qVersion
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1310 except ImportError as msg:
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1311 print('Sorry, please install PyQt5.')
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1312 print('Error: {0}'.format(msg))
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1313 exit(1)
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1314 else:
6347
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1315 print('Sorry, please install PyQt5.')
bcca9eba56a1 install.py: fixed input() issue again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6322
diff changeset
1316 print('Error: {0}'.format(msg))
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1317 exit(1)
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1318 print("Found PyQt5")
837
10547522aa98 Added a check for QtHelp to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 796
diff changeset
1319
10547522aa98 Added a check for QtHelp to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 796
diff changeset
1320 try:
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1321 if pyqtVariant == "PyQt4":
4800
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1322 pyuic = "pyuic4"
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1323 from PyQt4 import uic # __IGNORE_WARNING__
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1324 else:
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1325 pyuic = "pyuic5"
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1326 from PyQt5 import uic # __IGNORE_WARNING__
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1327 except ImportError as msg:
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1328 print("Sorry, {0} is not installed.".format(pyuic))
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1329 print('Error: {0}'.format(msg))
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1330 exit(1)
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1331 print("Found {0}".format(pyuic))
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1332
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1333 try:
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1334 if pyqtVariant == "PyQt4":
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1335 from PyQt4 import Qsci # __IGNORE_WARNING__
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1336 else:
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1337 from PyQt5 import Qsci # __IGNORE_WARNING__
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1338 except ImportError as msg:
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1339 if pyqtVariant == "PyQt4":
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1340 message = str(msg)
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1341 else:
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1342 installed = pipInstall(
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1343 "QScintilla",
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1344 "QScintilla could not be detected.\nError: {0}".format(msg)
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1345 )
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1346 if installed:
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1347 # try to import it again
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1348 try:
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1349 from PyQt5 import Qsci # __IGNORE_WARNING__
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1350 message = None
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1351 except ImportError as msg:
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1352 message = str(msg)
6322
cb7d2ab9c9f5 install.py: fixed an issue caused by using a variable before it was set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6316
diff changeset
1353 else:
cb7d2ab9c9f5 install.py: fixed an issue caused by using a variable before it was set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6316
diff changeset
1354 message = "QScintilla could not be installed."
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1355 if message:
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1356 print("Sorry, please install QScintilla2 and")
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1357 print("its PyQt5/PyQt4 wrapper.")
6429
296b0e5d5a76 install: fixed an issue printing an error message in case QScintilla is not detected and could not be installed via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6365
diff changeset
1358 print('Error: {0}'.format(message))
6211
4f0e08c95ca9 install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6208
diff changeset
1359 exit(1)
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1360 print("Found QScintilla2")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1361
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1362 if pyqtVariant == "PyQt4":
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1363 impModulesList = [
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1364 "PyQt4.QtGui", "PyQt4.QtNetwork", "PyQt4.QtSql",
5963
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1365 "PyQt4.QtSvg", "PyQt4.QtWebKit",
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1366 ]
5963
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1367 altModulesList = []
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1368 else:
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1369 impModulesList = [
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1370 "PyQt5.QtGui", "PyQt5.QtNetwork", "PyQt5.QtPrintSupport",
4619
aa2319888257 Prepared the code for missing QtWebKit (starting from Qt 5.6).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4608
diff changeset
1371 "PyQt5.QtSql", "PyQt5.QtSvg", "PyQt5.QtWidgets",
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1372 ]
5963
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1373 altModulesList = [
6476
d13d573c2da4 install: modified to allow installation on systems not having QtWebEngine or QtWebKit available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6429
diff changeset
1374 # Tuple with alternatives, flag indicating it's ok to not be
d13d573c2da4 install: modified to allow installation on systems not having QtWebEngine or QtWebKit available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6429
diff changeset
1375 # available (e.g. for 32-Bit Windows)
d13d573c2da4 install: modified to allow installation on systems not having QtWebEngine or QtWebKit available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6429
diff changeset
1376 (("PyQt5.QtWebEngineWidgets", "PyQt5.QtWebKitWidgets"),
d13d573c2da4 install: modified to allow installation on systems not having QtWebEngine or QtWebKit available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6429
diff changeset
1377 sys.maxsize <= 2**32),
5963
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1378 ]
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1379 # check mandatory modules
3681
3a79355b9ca5 Fixed a bugs in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3678
diff changeset
1380 modulesOK = True
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1381 for impModule in impModulesList:
2312
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1382 name = impModule.split(".")[1]
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1383 try:
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1384 __import__(impModule)
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1385 print("Found", name)
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1386 except ImportError as msg:
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1387 print('Sorry, please install {0}.'.format(name))
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1388 print('Error: {0}'.format(msg))
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1389 modulesOK = False
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1390 if not modulesOK:
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1391 exit(1)
5963
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1392 # check mandatory modules with alternatives
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1393 if altModulesList:
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1394 altModulesOK = True
6476
d13d573c2da4 install: modified to allow installation on systems not having QtWebEngine or QtWebKit available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6429
diff changeset
1395 for altModules, forcedOk in altModulesList:
5963
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1396 modulesOK = False
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1397 for altModule in altModules:
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1398 name = altModule.split(".")[1]
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1399 try:
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1400 __import__(altModule)
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1401 print("Found", name)
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1402 modulesOK = True
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1403 break
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1404 except ImportError:
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1405 pass
6476
d13d573c2da4 install: modified to allow installation on systems not having QtWebEngine or QtWebKit available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6429
diff changeset
1406 if not modulesOK and not forcedOk:
5963
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1407 altModulesOK = False
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1408 print('Sorry, please install {0}.'
5992
d184ca2d3a95 Fixed a bug in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5976
diff changeset
1409 .format(" or ".join(altModules)))
5963
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1410 if not altModulesOK:
14522ec8cd08 Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5810
diff changeset
1411 exit(1)
2312
976dcb82c3e9 Extended the dependancy check of the install script because some distributions have Qt4 (or Qt5) cut into a bunch of little pieces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2308
diff changeset
1412
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1413 # determine the platform dependent black list
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1414 if sys.platform.startswith("win"):
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1415 PlatformBlackLists = PlatformsBlackLists["windows"]
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1416 elif sys.platform.startswith("linux"):
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1417 PlatformBlackLists = PlatformsBlackLists["linux"]
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1418 else:
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1419 PlatformBlackLists = PlatformsBlackLists["mac"]
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1420
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1421 # check version of Qt
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1422 qtMajor = int(qVersion().split('.')[0])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1423 qtMinor = int(qVersion().split('.')[1])
4173
10336d4d1488 Modified install script to show the version info before giving an error in case of unsuitable versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4054
diff changeset
1424 print("Qt Version: {0}".format(qVersion().strip()))
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1425 if qtMajor < 4 or \
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1426 (qtMajor == 4 and qtMinor < 8) or \
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1427 (qtMajor == 5 and qtMinor < 3):
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1428 print('Sorry, you must have Qt version 4.8.0 or better or')
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1429 print('5.3.0 or better.')
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
1430 exit(2)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1431
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1432 # check version of sip
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1433 try:
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6360
diff changeset
1434 try:
6365
85f8745427a6 Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6364
diff changeset
1435 from PyQt5 import sip
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6360
diff changeset
1436 except ImportError:
6365
85f8745427a6 Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6364
diff changeset
1437 import sip
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1438 sipVersion = sip.SIP_VERSION_STR
4178
0d882b1e0c11 A little tweak to the version outputs of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4173
diff changeset
1439 print("sip Version:", sipVersion.strip())
4889
10cec9d5aa91 Fixed an issue in the install script caused by the new PyQt naming scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
1440 # always assume, that snapshots or dev versions are new enough
10cec9d5aa91 Fixed an issue in the install script caused by the new PyQt naming scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
1441 if "snapshot" not in sipVersion and "dev" not in sipVersion:
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1442 while sipVersion.count('.') < 2:
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1443 sipVersion += '.0'
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1444 (major, minor, pat) = sipVersion.split('.')
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1445 major = int(major)
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1446 minor = int(minor)
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1447 pat = int(pat)
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1448 if major < 4 or (major == 4 and minor < 14) or \
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1449 (major == 4 and minor == 14 and pat < 2):
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1450 print('Sorry, you must have sip 4.14.2 or higher or'
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1451 ' a recent snapshot release.')
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1452 exit(3)
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1453 # check for blacklisted versions
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1454 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]:
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1455 if vers == sipVersion:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1456 print(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1457 'Sorry, sip version {0} is not compatible with eric6.'
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1458 .format(vers))
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1459 print('Please install another version.')
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1460 exit(3)
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1461 except (ImportError, AttributeError):
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1462 pass
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1463
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1464 # check version of PyQt
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1465 if pyqtVariant == "PyQt4":
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1466 from PyQt4.QtCore import PYQT_VERSION_STR
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1467 else:
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1468 from PyQt5.QtCore import PYQT_VERSION_STR
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1469 pyqtVersion = PYQT_VERSION_STR
4178
0d882b1e0c11 A little tweak to the version outputs of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4173
diff changeset
1470 print("PyQt Version:", pyqtVersion.strip())
4889
10cec9d5aa91 Fixed an issue in the install script caused by the new PyQt naming scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
1471 # always assume, that snapshots or dev versions are new enough
10cec9d5aa91 Fixed an issue in the install script caused by the new PyQt naming scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
1472 if "snapshot" not in pyqtVersion and "dev" not in pyqtVersion:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1473 while pyqtVersion.count('.') < 2:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1474 pyqtVersion += '.0'
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1475 (major, minor, pat) = pyqtVersion.split('.')
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1476 major = int(major)
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1477 minor = int(minor)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1478 pat = int(pat)
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1479 if major < 4 or \
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1480 (major == 4 and minor < 10) or \
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1481 (major == 5 and minor < 3):
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1482 print('Sorry, you must have PyQt 4.10.0 or better or')
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1483 print('PyQt 5.3.0 or better or'
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1484 ' a recent snapshot release.')
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1485 exit(4)
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1486 # check for blacklisted versions
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1487 for vers in BlackLists[pyqtVariant] + PlatformBlackLists[pyqtVariant]:
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1488 if vers == pyqtVersion:
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1489 print('Sorry, PyQt version {0} is not compatible with eric6.'
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1490 .format(vers))
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1491 print('Please install another version.')
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1492 exit(4)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1493
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1494 # check version of QScintilla
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1495 if pyqtVariant == "PyQt4":
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1496 from PyQt4.Qsci import QSCINTILLA_VERSION_STR
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1497 else:
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1498 from PyQt5.Qsci import QSCINTILLA_VERSION_STR
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1499 scintillaVersion = QSCINTILLA_VERSION_STR
4178
0d882b1e0c11 A little tweak to the version outputs of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4173
diff changeset
1500 print("QScintilla Version:", QSCINTILLA_VERSION_STR.strip())
4889
10cec9d5aa91 Fixed an issue in the install script caused by the new PyQt naming scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
1501 # always assume, that snapshots or dev versions are new enough
10cec9d5aa91 Fixed an issue in the install script caused by the new PyQt naming scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
1502 if "snapshot" not in scintillaVersion and "dev" not in scintillaVersion:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1503 while scintillaVersion.count('.') < 2:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1504 scintillaVersion += '.0'
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1505 (major, minor, pat) = scintillaVersion.split('.')
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1506 major = int(major)
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1507 minor = int(minor)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1508 pat = int(pat)
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1509 if major < 2 or (major == 2 and minor < 8):
3657
ae833e7fcd6c Adopted the install script for PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
1510 print('Sorry, you must have QScintilla 2.8.0 or higher or'
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1511 ' a recent snapshot release.')
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1512 exit(5)
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1513 # check for blacklisted versions
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1514 for vers in BlackLists["QScintilla2"] + \
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1515 PlatformBlackLists["QScintilla2"]:
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1516 if vers == scintillaVersion:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1517 print(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1518 'Sorry, QScintilla2 version {0} is not compatible with'
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1519 ' eric6.'.format(vers))
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1520 print('Please install another version.')
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1521 exit(5)
4173
10336d4d1488 Modified install script to show the version info before giving an error in case of unsuitable versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4054
diff changeset
1522
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1523 print("All dependencies ok.")
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1524 print()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1525
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1526
4435
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1527 def __pyName(py_dir, py_file):
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1528 """
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1529 Local function to create the Python source file name for the compiled
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1530 .ui file.
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1531
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1532 @param py_dir suggested name of the directory (string)
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1533 @param py_file suggested name for the compile source file (string)
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1534 @return tuple of directory name (string) and source file name (string)
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1535 """
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1536 return py_dir, "Ui_{0}".format(py_file)
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1537
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1538
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1539 def compileUiFiles():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1540 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1541 Compile the .ui files to Python sources.
4435
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1542 """
624
d2ff1cb672eb Fixed a bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 622
diff changeset
1543 global sourceDir
4435
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1544 if pyqtVariant == "PyQt4":
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1545 from PyQt4.uic import compileUiDir
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1546 else:
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1547 from PyQt5.uic import compileUiDir
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1548 compileUiDir(sourceDir, True, __pyName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1549
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1550
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1551 def prepareInfoFile(fileName):
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1552 """
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1553 Function to prepare an Info.py file when installing from source.
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1554
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1555 @param fileName name of the Python file containing the info (string)
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1556 """
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1557 if not fileName:
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1558 return
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1559
4307
6a8ec996a49c Little enhancement of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4239
diff changeset
1560 try:
6a8ec996a49c Little enhancement of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4239
diff changeset
1561 os.rename(fileName, fileName + ".orig")
6a8ec996a49c Little enhancement of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4239
diff changeset
1562 except EnvironmentError:
6a8ec996a49c Little enhancement of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4239
diff changeset
1563 pass
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1564 try:
4239
4883661fc427 Little improvement to the recent install.py change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4238
diff changeset
1565 hgOut = subprocess.check_output(["hg", "identify", "-i"])
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1566 if sys.version_info[0] == 3:
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1567 hgOut = hgOut.decode()
4519
55186d362145 Fixed a little issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4512
diff changeset
1568 except (OSError, subprocess.CalledProcessError):
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1569 hgOut = ""
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1570 if hgOut:
4239
4883661fc427 Little improvement to the recent install.py change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4238
diff changeset
1571 hgOut = hgOut.strip()
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1572 if hgOut.endswith("+"):
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1573 hgOut = hgOut[:-1]
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1574 if sys.version_info[0] == 2:
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1575 f = codecs.open(fileName + ".orig", "r", "utf-8")
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1576 else:
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1577 f = open(fileName + ".orig", "r", encoding="utf-8")
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1578 text = f.read()
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1579 f.close()
4307
6a8ec996a49c Little enhancement of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4239
diff changeset
1580 text = text.replace("@@REVISION@@", hgOut)\
6a8ec996a49c Little enhancement of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4239
diff changeset
1581 .replace("@@VERSION@@", "rev_" + hgOut)
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1582 copyToFile(fileName, text)
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1583 else:
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1584 shutil.copy(fileName + ".orig", fileName)
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1585
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1586
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1587 def main(argv):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1588 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1589 The main function of the script.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1590
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1591 @param argv the list of command line arguments.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1592 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1593 import getopt
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1594
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1595 # Parse the command line.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1596 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
1597 global sourceDir, configName, includePythonVariant
3507
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1598 global macAppBundlePath, macAppBundleName, macPythonExe
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
1599 global pyqtVariant, pyqtOverride, installApis
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1600
3678
2866383fd342 Adjusted the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
1601 if sys.version_info < (2, 7, 0) or sys.version_info > (3, 9, 9):
2866383fd342 Adjusted the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
1602 print('Sorry, eric6 requires at least Python 2.7 or '
3065
070b35dde35e Fixed a bunch of indentation issues.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
1603 'Python 3 for running.')
2690
8ca13f15e1f2 Added a check to the install script to guard against an execution with a Python2 interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2634
diff changeset
1604 exit(5)
8ca13f15e1f2 Added a check to the install script to guard against an execution with a Python2 interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2634
diff changeset
1605
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1606 progName = os.path.basename(argv[0])
1658
c61997a63efe Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1538
diff changeset
1607
1662
dadf3f4ee800 Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1658
diff changeset
1608 if os.path.dirname(argv[0]):
1965
96f5a76e1845 Fixed some PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1914
diff changeset
1609 os.chdir(os.path.dirname(argv[0]))
3778
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1610
0c5bc18da740 Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3758
diff changeset
1611 determinePyQtVariant()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1612 initGlobals()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1613
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1614 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1615 if sys.platform.startswith("win"):
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1616 optlist, args = getopt.getopt(
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
1617 argv[1:], "chxyza:b:d:f:", ["help", "pyqt=", "noapis"])
2306
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
1618 elif sys.platform == "darwin":
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1619 optlist, args = getopt.getopt(
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
1620 argv[1:], "chxyza:b:d:f:i:m:n:p:", ["help", "pyqt=", "noapis"])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1621 else:
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1622 optlist, args = getopt.getopt(
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
1623 argv[1:], "chxyza:b:d:f:i:", ["help", "pyqt=", "noapis"])
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1624 except getopt.GetoptError as err:
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1625 print(err)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1626 usage()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1627
2586
d6daabefb7a6 Reverted some of the install.py changes for Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2583
diff changeset
1628 global platBinDir
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1629
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1630 depChecks = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1631
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1632 for opt, arg in optlist:
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1633 if opt in ["-h", "--help"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1634 usage(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1635 elif opt == "-a":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1636 apisDir = arg
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1637 elif opt == "-b":
2586
d6daabefb7a6 Reverted some of the install.py changes for Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2583
diff changeset
1638 platBinDir = arg
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1639 elif opt == "-d":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1640 modDir = arg
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1641 elif opt == "-i":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1642 distDir = os.path.normpath(arg)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1643 elif opt == "-x":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1644 depChecks = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1645 elif opt == "-c":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1646 doCleanup = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1647 elif opt == "-z":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1648 doCompile = False
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
1649 elif opt == "-y":
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3596
diff changeset
1650 includePythonVariant = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1651 elif opt == "-f":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1652 try:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1653 exec(compile(open(arg).read(), arg, 'exec'), globals())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1654 if len(cfg) != configLength:
2969
0e1af1313b8b Regenerated source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
1655 print("The configuration dictionary in '{0}' is incorrect."
0e1af1313b8b Regenerated source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
1656 " Aborting".format(arg))
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
1657 exit(6)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
1658 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1659 cfg = {}
2306
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
1660 elif opt == "-m":
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
1661 macAppBundleName = arg
3507
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1662 elif opt == "-n":
b09e10d4f343 Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3468
diff changeset
1663 macAppBundlePath = arg
2306
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
1664 elif opt == "-p":
0f020f39977b Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2275
diff changeset
1665 macPythonExe = arg
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1666 elif opt == "--pyqt":
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1667 if arg not in ["4", "5"]:
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1668 print("Invalid PyQt version given; should be 4 or 5. Aborting")
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1669 exit(6)
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
1670 pyqtVariant = "PyQt{0}".format(arg)
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3936
diff changeset
1671 pyqtOverride = True
3943
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
1672 elif "--noapis":
37d88bed7bb9 Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3942
diff changeset
1673 installApis = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1674
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1675 infoName = ""
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1676 installFromSource = not os.path.isdir(sourceDir)
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1677 if installFromSource:
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1678 sourceDir = os.path.dirname(__file__) or "."
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1679 configName = os.path.join(sourceDir, "eric6config.py")
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1680 if os.path.exists(os.path.join(sourceDir, ".hg")):
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1681 # we are installing from source with repo
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1682 infoName = os.path.join(sourceDir, "UI", "Info.py")
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1683 prepareInfoFile(infoName)
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1684
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1685 if len(cfg) == 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1686 createInstallConfig()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1687
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1688 if depChecks:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1689 doDependancyChecks()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1690
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1691 # get rid of development config file, if it exists
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1692 try:
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1693 if installFromSource:
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1694 os.rename(configName, configName + ".orig")
626
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
1695 configNameC = configName + 'c'
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
1696 if os.path.exists(configNameC):
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
1697 os.remove(configNameC)
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1698 os.remove(configName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1699 except EnvironmentError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1700 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1701
3593
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
1702 # cleanup source if installing from source
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
1703 if installFromSource:
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
1704 print("Cleaning up source ...")
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
1705 cleanupSource(sourceDir)
3596
f98e1946c74f Little addition to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3595
diff changeset
1706 print()
3593
e3435c1ce0cf Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3542
diff changeset
1707
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1708 # cleanup old installation
2634
8bd79dfb48a5 Added a few more feedback to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2618
diff changeset
1709 print("Cleaning up old installation ...")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1710 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1711 if doCleanup:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1712 if distDir:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1713 shutil.rmtree(distDir, True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1714 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1715 cleanUp()
2420
c5a0bc75d5b6 Fixed an issue in the install script.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2411
diff changeset
1716 except (IOError, OSError) as msg:
2423
bf4e888d72ab Corrected the last change again.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2421
diff changeset
1717 sys.stderr.write('Error: {0}\nTry install as root.\n'.format(msg))
2421
d3bf4def72d7 Correct the last change.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2420
diff changeset
1718 exit(7)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1719
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1720 # Create a config file and delete the default one
2634
8bd79dfb48a5 Added a few more feedback to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2618
diff changeset
1721 print("\nCreating configuration file ...")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1722 createConfig()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1723
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1724 # Compile .ui files
2634
8bd79dfb48a5 Added a few more feedback to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2618
diff changeset
1725 print("\nCompiling user interface files ...")
2480
30477cebf808 Changed the install script to remove any Ui_*.py file that might exist before recreating them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2428
diff changeset
1726 # step 1: remove old Ui_*.py files
30477cebf808 Changed the install script to remove any Ui_*.py file that might exist before recreating them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2428
diff changeset
1727 for root, _, files in os.walk(sourceDir):
30477cebf808 Changed the install script to remove any Ui_*.py file that might exist before recreating them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2428
diff changeset
1728 for file in [f for f in files if fnmatch.fnmatch(f, 'Ui_*.py')]:
30477cebf808 Changed the install script to remove any Ui_*.py file that might exist before recreating them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2428
diff changeset
1729 os.remove(os.path.join(root, file))
30477cebf808 Changed the install script to remove any Ui_*.py file that might exist before recreating them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2428
diff changeset
1730 # step 2: compile the forms
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1731 compileUiFiles()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1732
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1733 if doCompile:
2634
8bd79dfb48a5 Added a few more feedback to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2618
diff changeset
1734 print("\nCompiling source files ...")
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
1735 # Hide compile errors (mainly because of Py2/Py3 differences)
5180
9eba139a2756 Changed RegEx to be independent from Python version.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5145
diff changeset
1736 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]")
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
1737 sys.stdout = io.StringIO()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1738 if distDir:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
1739 compileall.compile_dir(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
1740 sourceDir,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1741 ddir=os.path.join(distDir, modDir, cfg['ericDir']),
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4915
diff changeset
1742 rx=skipRe,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1743 quiet=True)
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1744 py_compile.compile(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1745 configName,
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1746 dfile=os.path.join(distDir, modDir, "eric6config.py"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1747 else:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
1748 compileall.compile_dir(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
1749 sourceDir,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1750 ddir=os.path.join(modDir, cfg['ericDir']),
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4915
diff changeset
1751 rx=skipRe,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1752 quiet=True)
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1753 py_compile.compile(configName,
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1754 dfile=os.path.join(modDir, "eric6config.py"))
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
1755 sys.stdout = sys.__stdout__
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1756 print("\nInstalling eric6 ...")
2383
e999256385bd Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2312
diff changeset
1757 res = installEric()
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1758
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1759 # do some cleanup
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1760 try:
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1761 if installFromSource:
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1762 os.remove(configName)
626
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
1763 configNameC = configName + 'c'
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
1764 if os.path.exists(configNameC):
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
1765 os.remove(configNameC)
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1766 os.rename(configName + ".orig", configName)
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1767 except EnvironmentError:
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1768 pass
4238
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1769 try:
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1770 if installFromSource and infoName:
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1771 os.remove(infoName)
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1772 infoNameC = infoName + 'c'
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1773 if os.path.exists(infoNameC):
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1774 os.remove(infoNameC)
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1775 os.rename(infoName + ".orig", infoName)
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1776 except EnvironmentError:
53bd830433dc Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4178
diff changeset
1777 pass
622
54c2a58acef4 Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 620
diff changeset
1778
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1779 print("\nInstallation complete.")
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1780 print()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1781
2383
e999256385bd Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2312
diff changeset
1782 exit(res)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1783
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1784
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1785 if __name__ == "__main__":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1786 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1787 main(sys.argv)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1788 except SystemExit:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1789 raise
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
1790 except Exception:
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1791 print("""An internal error occured. Please report all the output"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1792 """ of the program,\nincluding the following traceback, to"""
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3657
diff changeset
1793 """ eric-bugs@eric-ide.python-projects.org.\n""")
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1794 raise
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
1795
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
1796 #
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
1797 # eflag: noqa = M801

eric ide

mercurial