scripts/install.py

Thu, 15 Sep 2022 11:00:36 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 15 Sep 2022 11:00:36 +0200
branch
eric7
changeset 9328
49a0a9cb2505
parent 9314
7ba79b00ea96
child 9347
da982d5b0718
permissions
-rw-r--r--

Fixed some code style issues detected by the new checks.

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
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8821
diff changeset
4 # Copyright (c) 2002 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5 #
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
6 # This is the install script for eric.
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 """
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
9 Installation script for the eric IDE and all eric 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
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
12 import compileall
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
13 import contextlib
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
14 import datetime
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
15 import fnmatch
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
16 import getpass
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
17 import glob
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
18 import io
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
19 import json
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 import os
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
21 import py_compile
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 import re
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
23 import shlex
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 import shutil
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
25 import subprocess # secok
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
26 import time
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
27 import sys
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 # Define the globals.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 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
31 currDir = os.getcwd()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 modDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 pyModDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 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
35 platBinDirOld = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 distDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 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
38 installApis = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 doCleanup = True
6663
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
40 doCleanDesktopLinks = False
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
41 forceCleanDesktopLinks = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 doCompile = True
7333
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
43 yes2All = False
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
44 ignorePyqt6Tools = False
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
45 verbose = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 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
47 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
48 sourceDir = "eric"
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
49 eric7SourceDir = ""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
50 configName = "eric7config.py"
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
51 defaultMacAppBundleName = "eric7.app"
3714
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3705
diff changeset
52 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
53 defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
54 sys.exec_prefix
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
55 )
7584
328d92d8db48 install: fixed an issue causing a faulty application bundle being created for macOS installations when installing into a Python virtual environment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7566
diff changeset
56 if not os.path.exists(defaultMacPythonExe):
328d92d8db48 install: fixed an issue causing a faulty application bundle being created for macOS installations when installing into a Python virtual environment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7566
diff changeset
57 defaultMacPythonExe = ""
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 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
59 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
60 macPythonExe = defaultMacPythonExe
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
62 createInstallInfoFile = True
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
63 installInfoName = "eric7install.json"
7804
1cbc27e34ec6 Implementing code to record and/or guess some information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7799
diff changeset
64 installInfo = {}
7813
5d0dbec7b815 Main Window: added code to update the saved install information after an update.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7812
diff changeset
65 installCwd = ""
7804
1cbc27e34ec6 Implementing code to record and/or guess some information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7799
diff changeset
66
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
67 # 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
68 BlackLists = {
6942
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
69 "sip": [],
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
70 "PyQt6": [],
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": [],
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
76 "PyQt6": [],
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
77 "QScintilla2": [],
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
78 },
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
79 "linux": {
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
80 "sip": [],
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
81 "PyQt6": [],
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
82 "QScintilla2": [],
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
83 },
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
84 "mac": {
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
85 "sip": [],
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
86 "PyQt6": [],
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
87 "QScintilla2": [],
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
88 },
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
89 }
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
90
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
91
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
92 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
93 """
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
94 Exit the install script.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
95
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
96 @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
97 """
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
98 global currDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
99
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
100 print()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
101
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
102 if sys.platform.startswith(("win", "cygwin")):
9328
49a0a9cb2505 Fixed some code style issues detected by the new checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9314
diff changeset
103 with contextlib.suppress(EOFError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
104 input("Press enter to continue...") # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
105
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
106 os.chdir(currDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
107
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
108 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
109
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
110
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
111 def usage(rcode=2):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 Display a usage message and exit.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 @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
116 """
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
117 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
118 global macAppBundleName, macAppBundlePath, macPythonExe
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
120 print()
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
121 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
122 if sys.platform == "darwin":
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
123 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
124 " {0} [-chvxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
125 " [-m name] [-n path] [-p python] [--help] [--no-apis]"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
126 " [--no-info] [--no-tools] [--verbose] [--yes]".format(progName)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
127 )
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
128 elif sys.platform.startswith(("win", "cygwin")):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
129 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
130 " {0} [-chvxz] [-a dir] [-b dir] [-d dir] [-f file]"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
131 " [--clean-desktop] [--help] [--no-apis] [--no-info]"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
132 " [--no-tools] [--verbose] [--yes]".format(progName)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
133 )
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
134 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
135 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
136 " {0} [-chvxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
137 " [--help] [--no-apis] [--no-info] [--no-tools] [--verbose]"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
138 " [--yes]".format(progName)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
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("where:")
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
141 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
142 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
143 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
144 print(" (default: {0})".format(apisDir))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 else:
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
146 print(" (no default value)")
6663
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
147 print(" --no-apis 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
148 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
149 print(" (default: {0})".format(platBinDir))
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
150 print(" -d dir where eric python files will be installed")
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
151 print(" (default: {0})".format(modDir))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
152 print(" -f file configuration file naming the various installation" " paths")
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
153 if not sys.platform.startswith(("win", "cygwin")):
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(" -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
155 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
156 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
157 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
158 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
159 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
160 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
161 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
162 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
163 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
164 print(" -c don't cleanup old installation first")
6663
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
165 if sys.platform.startswith(("win", "cygwin")):
7821
12406e6ba24c install.py: added option --no-tools to ignore installation of pyqt5-tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7814
diff changeset
166 print(" --clean-desktop delete desktop links before installation")
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
167 print(" --no-info don't create the install info file")
8548
c87eb20797b7 Activated support for the 'qt6-applications' project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8522
diff changeset
168 print(" --no-tools don't install qt6-applications")
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
169 print(" -v, --verbose print some more information")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
170 print(" -x don't perform dependency checks (use on your own" " risk)")
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(" -z don't compile the installed python files")
7333
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
172 print(" --yes answer 'yes' to all questions")
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
173 print()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
174 print("The file given to the -f option must be valid Python code" " defining a")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
175 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
176 "dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir',"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
177 " 'ericIconDir',"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
178 )
8820
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
179 print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericThemesDir',")
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
180 print(" 'ericDocDir', ericExamplesDir',")
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
181 print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',")
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
182 print("'ericOthersDir','bindir', 'mdir' and 'apidir.")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
183 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
184 "These define the directories for the installation of the various"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
185 " parts of eric."
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
186 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
188 exit(rcode)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 def initGlobals():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
193 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
194 simple assignment.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 """
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
196 global platBinDir, modDir, pyModDir, apisDir, platBinDirOld
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
197
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
198 import sysconfig
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
199
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
200 if sys.platform.startswith(("win", "cygwin")):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 platBinDir = sys.exec_prefix
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 if platBinDir.endswith("\\"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 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
204 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
205 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
206 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
207 platBinDir = platBinDirOld
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 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
209 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
210 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
211 # 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
212 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
213 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
214 # 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
215 platBinDir = os.path.expanduser("~/bin")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
216 if platBinDir != "/usr/local/bin" and os.access("/usr/local/bin", os.W_OK):
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
217 platBinDirOld = "/usr/local/bin"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
219 modDir = sysconfig.get_path("platlib")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 pyModDir = modDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
221
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
222 pyqtDataDir = os.path.join(modDir, "PyQt6")
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
223 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
224 # 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
225 qtDataDir = pyqtDataDir
8640
b4e75efa081d Corrected the APIs installation path in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8634
diff changeset
226 elif os.path.exists(os.path.join(pyqtDataDir, "Qt6", "qsci")):
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
227 # it's the wheel
8640
b4e75efa081d Corrected the APIs installation path in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8634
diff changeset
228 qtDataDir = os.path.join(pyqtDataDir, "Qt6")
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
229 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
230 # determine dynamically
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
231 try:
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8314
diff changeset
232 from PyQt6.QtCore import QLibraryInfo
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
233
8615
d43e7eb22319 Fixed some issues related to Qt enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8611
diff changeset
234 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath)
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
235 except ImportError:
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
236 qtDataDir = None
8214
51f0d3e047ec install script: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
237 apisDir = os.path.join(qtDataDir, "qsci", "api") if qtDataDir else None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 def copyToFile(name, text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 Copy a string to a file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 @param name the name of the file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 @param text the contents to copy to the file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 """
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
247 with open(name, "w") as f:
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
248 f.write(text)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
251 def copyDesktopFile(src, 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
252 """
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
253 Modify a desktop file and write it to its destination.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
254
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
255 @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
256 @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
257 """
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
258 global cfg, platBinDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
259
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
260 with open(src, "r", encoding="utf-8") as f:
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
261 text = f.read()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
262
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
263 text = text.replace("@BINDIR@", platBinDir)
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
264 text = text.replace("@MARKER@", "")
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
265 text = text.replace("@PY_MARKER@", "")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
266
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
267 with open(dst, "w", encoding="utf-8") as f:
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
268 f.write(text)
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
269 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
270
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
271
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
272 def copyAppStreamFile(src, dst):
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
273 """
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
274 Modify an appstream file and write it to its destination.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
275
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
276 @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
277 @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
278 """
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
279 if os.path.exists(os.path.join("eric", "src", "eric7", "UI", "Info.py")):
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
280 # Installing from installer archive
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
281 from eric.src.eric7.UI.Info import Version
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
282 elif os.path.exists(os.path.join("src", "eric7", "UI", "Info.py")):
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
283 # Installing from source tree
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
284 from src.eric7.UI.Info import Version
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
285 else:
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
286 Version = "Unknown"
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
287
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
288 with open(src, "r", encoding="utf-8") as f:
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
289 text = f.read()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
290
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
291 text = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
292 text.replace("@MARKER@", "")
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
293 .replace("@VERSION@", Version.split(None, 1)[0])
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
294 .replace("@DATE@", time.strftime("%Y-%m-%d"))
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
295 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
296
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
297 with open(dst, "w", encoding="utf-8") as f:
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
298 f.write(text)
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
299 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
300
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
301
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6476
diff changeset
302 def wrapperNames(dname, wfile):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 """
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6476
diff changeset
304 Create the platform specific names for the wrapper script.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
305
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 @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
307 @param wfile basename (without extension) of the wrapper script
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6476
diff changeset
308 @return the names of the wrapper scripts
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 """
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8258
diff changeset
310 wnames = (
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8258
diff changeset
311 (dname + "\\" + wfile + ".cmd", dname + "\\" + wfile + ".bat")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
312 if sys.platform.startswith(("win", "cygwin"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
313 else (dname + "/" + wfile,)
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8258
diff changeset
314 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6476
diff changeset
316 return wnames
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318
6942
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
319 def createPyWrapper(pydir, wfile, saveDir, isGuiScript=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 Create an executable wrapper for a Python script.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322
899
4687532058ba Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
323 @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
324 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
325 @param wfile the basename of the wrapper (string)
6942
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
326 @param saveDir directory to save the file into (string)
902
c06241839b12 Fixed a source docu string in the new installer script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 900
diff changeset
327 @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
328 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
329 @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
330 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 # all kinds of Windows systems
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
332 if sys.platform.startswith(("win", "cygwin")):
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
333 wname = wfile + ".cmd"
899
4687532058ba Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
334 if isGuiScript:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
335 wrapper = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
336 """@echo off\n"""
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
337 '''start "" "{2}\\pythonw.exe"'''
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
338 ''' "{0}\\{1}.pyw"'''
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
339 """ %1 %2 %3 %4 %5 %6 %7 %8 %9\n""".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
340 pydir, wfile, os.path.dirname(sys.executable)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
341 )
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
342 )
899
4687532058ba Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
343 else:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
344 wrapper = (
7302
875a9a29c38f install: fixed an issue installing eric into a venv on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7288
diff changeset
345 '''@"{0}" "{1}\\{2}.py"'''
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
346 """ %1 %2 %3 %4 %5 %6 %7 %8 %9\n""".format(sys.executable, pydir, wfile)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
347 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 # Mac OS X
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 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
351 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
352 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
353 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
354 pyexec = "{0}/bin/python{1}".format(sys.exec_prefix, major)
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
355 wname = wfile
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
356 wrapper = (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
357 """#!/bin/sh\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
358 """\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
359 """exec "{0}" "{1}/{2}.py" "$@"\n""".format(pyexec, pydir, wfile)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
360 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 # *nix systems
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 else:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
364 wname = wfile
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
365 wrapper = (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
366 """#!/bin/sh\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
367 """\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
368 """exec "{0}" "{1}/{2}.py" "$@"\n""".format(sys.executable, pydir, wfile)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
369 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
370
6942
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
371 wname = os.path.join(saveDir, wname)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 copyToFile(wname, wrapper)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
373 os.chmod(wname, 0o755) # secok
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 return wname
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377
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
378 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
379 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 Copy Python, translation, documentation, wizards configuration,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 designer template files and DTDs of a directory tree.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
382
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 @param src name of the source directory
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 @param dst name of the destination directory
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 @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
386 @param excludeDirs list of (sub)directories to exclude from copying
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7894
diff changeset
387 @param excludePatterns list of filter pattern determining the files to
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
388 be skipped
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 """
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
390 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
391 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
392 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
393 excludePatterns = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 names = os.listdir(src)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 except OSError:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
397 # 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
398 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
399
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 for name in names:
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
401 skipIt = False
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
402 for excludePattern in excludePatterns:
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
403 if fnmatch.fnmatch(name, excludePattern):
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
404 skipIt = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 break
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
406 if not skipIt:
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
407 srcname = os.path.join(src, name)
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
408 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
409 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
410 if fnmatch.fnmatch(srcname, fileFilter):
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
411 if not os.path.isdir(dst):
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
412 os.makedirs(dst)
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
413 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
414 os.chmod(dstname, 0o644)
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
415 break
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
416 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
417 if os.path.isdir(srcname) and srcname not in excludeDirs:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
418 copyTree(srcname, dstname, filters, excludePatterns=excludePatterns)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 def createGlobalPluginsDir():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 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
424 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 global cfg, distDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
426
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
427 pdir = os.path.join(cfg["mdir"], "eric7plugins")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 fname = os.path.join(pdir, "__init__.py")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 if not os.path.exists(fname):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 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
431 os.mkdir(pdir, 0o755)
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
432 with open(fname, "w") as f:
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
433 f.write(
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
434 '''# -*- coding: utf-8 -*-
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 Package containing the global plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
439 '''
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
440 )
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
441 os.chmod(fname, 0o644)
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
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
444 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
445 """
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
446 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
447 and directories.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
448
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
449 @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
450 """
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
451 # 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
452 # *.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
453 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
454 for formName, sourceName in [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
455 (f.replace("Ui_", "").replace(".py", ".ui"), f)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
456 for f in dirListing
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
457 if fnmatch.fnmatch(f, "Ui_*.py")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
458 ]:
3594
778ae276540f Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3593
diff changeset
459 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
460 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
461 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
462 os.remove(os.path.join(dirName, sourceName + "c"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
463
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4915
diff changeset
464 # 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
465 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
466 shutil.rmtree(os.path.join(dirName, "__pycache__"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
467 for name in [f for f in os.listdir(dirName) 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
468 os.remove(os.path.join(dirName, name))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
469
6637
54a92e8dca00 install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6636
diff changeset
470 # step 3: delete *.orig files
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
471 for name in [f for f in os.listdir(dirName) if fnmatch.fnmatch(f, "*.orig")]:
6637
54a92e8dca00 install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6636
diff changeset
472 os.remove(os.path.join(dirName, name))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
473
6637
54a92e8dca00 install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6636
diff changeset
474 # step 4: descent into subdirectories and delete them if empty
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
475 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
476 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
477 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
478 cleanupSource(name)
3595
a8433c7a0d8c Fixed another issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3594
diff changeset
479 if len(os.listdir(name)) == 0:
a8433c7a0d8c Fixed another issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3594
diff changeset
480 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
481
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
482
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 def cleanUp():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 Uninstall the old eric files.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 """
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
487 global platBinDir, platBinDirOld
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
488
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 try:
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
490 from eric7config import getConfig
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491 except ImportError:
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
492 # eric wasn't installed previously
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 return
7211
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
494 except SyntaxError:
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
495 # an incomplete or old config file was found
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
496 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
497
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 global pyModDir, progLanguages
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
499
146
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 133
diff changeset
500 # 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
501 if sys.platform.startswith("linux"):
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
502 cleanUpLinuxSpecifics()
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
503 # Remove the Desktop and Start Menu entries for Windows systems
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
504 elif sys.platform.startswith(("win", "cygwin")):
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
505 cleanUpWindowsLinks()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
506
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 # Remove the wrapper scripts
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 rem_wnames = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
509 "eric7_api",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
510 "eric7_browser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
511 "eric7_compare",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
512 "eric7_configure",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
513 "eric7_diff",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
514 "eric7_doc",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
515 "eric7_editor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
516 "eric7_hexeditor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
517 "eric7_iconeditor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
518 "eric7_plugininstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
519 "eric7_pluginrepository",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
520 "eric7_pluginuninstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
521 "eric7_qregularexpression",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
522 "eric7_re",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
523 "eric7_shell",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
524 "eric7_snap",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
525 "eric7_sqlbrowser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
526 "eric7_testing",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
527 "eric7_tray",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
528 "eric7_trpreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
529 "eric7_uipreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
530 "eric7_virtualenv",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
531 "eric7",
9066
a219ade50f7c Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9034
diff changeset
532 # obsolete scripts below
a219ade50f7c Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9034
diff changeset
533 "eric7_unittest",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
535
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
536 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
537 dirs = [platBinDir, getConfig("bindir")]
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
538 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
539 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
540 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
541 for d in dirs:
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6476
diff changeset
542 for rwname in wrapperNames(d, rem_wname):
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6476
diff changeset
543 if os.path.exists(rwname):
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6476
diff changeset
544 os.remove(rwname)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
545
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
546 # Cleanup our config file(s)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
547 for name in ["eric7config.py", "eric7config.pyc", "eric7.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
548 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
549 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
550 os.remove(e6cfile)
6942
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
551 e6cfile = os.path.join(pyModDir, "__pycache__", name)
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
552 path, ext = os.path.splitext(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
553 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
554 os.remove(f)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
555
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
556 # Cleanup the install directories
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
557 for name in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
558 "ericExamplesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
559 "ericDocDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
560 "ericDTDDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
561 "ericCSSDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
562 "ericIconDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
563 "ericPixDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
564 "ericTemplatesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
565 "ericCodeTemplatesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
566 "ericOthersDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
567 "ericStylesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
568 "ericThemesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
569 "ericDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
570 ]:
8821
0485c183b718 Ignore unknown configuration keys during cleanup of install.py and uninstall.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8820
diff changeset
571 with contextlib.suppress(AttributeError):
0485c183b718 Ignore unknown configuration keys during cleanup of install.py and uninstall.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8820
diff changeset
572 if os.path.exists(getConfig(name)):
0485c183b718 Ignore unknown configuration keys during cleanup of install.py and uninstall.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8820
diff changeset
573 shutil.rmtree(getConfig(name), True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
574
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
575 # Cleanup translations
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
576 for name in glob.glob(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
577 os.path.join(getConfig("ericTranslationsDir"), "eric7_*.qm")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
578 ):
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
579 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
580 os.remove(name)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
581
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
582 # Cleanup API files
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8240
diff changeset
583 with contextlib.suppress(AttributeError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
584 apidir = getConfig("apidir")
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
585 for progLanguage in progLanguages:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
586 for name in getConfig("apis"):
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
587 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
588 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
589 os.remove(apiname)
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
590 for apiname in glob.glob(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
591 os.path.join(apidir, progLanguage.lower(), "*.bas")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
592 ):
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
593 if os.path.basename(apiname) != "eric7.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
594 os.remove(apiname)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
595
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
596 if sys.platform == "darwin":
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
597 # delete the Mac app bundle
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
598 cleanUpMacAppBundle()
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
599 except OSError as msg:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
600 sys.stderr.write("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
601 exit(7)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
604 def cleanUpLinuxSpecifics():
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
605 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
606 Clean up Linux specific files.
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
607 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
608 if os.getuid() == 0:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
609 for name in [
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
610 "/usr/share/applications/eric7.desktop",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
611 "/usr/share/appdata/eric7.appdata.xml",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
612 "/usr/share/metainfo/eric7.appdata.xml",
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
613 "/usr/share/pixmaps/eric.png",
8254
259484b0fc75 install.py, uninstall.py: changed the Linux path where our icons get installed
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8243
diff changeset
614 "/usr/share/icons/eric.png",
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
615 "/usr/share/applications/eric7_browser.desktop",
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
616 "/usr/share/pixmaps/ericWeb.png",
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
617 "/usr/share/icons/ericWeb.png",
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
618 ]:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
619 if os.path.exists(name):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
620 os.remove(name)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
621 elif os.getuid() >= 1000:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
622 # it is assumed that user ids start at 1000
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
623 for name in [
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
624 "~/.local/share/applications/eric7.desktop",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
625 "~/.local/share/appdata/eric7.appdata.xml",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
626 "~/.local/share/metainfo/eric7.appdata.xml",
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
627 "~/.local/share/pixmaps/eric.png",
8254
259484b0fc75 install.py, uninstall.py: changed the Linux path where our icons get installed
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8243
diff changeset
628 "~/.local/share/icons/eric.png",
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
629 "~/.local/share/applications/eric7_browser.desktop",
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
630 "~/.local/share/pixmaps/ericWeb.png",
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
631 "~/.local/share/icons/ericWeb.png",
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
632 ]:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
633 path = os.path.expanduser(name)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
634 if os.path.exists(path):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
635 os.remove(path)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
636
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
637
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
638 def cleanUpMacAppBundle():
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
639 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
640 Uninstall the macOS application bundle.
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
641 """
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
642 from eric7config import getConfig
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
643
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
644 try:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
645 macAppBundlePath = getConfig("macAppBundlePath")
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
646 macAppBundleName = getConfig("macAppBundleName")
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
647 except AttributeError:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
648 macAppBundlePath = defaultMacAppBundlePath
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
649 macAppBundleName = defaultMacAppBundleName
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
650 for bundlePath in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
651 os.path.join(defaultMacAppBundlePath, macAppBundleName),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
652 os.path.join(macAppBundlePath, macAppBundleName),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
653 ]:
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
654 if os.path.exists(bundlePath):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
655 shutil.rmtree(bundlePath)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
656
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
657
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
658 def cleanUpWindowsLinks():
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
659 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
660 Clean up the Desktop and Start Menu entries for Windows.
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
661 """
6663
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
662 global doCleanDesktopLinks, forceCleanDesktopLinks
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
663
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
664 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
665 from pywintypes import com_error # __IGNORE_WARNING__
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
666 except ImportError:
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
667 # links were not created by install.py
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
668 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
669
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
670 regPath = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
671 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
672 + "\\User Shell Folders"
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
673 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
674
6663
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
675 if doCleanDesktopLinks or forceCleanDesktopLinks:
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
676 # 1. cleanup desktop links
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
677 regName = "Desktop"
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
678 desktopEntry = getWinregEntry(regName, regPath)
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
679 if desktopEntry:
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
680 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry))
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
681 for linkName in windowsDesktopNames():
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
682 linkPath = os.path.join(desktopFolder, linkName)
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
683 if os.path.exists(linkPath):
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
684 try:
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
685 os.remove(linkPath)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
686 except OSError:
6663
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
687 # maybe restrictions prohibited link removal
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
688 print("Could not remove '{0}'.".format(linkPath))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
689
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
690 # 2. cleanup start menu entry
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
691 regName = "Programs"
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
692 programsEntry = getWinregEntry(regName, regPath)
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
693 if programsEntry:
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
694 programsFolder = os.path.normpath(os.path.expandvars(programsEntry))
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
695 eric7EntryPath = os.path.join(programsFolder, windowsProgramsEntry())
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
696 if os.path.exists(eric7EntryPath):
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
697 try:
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
698 shutil.rmtree(eric7EntryPath)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
699 except OSError:
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
700 # maybe restrictions prohibited link removal
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
701 print("Could not remove '{0}'.".format(eric7EntryPath))
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
702
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
703
2177
a59ffbc5fe4c Fixed an error in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2160
diff changeset
704 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
705 """
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
706 Wrapper function around shutil.copy() to ensure the permissions.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
707
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
708 @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
709 @param dst destination file name or directory name (string)
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7894
diff changeset
710 @param 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
711 """
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
712 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
713 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
714 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
715 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
716
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
717
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 def installEric():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720 Actually perform the installation steps.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
721
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
722 @return result code (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723 """
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
724 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
725 global installApis
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
726
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 # Create the platform specific wrappers.
6942
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
728 scriptsDir = "install_scripts"
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
729 if not os.path.isdir(scriptsDir):
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
730 os.mkdir(scriptsDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 wnames = []
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
732 for name in ["eric7_api", "eric7_doc"]:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
733 wnames.append(createPyWrapper(cfg["ericDir"], name, scriptsDir, False))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
734 for name in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
735 "eric7_browser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
736 "eric7_compare",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
737 "eric7_configure",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
738 "eric7_diff",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
739 "eric7_editor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
740 "eric7_hexeditor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
741 "eric7_iconeditor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
742 "eric7_plugininstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
743 "eric7_pluginrepository",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
744 "eric7_pluginuninstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
745 "eric7_qregularexpression",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
746 "eric7_re",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
747 "eric7_shell",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
748 "eric7_snap",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
749 "eric7_sqlbrowser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
750 "eric7_tray",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
751 "eric7_trpreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
752 "eric7_uipreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
753 "eric7_testing",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
754 "eric7_virtualenv",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
755 "eric7",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
756 ]:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
757 wnames.append(createPyWrapper(cfg["ericDir"], name, scriptsDir))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
758
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 # set install prefix, if not None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 if distDir:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
761 for key in list(cfg.keys()):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
762 cfg[key] = os.path.normpath(os.path.join(distDir, cfg[key].lstrip(os.sep)))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
763
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 # Install the files
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 # make the install directories
8205
4a0f1f896341 Applied some code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8128
diff changeset
767 for key in cfg:
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
768 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
769 os.makedirs(cfg[key])
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
770
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
771 # copy the eric config file
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 if distDir:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
773 shutilCopy(configName, cfg["mdir"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
774 if os.path.exists(configName + "c"):
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
775 shutilCopy(configName + "c", cfg["mdir"])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 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
777 shutilCopy(configName, modDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
778 if os.path.exists(configName + "c"):
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
779 shutilCopy(configName + "c", modDir)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
780
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
781 # copy the various parts of eric
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
782 copyTree(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
783 eric7SourceDir,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
784 cfg["ericDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
785 ["*.py", "*.pyc", "*.pyo", "*.pyw"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
786 excludePatterns=["eric7config.py*"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
787 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
788 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
789 os.path.join(eric7SourceDir, "Plugins"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
790 os.path.join(cfg["ericDir"], "Plugins"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
791 ["*.svgz", "*.svg", "*.png", "*.style", "*.tmpl", "*.txt"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
792 )
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
793 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
794 os.path.join(eric7SourceDir, "Documentation"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
795 cfg["ericDocDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
796 ["*.html", "*.qch"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
797 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
798 copyTree(os.path.join(eric7SourceDir, "CSSs"), cfg["ericCSSDir"], ["*.css"])
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
799 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
800 os.path.join(eric7SourceDir, "Styles"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
801 cfg["ericStylesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
802 ["*.qss", "*.ehj"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
803 )
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
804 copyTree(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
805 os.path.join(eric7SourceDir, "Themes"), cfg["ericThemesDir"], ["*.ethj"]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
806 )
8820
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
807 copyTree(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
808 os.path.join(eric7SourceDir, "i18n"), cfg["ericTranslationsDir"], ["*.qm"]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
809 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
810 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
811 os.path.join(eric7SourceDir, "icons"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
812 cfg["ericIconDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
813 ["*.svgz", "*.svg", "*.png", "LICENSE*.*", "readme.txt"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
814 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
815 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
816 os.path.join(eric7SourceDir, "pixmaps"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
817 cfg["ericPixDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
818 ["*.svgz", "*.svg", "*.png", "*.xpm", "*.ico", "*.gif"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
819 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
820 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
821 os.path.join(eric7SourceDir, "DesignerTemplates"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
822 cfg["ericTemplatesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
823 ["*.tmpl"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
824 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
825 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
826 os.path.join(eric7SourceDir, "CodeTemplates"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
827 cfg["ericCodeTemplatesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
828 ["*.tmpl"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
829 )
8776
07b8c13b0607 Updated the setup and install script for the updated coverage package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8754
diff changeset
830 copyTree(
07b8c13b0607 Updated the setup and install script for the updated coverage package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8754
diff changeset
831 os.path.join(eric7SourceDir, "DebugClients", "Python", "coverage"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
832 os.path.join(cfg["ericDir"], "DebugClients", "Python", "coverage"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
833 ["*.js", "*.html", "*.png", "*.css", "*.scss", "*.txt", "*.rst"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
834 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
835
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
836 # copy some data files needed at various places
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
837 copyTree(
9127
22e94bac751a Modified the install script to ensure the trove license list file is installed locally.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9117
diff changeset
838 os.path.join(eric7SourceDir, "data"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
839 os.path.join(cfg["ericDir"], "data"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
840 ["*.txt"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
841 )
9127
22e94bac751a Modified the install script to ensure the trove license list file is installed locally.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9117
diff changeset
842 copyTree(
8354
12ebd3934fef Renamed 'E5Utilities' to 'EricUtilities' and 'E5Network' to 'EricNetwork'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8343
diff changeset
843 os.path.join(eric7SourceDir, "EricNetwork", "data"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
844 os.path.join(cfg["ericDir"], "EricNetwork", "data"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
845 ["*.dat", "*.txt"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
846 )
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
847 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
848 os.path.join(eric7SourceDir, "IconEditor", "cursors"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
849 os.path.join(cfg["ericDir"], "IconEditor", "cursors"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
850 ["*.xpm"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
851 )
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
852 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
853 os.path.join(eric7SourceDir, "UI", "data"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
854 os.path.join(cfg["ericDir"], "UI", "data"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
855 ["*.css"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
856 )
8566
0df55126fdf4 Preliminary change to install the eric7 web browser unconditionally (for development and testing only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8553
diff changeset
857 copyTree(
0df55126fdf4 Preliminary change to install the eric7 web browser unconditionally (for development and testing only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8553
diff changeset
858 os.path.join(eric7SourceDir, "WebBrowser"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
859 os.path.join(cfg["ericDir"], "WebBrowser"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
860 ["*.xbel", "*.xml", "*.html", "*.png", "*.gif", "*.js"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
861 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
862
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 # copy the wrappers
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
864 for wname in wnames:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
865 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
866 os.remove(wname)
6942
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
867 shutil.rmtree(scriptsDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
868
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869 # copy the license file
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
870 shutilCopy(os.path.join(sourceDir, "docs", "LICENSE.GPL3"), cfg["ericDir"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
871
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
872 # create the global plugins directory
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
873 createGlobalPluginsDir()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
874
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
875 except OSError as msg:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
876 sys.stderr.write("Error: {0}\nTry install with admin rights.\n".format(msg))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
877 return 7
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
878
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879 # copy some text files to the doc area
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
880 for name in ["LICENSE.GPL3", "THANKS", "changelog"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
881 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
882 shutilCopy(os.path.join(sourceDir, "docs", name), cfg["ericDocDir"])
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
883 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
884 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
885 "Could not install '{0}'.".format(os.path.join(sourceDir, "docs", name))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
886 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
887 for name in glob.glob(os.path.join(sourceDir, "docs", "README*.*")):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
889 shutilCopy(name, cfg["ericDocDir"])
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
890 except OSError:
4512
23e8b848efb0 Fixed some incorrect string format strings using the new checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4456
diff changeset
891 print("Could not install '{0}'.".format(name))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
892
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 # copy some more stuff
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
894 for name in ("default.ekj", "default_Mac.ekj", "default.e4k", "default_Mac.e4k"):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
895 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
896 shutilCopy(os.path.join(sourceDir, "others", name), cfg["ericOthersDir"])
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
897 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
898 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
899 "Could not install '{0}'.".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
900 os.path.join(sourceDir, "others", name)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
901 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
902 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
903
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 # 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
905 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
906 for progLanguage in progLanguages:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
907 apidir = os.path.join(cfg["apidir"], progLanguage.lower())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
908 print("Installing {0} API files to '{1}'.".format(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
909 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
910 os.makedirs(apidir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
911 for apiName in glob.glob(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
912 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
913 ):
40
c2e5472b112c Changed some code to adjust eric5 to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 21
diff changeset
914 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
915 shutilCopy(apiName, apidir)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
916 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
917 print("Could not install '{0}' (no permission).".format(apiName))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
918 for apiName in glob.glob(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
919 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.bas")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
920 ):
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
921 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
922 shutilCopy(apiName, apidir)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
923 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
924 print("Could not install '{0}' (no permission).".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
925 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
926 # copy Python3 API files to the same destination
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
927 for apiName in glob.glob(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
928 os.path.join(eric7SourceDir, "APIs", "Python3", "*.api")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
929 ):
3697
c947a7eaace4 Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3693
diff changeset
930 try:
c947a7eaace4 Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3693
diff changeset
931 shutilCopy(apiName, apidir)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
932 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
933 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
934 "Could not install '{0}' (no permission).".format(apiName)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
935 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
936 for apiName in glob.glob(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
937 os.path.join(eric7SourceDir, "APIs", "Python3", "*.bas")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
938 ):
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
939 if os.path.exists(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
940 os.path.join(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
941 apidir, os.path.basename(apiName.replace(".bas", ".api"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
942 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
943 ):
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
944 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
945 shutilCopy(apiName, apidir)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
946 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
947 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
948 "Could not install '{0}' (no permission).".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
949 apiName
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
950 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
951 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
952
7178
43e994af5ee0 MicroPython: added more MicroPython type related handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7141
diff changeset
953 # copy MicroPython API files to the same destination
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
954 for apiName in glob.glob(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
955 os.path.join(eric7SourceDir, "APIs", "MicroPython", "*.api")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
956 ):
7178
43e994af5ee0 MicroPython: added more MicroPython type related handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7141
diff changeset
957 try:
43e994af5ee0 MicroPython: added more MicroPython type related handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7141
diff changeset
958 shutilCopy(apiName, apidir)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
959 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
960 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
961 "Could not install '{0}' (no permission).".format(apiName)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
962 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
963 for apiName in glob.glob(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
964 os.path.join(eric7SourceDir, "APIs", "MicroPython", "*.bas")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
965 ):
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
966 if os.path.exists(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
967 os.path.join(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
968 apidir, os.path.basename(apiName.replace(".bas", ".api"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
969 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
970 ):
7178
43e994af5ee0 MicroPython: added more MicroPython type related handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7141
diff changeset
971 try:
43e994af5ee0 MicroPython: added more MicroPython type related handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7141
diff changeset
972 shutilCopy(apiName, apidir)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
973 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
974 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
975 "Could not install '{0}' (no permission).".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
976 apiName
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
977 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
978 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
979
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
980 # Create menu entry for Linux systems
146
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 133
diff changeset
981 if sys.platform.startswith("linux"):
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
982 createLinuxSpecifics()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
983
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
984 # Create Desktop and Start Menu entries for Windows systems
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
985 elif sys.platform.startswith(("win", "cygwin")):
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
986 createWindowsLinks()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
987
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
988 # Create a Mac application bundle
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
989 elif sys.platform == "darwin":
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
990 createMacAppBundle(cfg["ericDir"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
991
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
992 return 0
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
993
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
994
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
995 def createLinuxSpecifics():
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
996 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
997 Install Linux specific files.
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
998 """
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
999 global distDir, sourceDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1000
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1001 dataSourceDir = os.path.join(eric7SourceDir, "data", "linux")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1002
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1003 if distDir:
8254
259484b0fc75 install.py, uninstall.py: changed the Linux path where our icons get installed
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8243
diff changeset
1004 dst = os.path.normpath(os.path.join(distDir, "usr/share/icons"))
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1005 if not os.path.exists(dst):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1006 os.makedirs(dst)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1007 shutilCopy(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1008 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1009 os.path.join(dst, "eric.png"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1010 )
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1011 shutilCopy(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1012 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1013 os.path.join(dst, "ericWeb.png"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1014 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1015
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1016 dst = os.path.normpath(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1017 os.path.join(distDir, "usr/share/icons/hicolor/48x48/apps")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1018 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1019 if not os.path.exists(dst):
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1020 os.makedirs(dst)
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1021 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1022 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1023 os.path.join(dst, "eric.png"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1024 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1025 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1026 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1027 os.path.join(dst, "ericWeb.png"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1028 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1029
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1030 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications"))
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1031 if not os.path.exists(dst):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1032 os.makedirs(dst)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1033 copyDesktopFile(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1034 os.path.join(dataSourceDir, "eric7.desktop.in"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1035 os.path.join(dst, "eric7.desktop"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1036 )
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1037 copyDesktopFile(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1038 os.path.join(dataSourceDir, "eric7_browser.desktop.in"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1039 os.path.join(dst, "eric7_browser.desktop"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1040 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1041
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1042 dst = os.path.normpath(os.path.join(distDir, "usr/share/metainfo"))
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1043 if not os.path.exists(dst):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1044 os.makedirs(dst)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1045 copyAppStreamFile(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1046 os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1047 os.path.join(dst, "eric7.appdata.xml"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1048 )
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1049 elif os.getuid() == 0:
7519
0e93f5167e71 install.py: fixed an issue caused by renaming the old 'default' icon directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7453
diff changeset
1050 shutilCopy(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1051 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1052 "/usr/share/icons/eric.png",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1053 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1054 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1055 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1056 "/usr/share/icons/hicolor/48x48/apps/eric.png",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1057 )
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1058 copyDesktopFile(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1059 os.path.join(dataSourceDir, "eric7.desktop.in"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1060 "/usr/share/applications/eric7.desktop",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1061 )
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1062 if os.path.exists("/usr/share/metainfo"):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1063 copyAppStreamFile(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1064 os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1065 "/usr/share/metainfo/eric7.appdata.xml",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1066 )
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1067 elif os.path.exists("/usr/share/appdata"):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1068 copyAppStreamFile(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1069 os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1070 "/usr/share/appdata/eric7.appdata.xml",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1071 )
7519
0e93f5167e71 install.py: fixed an issue caused by renaming the old 'default' icon directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7453
diff changeset
1072 shutilCopy(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1073 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1074 "/usr/share/icons/ericWeb.png",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1075 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1076 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1077 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1078 "/usr/share/icons/hicolor/48x48/apps/ericWeb.png",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1079 )
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1080 copyDesktopFile(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1081 os.path.join(dataSourceDir, "eric7_browser.desktop.in"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1082 "/usr/share/applications/eric7_browser.desktop",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1083 )
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1084 elif os.getuid() >= 1000:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1085 # it is assumed, that user ids start at 1000
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1086 localPath = os.path.join(os.path.expanduser("~"), ".local", "share")
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1087 # create directories first
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1088 for directory in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1089 os.path.join(localPath, name)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1090 for name in (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1091 "icons",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1092 "icons/hicolor/48x48/apps",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1093 "applications",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1094 "metainfo",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1095 "appdata",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1096 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1097 ]:
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1098 if not os.path.isdir(directory):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1099 os.makedirs(directory)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1100 # now copy the files
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1101 shutilCopy(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1102 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1103 os.path.join(localPath, "icons", "eric.png"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1104 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1105 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1106 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1107 os.path.join(localPath, "icons/hicolor/48x48/apps", "eric.png"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1108 )
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1109 copyDesktopFile(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1110 os.path.join(dataSourceDir, "eric7.desktop.in"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1111 os.path.join(localPath, "applications", "eric7.desktop"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1112 )
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1113 copyAppStreamFile(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1114 os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1115 os.path.join(localPath, "metainfo", "eric7.appdata.xml"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1116 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1117 copyAppStreamFile(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1118 os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1119 os.path.join(localPath, "appdata", "eric7.appdata.xml"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1120 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1121 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1122 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1123 os.path.join(localPath, "icons", "ericWeb.png"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1124 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1125 shutilCopy(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1126 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1127 os.path.join(localPath, "icons/hicolor/48x48/apps", "ericWeb.png"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1128 )
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1129 copyDesktopFile(
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
1130 os.path.join(dataSourceDir, "eric7_browser.desktop.in"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1131 os.path.join(localPath, "applications", "eric7_browser.desktop"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1132 )
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1133
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1134
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1135 def createWindowsLinks():
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1136 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1137 Create Desktop and Start Menu links.
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1138 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1139 try:
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1140 # check, if pywin32 is available
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1141 from win32com.client import Dispatch # __IGNORE_WARNING__
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1142 except ImportError:
6592
bba271a63b81 install: added capability to install the pywin32 package upon request in order to create shortcut links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6530
diff changeset
1143 installed = pipInstall(
bba271a63b81 install: added capability to install the pywin32 package upon request in order to create shortcut links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6530
diff changeset
1144 "pywin32",
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1145 "\nThe Python package 'pywin32' could not be imported.",
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1146 force=False,
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1147 )
6594
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
1148 if installed:
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
1149 # create the links via an external script to get around some
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
1150 # startup magic done by pywin32.pth
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
1151 args = [
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
1152 sys.executable,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1153 os.path.join(os.path.dirname(__file__), "create_windows_links.py"),
6594
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
1154 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1155 subprocess.run(args) # secok
6594
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
1156 else:
6592
bba271a63b81 install: added capability to install the pywin32 package upon request in order to create shortcut links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6530
diff changeset
1157 print(
bba271a63b81 install: added capability to install the pywin32 package upon request in order to create shortcut links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6530
diff changeset
1158 "\nThe Python package 'pywin32' is not installed. Desktop and"
bba271a63b81 install: added capability to install the pywin32 package upon request in order to create shortcut links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6530
diff changeset
1159 " Start Menu entries will not be created."
bba271a63b81 install: added capability to install the pywin32 package upon request in order to create shortcut links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6530
diff changeset
1160 )
6594
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
1161 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1162
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1163 regPath = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1164 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1165 + "\\User Shell Folders"
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1166 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1167
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1168 # 1. create desktop shortcuts
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1169 regName = "Desktop"
7566
7845da7a7ec2 install.py: added fault handler for desktop shortcut creation on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7519
diff changeset
1170 desktopEntry = getWinregEntry(regName, regPath)
7845da7a7ec2 install.py: added fault handler for desktop shortcut creation on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7519
diff changeset
1171 if desktopEntry:
7845da7a7ec2 install.py: added fault handler for desktop shortcut creation on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7519
diff changeset
1172 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry))
7845da7a7ec2 install.py: added fault handler for desktop shortcut creation on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7519
diff changeset
1173 for linkName, targetPath, iconPath in windowsDesktopEntries():
7845da7a7ec2 install.py: added fault handler for desktop shortcut creation on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7519
diff changeset
1174 linkPath = os.path.join(desktopFolder, linkName)
7845da7a7ec2 install.py: added fault handler for desktop shortcut creation on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7519
diff changeset
1175 createWindowsShortcut(linkPath, targetPath, iconPath)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1176
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1177 # 2. create start menu entry and shortcuts
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1178 regName = "Programs"
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1179 programsEntry = getWinregEntry(regName, regPath)
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1180 if programsEntry:
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1181 programsFolder = os.path.normpath(os.path.expandvars(programsEntry))
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1182 eric7EntryPath = os.path.join(programsFolder, windowsProgramsEntry())
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1183 if not os.path.exists(eric7EntryPath):
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1184 try:
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1185 os.makedirs(eric7EntryPath)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
1186 except OSError:
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1187 # maybe restrictions prohibited link creation
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1188 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1189
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1190 for linkName, targetPath, iconPath in windowsDesktopEntries():
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1191 linkPath = os.path.join(eric7EntryPath, linkName)
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
1192 createWindowsShortcut(linkPath, targetPath, iconPath)
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1193
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1194
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1195 def createMacAppBundle(pydir):
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1196 """
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1197 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
1198
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1199 @param pydir the name of the directory where the Python script will
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1200 eventually be installed
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
1201 @type str
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1202 """
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1203 global cfg, macAppBundleName, macPythonExe, macAppBundlePath
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1204
7141
a479c75c6643 install.py: fixed an issue causing installation to fail in certain situations on macOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7121
diff changeset
1205 directories = {
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1206 "contents": "{0}/{1}/Contents/".format(macAppBundlePath, macAppBundleName),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1207 "exe": "{0}/{1}/Contents/MacOS".format(macAppBundlePath, macAppBundleName),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1208 "icns": "{0}/{1}/Contents/Resources".format(macAppBundlePath, macAppBundleName),
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
1209 }
7227
5ba312e6599a install.py: fixed an issue causing installation on macOS to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7220
diff changeset
1210 for directory in directories.values():
7141
a479c75c6643 install.py: fixed an issue causing installation to fail in certain situations on macOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7121
diff changeset
1211 if not os.path.exists(directory):
a479c75c6643 install.py: fixed an issue causing installation to fail in certain situations on macOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7121
diff changeset
1212 os.makedirs(directory)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1213
7584
328d92d8db48 install: fixed an issue causing a faulty application bundle being created for macOS installations when installing into a Python virtual environment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7566
diff changeset
1214 if macPythonExe == defaultMacPythonExe and macPythonExe:
7141
a479c75c6643 install.py: fixed an issue causing installation to fail in certain situations on macOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7121
diff changeset
1215 starter = os.path.join(directories["exe"], "eric")
2308
f83826045e51 Change install.py for Mac again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2307
diff changeset
1216 os.symlink(macPythonExe, starter)
f83826045e51 Change install.py for Mac again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2307
diff changeset
1217 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
1218 starter = "python{0}".format(sys.version_info.major)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1219
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1220 wname = os.path.join(directories["exe"], "eric7")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1221
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
1222 # 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
1223 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
1224 try:
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8314
diff changeset
1225 from PyQt6.QtCore import QLibraryInfo
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1226
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1227 qtLibraryDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.LibrariesPath)
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
1228 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
1229 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
1230 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
1231 dyldLine = "DYLD_FRAMEWORK_PATH={0}\n".format(qtLibraryDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1232
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
1233 # 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
1234 pathLine = ""
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1235 path = os.getenv("PATH", "")
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1236 if path:
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1237 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
1238 pathlist = path.split(os.pathsep)
4911
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1239 pathlist_n = [pybin]
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1240 for path_ in pathlist:
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1241 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
1242 pathlist_n.append(path_)
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1243 pathLine = "PATH={0}\n".format(os.pathsep.join(pathlist_n))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1244
4911
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1245 # create the wrapper script
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1246 wrapper = (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1247 """#!/bin/sh\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1248 """\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1249 """{0}"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1250 """{1}"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1251 """exec "{2}" "{3}/{4}.py" "$@"\n""".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1252 pathLine, dyldLine, starter, pydir, "eric7"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1253 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1254 )
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1255 copyToFile(wname, wrapper)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1256 os.chmod(wname, 0o755) # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1257
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1258 shutilCopy(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1259 os.path.join(eric7SourceDir, "pixmaps", "eric_2.icns"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1260 os.path.join(directories["icns"], "eric.icns"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1261 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1262
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1263 if os.path.exists(os.path.join("eric", "eric7", "UI", "Info.py")):
6664
50c9c1c9cf30 install.py: extended and corrected the macOS application bundle generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6663
diff changeset
1264 # Installing from archive
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1265 from eric.eric7.UI.Info import Version, CopyrightShort
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1266 elif os.path.exists(os.path.join("eric7", "UI", "Info.py")):
6664
50c9c1c9cf30 install.py: extended and corrected the macOS application bundle generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6663
diff changeset
1267 # Installing from source tree
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1268 from eric7.UI.Info import Version, CopyrightShort
6664
50c9c1c9cf30 install.py: extended and corrected the macOS application bundle generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6663
diff changeset
1269 else:
50c9c1c9cf30 install.py: extended and corrected the macOS application bundle generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6663
diff changeset
1270 Version = "Unknown"
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8821
diff changeset
1271 CopyrightShort = "(c) 2002 - 2022 Detlev Offenbach"
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1272
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
1273 copyToFile(
7141
a479c75c6643 install.py: fixed an issue causing installation to fail in certain situations on macOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7121
diff changeset
1274 os.path.join(directories["contents"], "Info.plist"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1275 """<?xml version="1.0" encoding="UTF-8"?>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1276 """<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1277 """ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1278 """<plist version="1.0">\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1279 """<dict>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1280 """ <key>CFBundleExecutable</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1281 """ <string>eric7</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1282 """ <key>CFBundleIconFile</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1283 """ <string>eric.icns</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1284 """ <key>CFBundleInfoDictionaryVersion</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1285 """ <string>{1}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1286 """ <key>CFBundleName</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1287 """ <string>{0}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1288 """ <key>CFBundleDisplayName</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1289 """ <string>{0}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1290 """ <key>CFBundlePackageType</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1291 """ <string>APPL</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1292 """ <key>CFBundleSignature</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1293 """ <string>ERIC-IDE</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1294 """ <key>CFBundleVersion</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1295 """ <string>{1}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1296 """ <key>CFBundleGetInfoString</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1297 """ <string>{1}, {2}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1298 """ <key>CFBundleIdentifier</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1299 """ <string>org.python-projects.eric-ide</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1300 """ <key>NSRequiresAquaSystemAppearance</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1301 """ <string>false</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1302 """ <key>LSEnvironment</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1303 """ <dict>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1304 """ <key>LANG</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1305 """ <string>en_US.UTF-8</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1306 """ <key>LC_ALL</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1307 """ <string>en_US.UTF-8</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1308 """ <key>LC_CTYPE</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1309 """ <string>en_US.UTF-8</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1310 """ </dict>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1311 """</dict>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1312 """</plist>\n""".format(
6664
50c9c1c9cf30 install.py: extended and corrected the macOS application bundle generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6663
diff changeset
1313 macAppBundleName.replace(".app", ""),
50c9c1c9cf30 install.py: extended and corrected the macOS application bundle generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6663
diff changeset
1314 Version.split(None, 1)[0],
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1315 CopyrightShort,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1316 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1317 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1318
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1319
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1320 def createInstallConfig():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1321 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1322 Create the installation config dictionary.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1323 """
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1324 global modDir, platBinDir, cfg, apisDir, installApis
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1325
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1326 ericdir = os.path.join(modDir, "eric7")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1327 cfg = {
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1328 "ericDir": ericdir,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1329 "ericPixDir": os.path.join(ericdir, "pixmaps"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1330 "ericIconDir": os.path.join(ericdir, "icons"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1331 "ericDTDDir": os.path.join(ericdir, "DTDs"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1332 "ericCSSDir": os.path.join(ericdir, "CSSs"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1333 "ericStylesDir": os.path.join(ericdir, "Styles"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1334 "ericThemesDir": os.path.join(ericdir, "Themes"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1335 "ericDocDir": os.path.join(ericdir, "Documentation"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1336 "ericExamplesDir": os.path.join(ericdir, "Examples"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1337 "ericTranslationsDir": os.path.join(ericdir, "i18n"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1338 "ericTemplatesDir": os.path.join(ericdir, "DesignerTemplates"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1339 "ericCodeTemplatesDir": os.path.join(ericdir, "CodeTemplates"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1340 "ericOthersDir": ericdir,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1341 "bindir": platBinDir,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1342 "mdir": modDir,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1343 }
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1344 if installApis:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1345 if apisDir:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1346 cfg["apidir"] = apisDir
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1347 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1348 cfg["apidir"] = os.path.join(ericdir, "api")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1349 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1350 cfg["apidir"] = ""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1351
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1352
8820
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1353 configLength = 16
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1354
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1355
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1356 def createConfig():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1357 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1358 Create a config file with the respective config entries.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1359 """
6942
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
1360 global cfg, macAppBundlePath, configName
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1361
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1362 apis = []
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1363 if installApis:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1364 for progLanguage in progLanguages:
6960
1d4e02425869 install.py: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6956
diff changeset
1365 for apiName in sorted(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1366 glob.glob(os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1367 ):
40
c2e5472b112c Changed some code to adjust eric5 to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 21
diff changeset
1368 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
1369 if progLanguage == "Python":
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1370 # treat Python3 API files the same as Python API files
6960
1d4e02425869 install.py: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6956
diff changeset
1371 for apiName in sorted(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1372 glob.glob(os.path.join(eric7SourceDir, "APIs", "Python3", "*.api"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1373 ):
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1374 apis.append(os.path.basename(apiName))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1375
7178
43e994af5ee0 MicroPython: added more MicroPython type related handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7141
diff changeset
1376 # treat MicroPython API files the same as Python API files
43e994af5ee0 MicroPython: added more MicroPython type related handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7141
diff changeset
1377 for apiName in sorted(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1378 glob.glob(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1379 os.path.join(eric7SourceDir, "APIs", "MicroPython", "*.api")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1380 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1381 ):
7178
43e994af5ee0 MicroPython: added more MicroPython type related handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7141
diff changeset
1382 apis.append(os.path.basename(apiName))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1383
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8258
diff changeset
1384 macConfig = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1385 (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1386 """ 'macAppBundlePath': r'{0}',\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1387 """ 'macAppBundleName': r'{1}',\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1388 ).format(macAppBundlePath, macAppBundleName)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1389 if sys.platform == "darwin"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1390 else ""
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8258
diff changeset
1391 )
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1392 config = (
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1393 """# -*- coding: utf-8 -*-\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1394 """#\n"""
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1395 """# This module contains the configuration of the individual eric"""
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1396 """ installation\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1397 """#\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1398 """\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1399 """_pkg_config = {{\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1400 """ 'ericDir': r'{0}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1401 """ 'ericPixDir': r'{1}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1402 """ 'ericIconDir': r'{2}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1403 """ 'ericDTDDir': r'{3}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1404 """ 'ericCSSDir': r'{4}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1405 """ 'ericStylesDir': r'{5}',\n"""
8820
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1406 """ 'ericThemesDir': r'{6}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1407 """ 'ericDocDir': r'{7}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1408 """ 'ericExamplesDir': r'{8}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1409 """ 'ericTranslationsDir': r'{9}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1410 """ 'ericTemplatesDir': r'{10}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1411 """ 'ericCodeTemplatesDir': r'{11}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1412 """ 'ericOthersDir': r'{12}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1413 """ 'bindir': r'{13}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1414 """ 'mdir': r'{14}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1415 """ 'apidir': r'{15}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1416 """ 'apis': {16},\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1417 """{17}"""
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1418 """}}\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1419 """\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1420 """def getConfig(name):\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1421 """ '''\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1422 """ 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
1423 """\n"""
5628
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1424 """ @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
1425 """ @type str\n"""
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1426 """ @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
1427 """ config entry\n"""
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1428 """ '''\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1429 """ try:\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1430 """ return _pkg_config[name]\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1431 """ except KeyError:\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1432 """ pass\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1433 """\n"""
5628
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1434 """ raise AttributeError(\n"""
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1435 """ '"{{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
1436 """.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
1437 ).format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1438 cfg["ericDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1439 cfg["ericPixDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1440 cfg["ericIconDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1441 cfg["ericDTDDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1442 cfg["ericCSSDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1443 cfg["ericStylesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1444 cfg["ericThemesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1445 cfg["ericDocDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1446 cfg["ericExamplesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1447 cfg["ericTranslationsDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1448 cfg["ericTemplatesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1449 cfg["ericCodeTemplatesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1450 cfg["ericOthersDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1451 cfg["bindir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1452 cfg["mdir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1453 cfg["apidir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1454 sorted(apis),
7804
1cbc27e34ec6 Implementing code to record and/or guess some information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7799
diff changeset
1455 macConfig,
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
1456 )
6942
2602857055c5 Major restructuring of the source tree to get prepared for a setup.py based installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6939
diff changeset
1457 copyToFile(configName, config)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1458
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1459
7804
1cbc27e34ec6 Implementing code to record and/or guess some information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7799
diff changeset
1460 def createInstallInfo():
1cbc27e34ec6 Implementing code to record and/or guess some information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7799
diff changeset
1461 """
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1462 Record information about the way eric was installed.
7804
1cbc27e34ec6 Implementing code to record and/or guess some information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7799
diff changeset
1463 """
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1464 global createInstallInfoFile, installInfo, installCwd, cfg
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1465
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1466 if createInstallInfoFile:
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1467 installDateTime = datetime.datetime.now(tz=None)
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1468 try:
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1469 installInfo["sudo"] = os.getuid() == 0
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1470 except AttributeError:
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1471 installInfo["sudo"] = False
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1472 installInfo["user"] = getpass.getuser()
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1473 installInfo["exe"] = sys.executable
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1474 installInfo["argv"] = " ".join(shlex.quote(a) for a in sys.argv[:])
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1475 installInfo["install_cwd"] = installCwd
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1476 installInfo["eric"] = cfg["ericDir"]
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1477 installInfo["virtualenv"] = installInfo["eric"].startswith(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1478 os.path.expanduser("~")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1479 )
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1480 installInfo["installed"] = True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1481 installInfo["installed_on"] = installDateTime.strftime("%Y-%m-%d %H:%M:%S")
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1482 installInfo["guessed"] = False
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1483 installInfo["edited"] = False
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1484 installInfo["pip"] = False
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1485 installInfo["remarks"] = ""
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1486 installInfo["install_cwd_edited"] = False
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1487 installInfo["exe_edited"] = False
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1488 installInfo["argv_edited"] = False
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
1489 installInfo["eric_edited"] = False
7804
1cbc27e34ec6 Implementing code to record and/or guess some information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7799
diff changeset
1490
7823
9a4e93471a06 install.py: fixed a code style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7821
diff changeset
1491
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1492 def pipInstall(packageName, message, force=True):
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
1493 """
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
1494 Install the given package via pip.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1495
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
1496 @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
1497 @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
1498 @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
1499 @type str
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1500 @param force flag indicating to perform the installation
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1501 without asking the user
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1502 @type bool
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
1503 @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
1504 @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
1505 """
7333
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
1506 global yes2All
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1507
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
1508 ok = False
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1509 if yes2All or force:
7333
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
1510 answer = "y"
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
1511 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1512 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1513 "{0}\nShall '{1}' be installed using pip? (Y/n)".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1514 message, packageName
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1515 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1516 end=" ",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1517 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1518 answer = input() # secok
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
1519 if answer in ("", "Y", "y"):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1520 exitCode = subprocess.run( # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1521 [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1522 sys.executable,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1523 "-m",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1524 "pip",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1525 "install",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1526 "--prefer-binary",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1527 "--upgrade",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1528 packageName,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1529 ]
8966
c6f67dbc6ee7 Changed calls to subprocess.call() and subprocess.check_output() to use subprocess.run().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8918
diff changeset
1530 ).returncode
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1531 ok = exitCode == 0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1532
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
1533 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
1534
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
1535
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1536 def isPipOutdated():
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1537 """
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1538 Check, if pip is outdated.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1539
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1540 @return flag indicating an outdated pip
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1541 @rtype bool
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1542 """
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1543 try:
9278
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1544 pipOut = (
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1545 subprocess.run( # secok
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1546 [sys.executable, "-m", "pip", "list", "--outdated", "--format=json"],
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1547 check=True,
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1548 capture_output=True,
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1549 text=True,
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1550 )
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1551 .stdout.strip()
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1552 .splitlines()[0]
36448ca469c2 Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9261
diff changeset
1553 )
9261
66cc5e304450 Corrected another issue related to pip outputting additional data after the JSON line for 'pip list'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9231
diff changeset
1554 # only the first line contains the JSON data
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1555 except (OSError, subprocess.CalledProcessError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1556 pipOut = "[]" # default empty list
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1557 try:
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1558 jsonList = json.loads(pipOut)
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1559 except Exception:
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1560 jsonList = []
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1561 for package in jsonList:
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1562 if isinstance(package, dict) and package["name"] == "pip":
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1563 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1564 "'pip' is outdated (installed {0}, available {1})".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1565 package["version"], package["latest_version"]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1566 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1567 )
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1568 return True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1569
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1570 return False
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1571
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1572
7448
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1573 def updatePip():
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1574 """
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1575 Update the installed pip package.
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1576 """
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1577 global yes2All
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1578
7448
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1579 if yes2All:
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1580 answer = "y"
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1581 else:
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1582 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1583 answer = input() # secok
7448
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1584 if answer in ("", "Y", "y"):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1585 subprocess.run( # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1586 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1587 )
7448
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1588
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1589
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1590 def versionToStr(version):
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1591 """
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1592 Function to convert a version number into a version string.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1593
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1594 @param version version number to convert
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1595 @type int
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1596 @return version string
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1597 @rtype str
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1598 """
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1599 parts = []
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1600 while version:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1601 parts.append(version & 0xFF)
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1602 version >>= 8
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1603 return ".".join(str(p) for p in reversed(parts))
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1604
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1605
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1606 def doDependancyChecks():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1607 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1608 Perform some dependency checks.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1609 """
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1610 global verbose
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1611
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1612 requiredVersions = {
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1613 "pyqt6": 0x60200, # v6.2.0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1614 "pyqt6-charts": 0x60200, # v6.2.0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1615 "pyqt6-webengine": 0x60200, # v6.2.0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1616 "pyqt6-qscintilla": 0x20D00, # v2.13.0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1617 "sip": 0x60100, # v6.1.0
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1618 }
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1619
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1620 try:
8261
0c2aa0ad149f install script: little change for macOS installations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
1621 isSudo = os.getuid() == 0 and sys.platform != "darwin"
0c2aa0ad149f install script: little change for macOS installations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
1622 # disregard sudo installs on macOS
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1623 except AttributeError:
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1624 isSudo = False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1625
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1626 print("Checking dependencies")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1627
7448
29b54296cf8c install script: added option to update pip before testing the version of the prerequisite tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1628 # update pip first even if we don't need to install anything
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1629 if not isSudo and isPipOutdated():
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1630 updatePip()
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1631 print("\n")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1632
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1633 # perform dependency checks
9143
82f08c4fd930 Changed 'setup.py' and 'install.py' to check the allowed Python version range to >= 3.7.0 but < 3.12.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9127
diff changeset
1634 if sys.version_info < (3, 7, 0) or sys.version_info >= (3, 12, 0):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1635 print("Sorry, you must have Python 3.7.0 or higher, but less 3.12.0.")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1636 print("Yours is {0}.".format(".".join(str(v) for v in sys.version_info[:3])))
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
1637 exit(5)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1638
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1639 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1640 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
1641 except ImportError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1642 print("Your Python installation is missing the XML module.")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1643 print("Please install it and try again.")
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
1644 exit(5)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1645
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1646 try:
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8314
diff changeset
1647 from PyQt6.QtCore import qVersion
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1648 except ImportError as err:
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1649 msg = "'PyQt6' could not be detected.{0}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1650 "\nError: {0}".format(err) if verbose else ""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1651 )
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1652 installed = not isSudo and pipInstall(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1653 "PyQt6>={0}".format(versionToStr(requiredVersions["pyqt6"])), msg
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1654 )
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1655 if installed:
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1656 # try to import it again
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1657 try:
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8314
diff changeset
1658 from PyQt6.QtCore import qVersion
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1659 except ImportError as msg:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1660 print("Sorry, please install PyQt6.")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1661 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
1662 exit(1)
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1663 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1664 print("Sorry, please install PyQt6.")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1665 print("Error: {0}".format(msg))
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1666 exit(1)
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1667 print("Found PyQt6")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1668
837
10547522aa98 Added a check for QtHelp to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 796
diff changeset
1669 try:
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1670 pyuic = "pyuic6"
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1671 from PyQt6 import uic # __IGNORE_WARNING__
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1672 except ImportError as err:
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
1673 print("Sorry, {0} is not installed.".format(pyuic))
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1674 if verbose:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1675 print("Error: {0}".format(err))
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
1676 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
1677 print("Found {0}".format(pyuic))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1678
8566
0df55126fdf4 Preliminary change to install the eric7 web browser unconditionally (for development and testing only).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8553
diff changeset
1679 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1680 from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1681 except ImportError as err:
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1682 if isSudo:
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1683 print("Optional 'PyQt6-WebEngine' could not be detected.")
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1684 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1685 msg = "Optional 'PyQt6-WebEngine' could not be detected.{0}".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1686 "\nError: {0}".format(err) if verbose else ""
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1687 )
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1688 pipInstall(
8739
55e07d9608f0 Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8721
diff changeset
1689 "PyQt6-WebEngine>={0}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1690 versionToStr(requiredVersions["pyqt6-webengine"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1691 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1692 msg,
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1693 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1694
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
1695 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1696 from PyQt6 import QtCharts # __IGNORE_WARNING__
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1697 except ImportError as err:
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1698 if isSudo:
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1699 print("Optional 'PyQt6-Charts' could not be detected.")
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1700 else:
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1701 msg = "Optional 'PyQt6-Charts' could not be detected.{0}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1702 "\nError: {0}".format(err) if verbose else ""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1703 )
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1704 pipInstall(
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1705 "PyQt6-Charts>={0}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1706 versionToStr(requiredVersions["pyqt6-charts"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1707 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1708 msg,
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1709 )
8343
242d5dae2937 Corrected some place to import QtCharts instead of QtChart.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8339
diff changeset
1710 print("Found PyQt6-Charts")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1711
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1712 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1713 from PyQt6 import Qsci # __IGNORE_WARNING__
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1714 except ImportError as err:
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1715 msg = "'PyQt6-QScintilla' could not be detected.{0}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1716 "\nError: {0}".format(err) if verbose else ""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1717 )
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1718 installed = not isSudo and pipInstall(
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1719 "PyQt6-QScintilla>={0}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1720 versionToStr(requiredVersions["pyqt6-qscintilla"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1721 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1722 msg,
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1723 )
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1724 if installed:
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1725 # try to import it again
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1726 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1727 from PyQt6 import Qsci # __IGNORE_WARNING__
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1728
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1729 message = None
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1730 except ImportError as msg:
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1731 message = str(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
1732 else:
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1733 message = "PyQt6-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
1734 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
1735 print("Sorry, please install QScintilla2 and")
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1736 print("its PyQt6 wrapper.")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1737 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
1738 exit(1)
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1739 print("Found PyQt6-QScintilla")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1740
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1741 pyqt6BaseModulesList = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1742 "PyQt6.QtGui",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1743 "PyQt6.QtNetwork",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1744 "PyQt6.QtPrintSupport",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1745 "PyQt6.QtSql",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1746 "PyQt6.QtSvg",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1747 "PyQt6.QtSvgWidgets",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1748 "PyQt6.QtWidgets",
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1749 ]
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1750 requiredModulesList = {
8128
8f012c58f27e Changed setup.py and the install script to include the dependency to PyYAML and toml packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8127
diff changeset
1751 # key is pip project name
8f012c58f27e Changed setup.py and the install script to include the dependency to PyYAML and toml packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8127
diff changeset
1752 # value is tuple of package name, pip install constraint
9107
8e9525a780ae Syntax Checker
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9066
diff changeset
1753 "tomlkit": ("tomlkit", ""),
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1754 "asttokens": ("asttokens", ""),
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1755 "EditorConfig": ("editorconfig", ""),
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1756 "Pygments": ("pygments", ""),
8593
1d66b6af60ed Jedi: integrated the Assistant Jedi plugin as a fixed part of eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8566
diff changeset
1757 "parso": ("parso", ""),
1d66b6af60ed Jedi: integrated the Assistant Jedi plugin as a fixed part of eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8566
diff changeset
1758 "jedi": ("jedi", ""),
8977
663521af48b2 Started implementing a vulnerability checker based on the data of the Safety DB.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8966
diff changeset
1759 "packaging": ("packaging", ""),
9117
c6afba2049cf CycloneDX Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
1760 "cyclonedx-python-lib": ("cyclonedx", ""),
c6afba2049cf CycloneDX Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
1761 "cyclonedx-bom": ("cyclonedx_py", ""),
9175
21e2be5f0b41 Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9143
diff changeset
1762 "trove-classifiers": ("trove_classifiers", ""),
9214
bd28e56047d7 Code Formatting
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1763 "black": ("black", ">=22.6.0"),
8128
8f012c58f27e Changed setup.py and the install script to include the dependency to PyYAML and toml packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8127
diff changeset
1764 }
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1765 optionalModulesList = {
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1766 # key is pip project name
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1767 # value is tuple of package name, pip install constraint
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1768 "docutils": ("docutils", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1769 "Markdown": ("markdown", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1770 "pyyaml": ("yaml", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1771 "chardet": ("chardet", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1772 "Send2Trash": ("send2trash", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1773 "pyenchant": ("enchant", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1774 "wheel": ("wheel", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1775 }
8548
c87eb20797b7 Activated support for the 'qt6-applications' project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8522
diff changeset
1776 if not ignorePyqt6Tools:
c87eb20797b7 Activated support for the 'qt6-applications' project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8522
diff changeset
1777 optionalModulesList["qt6-applications"] = ("qt6_applications", "")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1778
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1779 # check mandatory PyQt6 modules
3681
3a79355b9ca5 Fixed a bugs in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3678
diff changeset
1780 modulesOK = True
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1781 for pyqt6BaseModule in pyqt6BaseModulesList:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1782 name = pyqt6BaseModule.split(".")[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
1783 try:
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1784 __import__(pyqt6BaseModule)
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
1785 print("Found", name)
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1786 except ImportError as err:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1787 print("Sorry, please install {0}.".format(name))
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1788 if verbose:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1789 print("Error: {0}".format(err))
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
1790 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
1791 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
1792 exit(1)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1793
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1794 # check required modules
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1795 requiredMissing = False
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1796 for requiredPackage in requiredModulesList:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1797 try:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1798 __import__(requiredModulesList[requiredPackage][0])
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1799 print("Found", requiredPackage)
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1800 except ImportError as err:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1801 if isSudo:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1802 print("Required '{0}' could not be detected.".format(requiredPackage))
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1803 requiredMissing = True
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1804 else:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1805 msg = "Required '{0}' could not be detected.{1}".format(
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1806 requiredPackage, "\nError: {0}".format(err) if verbose else ""
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1807 )
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1808 pipInstall(
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1809 requiredPackage + requiredModulesList[requiredPackage][1],
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1810 msg,
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1811 force=True,
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1812 )
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1813 if requiredMissing:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1814 print("Some required packages are missing and could not be installed.")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1815 print("Install them manually with:")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1816 print(" {0} install-dependencies.py --required".format(sys.executable))
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1817
7745
43888e12e481 install.py: added code section to check for and install optional packages (like pyqt5-tools).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7740
diff changeset
1818 # check optional modules
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1819 optionalMissing = False
7745
43888e12e481 install.py: added code section to check for and install optional packages (like pyqt5-tools).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7740
diff changeset
1820 for optPackage in optionalModulesList:
43888e12e481 install.py: added code section to check for and install optional packages (like pyqt5-tools).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7740
diff changeset
1821 try:
8127
9534be896b85 setup.py, install.py: fixed PyQt version to < 5.15.2 in order to get a working config on Debian.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8060
diff changeset
1822 __import__(optionalModulesList[optPackage][0])
7745
43888e12e481 install.py: added code section to check for and install optional packages (like pyqt5-tools).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7740
diff changeset
1823 print("Found", optPackage)
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1824 except ImportError as err:
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1825 if isSudo:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1826 print("Optional '{0}' could not be detected.".format(optPackage))
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1827 optionalMissing = True
7812
44004f273a7b install script: changed code to not ask to installe prerequisites if it is run as root user (= UID 0)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7809
diff changeset
1828 else:
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1829 msg = "Optional '{0}' could not be detected.{1}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1830 optPackage, "\nError: {0}".format(err) if verbose else ""
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
1831 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1832 pipInstall(optPackage + optionalModulesList[optPackage][1], msg)
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1833 if optionalMissing:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1834 print("Some optional packages are missing and could not be installed.")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1835 print("Install them manually with:")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1836 print(" {0} install-dependencies.py --optional".format(sys.executable))
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1837
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1838 if requiredMissing and optionalMissing:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1839 print("Alternatively you may install all of them with:")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1840 print(" {0} install-dependencies.py --all".format(sys.executable))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1841
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1842 # determine the platform dependent black list
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
1843 if sys.platform.startswith(("win", "cygwin")):
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1844 PlatformBlackLists = PlatformsBlackLists["windows"]
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1845 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
1846 PlatformBlackLists = PlatformsBlackLists["linux"]
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1847 else:
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1848 PlatformBlackLists = PlatformsBlackLists["mac"]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1849
8386
41a27cbdb5c1 install.py: modified the version display slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
1850 print("\nVersion Information")
41a27cbdb5c1 install.py: modified the version display slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
1851 print("-------------------")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1852
8754
e7d63a5a2ae9 Corrected the last change a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8753
diff changeset
1853 print("Python: {0:d}.{1:d}.{2:d}".format(*sys.version_info[:3]))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1854
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1855 # check version of Qt
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1856 # ===================
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1857 qtMajor = int(qVersion().split(".")[0])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1858 qtMinor = int(qVersion().split(".")[1])
8386
41a27cbdb5c1 install.py: modified the version display slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
1859 print("Qt6: {0}".format(qVersion().strip()))
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1860 if qtMajor == 6 and qtMinor < 1:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1861 print("Sorry, you must have Qt version 6.1.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
1862 exit(2)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1863
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1864 # check version of sip
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1865 # ====================
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8240
diff changeset
1866 with contextlib.suppress(ImportError, AttributeError):
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6360
diff changeset
1867 try:
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8314
diff changeset
1868 from PyQt6 import sip
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6360
diff changeset
1869 except ImportError:
6365
85f8745427a6 Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6364
diff changeset
1870 import sip
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1871 print("sip:", sip.SIP_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
1872 # always assume, that snapshots or dev versions are new enough
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1873 if "snapshot" not in sip.SIP_VERSION_STR and "dev" not in sip.SIP_VERSION_STR:
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1874 if sip.SIP_VERSION < requiredVersions["sip"]:
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1875 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1876 "Sorry, you must have sip {0} or higher or"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1877 " a recent development release.".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1878 versionToStr(requiredVersions["sip"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1879 )
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1880 )
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1881 exit(3)
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1882 # 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
1883 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]:
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1884 if vers == sip.SIP_VERSION:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1885 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1886 "Sorry, sip version {0} is not compatible with eric.".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1887 versionToStr(vers)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1888 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1889 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1890 print("Please install another version.")
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1891 exit(3)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1892
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1893 # check version of PyQt6
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1894 # ======================
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1895 from PyQt6.QtCore import PYQT_VERSION, PYQT_VERSION_STR
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1896
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1897 print("PyQt6:", PYQT_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
1898 # always assume, that snapshots or dev versions are new enough
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1899 if "snapshot" not in PYQT_VERSION_STR and "dev" not in PYQT_VERSION_STR:
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1900 if PYQT_VERSION < requiredVersions["pyqt6"]:
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1901 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1902 "Sorry, you must have PyQt {0} or better or"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1903 " a recent development release.".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1904 versionToStr(requiredVersions["pyqt6"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1905 )
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1906 )
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1907 exit(4)
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1908 # check for blacklisted versions
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1909 for vers in BlackLists["PyQt6"] + PlatformBlackLists["PyQt6"]:
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1910 if vers == PYQT_VERSION:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1911 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1912 "Sorry, PyQt version {0} is not compatible with eric.".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1913 versionToStr(vers)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1914 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1915 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1916 print("Please install another version.")
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1917 exit(4)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1918
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1919 # check version of QScintilla
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1920 # ===========================
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1921 from PyQt6.Qsci import QSCINTILLA_VERSION, QSCINTILLA_VERSION_STR
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1922
8386
41a27cbdb5c1 install.py: modified the version display slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
1923 print("PyQt6-QScintilla:", 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
1924 # always assume, that snapshots or dev versions are new enough
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1925 if "snapshot" not in QSCINTILLA_VERSION_STR and "dev" not in QSCINTILLA_VERSION_STR:
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1926 if QSCINTILLA_VERSION < requiredVersions["pyqt6-qscintilla"]:
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1927 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1928 "Sorry, you must have PyQt6-QScintilla {0} or higher or"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1929 " a recent development release.".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1930 versionToStr(requiredVersions["pyqt6-qscintilla"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1931 )
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1932 )
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1933 exit(5)
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1934 # check for blacklisted versions
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1935 for vers in BlackLists["QScintilla2"] + PlatformBlackLists["QScintilla2"]:
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1936 if vers == QSCINTILLA_VERSION:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
1937 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1938 "Sorry, QScintilla2 version {0} is not compatible with"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1939 " eric.".format(versionToStr(vers))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1940 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1941 print("Please install another version.")
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1942 exit(5)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1943
7329
72f3c9fdefeb Added some code to show the version info for PyQtChart and PyQtWebEngine, if this is available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7302
diff changeset
1944 # print version info for additional modules
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8240
diff changeset
1945 with contextlib.suppress(NameError, AttributeError):
8343
242d5dae2937 Corrected some place to import QtCharts instead of QtChart.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8339
diff changeset
1946 print("PyQt6-Charts:", QtCharts.PYQT_CHART_VERSION_STR)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1947
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8240
diff changeset
1948 with contextlib.suppress(ImportError, AttributeError):
8553
10d31e5ce9e5 First batch of changes for QtWebEngine as of Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8548
diff changeset
1949 from PyQt6 import QtWebEngineCore
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1950
8553
10d31e5ce9e5 First batch of changes for QtWebEngine as of Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8548
diff changeset
1951 print("PyQt6-WebEngine:", QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1952
8388
f864abd11a5b install.py: beautified the output a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8387
diff changeset
1953 print()
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1954 print("All dependencies ok.")
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1955 print()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1956
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1957
4435
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1958 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
1959 """
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1960 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
1961 .ui file.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1962
4435
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1963 @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
1964 @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
1965 @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
1966 """
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1967 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
1968
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1969
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1970 def compileUiFiles():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1971 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1972 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
1973 """
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8314
diff changeset
1974 from PyQt6.uic import compileUiDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1975
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1976 compileUiDir(eric7SourceDir, True, __pyName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1977
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1978
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
1979 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
1980 """
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
1981 Function to prepare an Info.py file when installing from source.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1982
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
1983 @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
1984 """
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
1985 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
1986 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1987
8240
93b8a353c4bf Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8214
diff changeset
1988 with contextlib.suppress(OSError):
4307
6a8ec996a49c Little enhancement of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4239
diff changeset
1989 os.rename(fileName, fileName + ".orig")
8522
4f263b89a293 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8501
diff changeset
1990 localHg = (
4f263b89a293 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8501
diff changeset
1991 os.path.join(sys.exec_prefix, "Scripts", "hg.exe")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1992 if sys.platform.startswith(("win", "cygwin"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1993 else os.path.join(sys.exec_prefix, "bin", "hg")
8522
4f263b89a293 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8501
diff changeset
1994 )
8475
f1f7646e8e24 Updated the install script to use a environment specific mercurial if that is available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8458
diff changeset
1995 for hg in (localHg, "hg"):
f1f7646e8e24 Updated the install script to use a environment specific mercurial if that is available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8458
diff changeset
1996 with contextlib.suppress(OSError, subprocess.CalledProcessError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1997 hgOut = subprocess.run( # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1998 [hg, "identify", "-i"], check=True, capture_output=True, text=True
8966
c6f67dbc6ee7 Changed calls to subprocess.call() and subprocess.check_output() to use subprocess.run().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8918
diff changeset
1999 ).stdout
8475
f1f7646e8e24 Updated the install script to use a environment specific mercurial if that is available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8458
diff changeset
2000 if hgOut:
f1f7646e8e24 Updated the install script to use a environment specific mercurial if that is available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8458
diff changeset
2001 break
f1f7646e8e24 Updated the install script to use a environment specific mercurial if that is available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8458
diff changeset
2002 else:
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
2003 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
2004 if hgOut:
4239
4883661fc427 Little improvement to the recent install.py change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4238
diff changeset
2005 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
2006 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
2007 hgOut = hgOut[:-1]
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
2008 with open(fileName + ".orig", "r", encoding="utf-8") as f:
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
2009 text = f.read()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2010 text = text.replace("@@REVISION@@", hgOut).replace(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2011 "@@VERSION@@", "rev_" + hgOut
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
2012 )
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
2013 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
2014 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
2015 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
2016
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
2017
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2018 def getWinregEntry(name, path):
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2019 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2020 Function to get an entry from the Windows Registry.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2021
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2022 @param name variable name
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2023 @type str
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2024 @param path registry path of the variable
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2025 @type str
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2026 @return value of requested registry variable
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2027 @rtype any
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2028 """
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2029 try:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
2030 import winreg
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2031 except ImportError:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
2032 return None
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2033
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2034 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2035 registryKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, path, 0, winreg.KEY_READ)
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2036 value, _ = winreg.QueryValueEx(registryKey, name)
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2037 winreg.CloseKey(registryKey)
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2038 return value
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2039 except WindowsError:
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2040 return None
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2041
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2042
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2043 def createWindowsShortcut(linkPath, targetPath, iconPath):
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2044 """
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2045 Create Windows shortcut.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2046
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2047 @param linkPath path of the shortcut file
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2048 @type str
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2049 @param targetPath path the shortcut shall point to
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2050 @type str
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2051 @param iconPath path of the icon file
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2052 @type str
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2053 """
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2054 from win32com.client import Dispatch
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2055 from pywintypes import com_error
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2056
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8240
diff changeset
2057 with contextlib.suppress(com_error):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2058 shell = Dispatch("WScript.Shell")
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2059 shortcut = shell.CreateShortCut(linkPath)
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2060 shortcut.Targetpath = targetPath
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2061 shortcut.WorkingDirectory = os.path.dirname(targetPath)
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2062 shortcut.IconLocation = iconPath
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2063 shortcut.save()
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2064
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2065
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2066 def windowsDesktopNames():
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2067 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2068 Function to generate the link names for the Windows Desktop.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2069
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2070 @return list of desktop link names
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2071 @rtype list of str
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2072 """
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2073 return [e[0] for e in windowsDesktopEntries()]
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2074
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2075
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2076 def windowsDesktopEntries():
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2077 """
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2078 Function to generate data for the Windows Desktop links.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2079
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2080 @return list of tuples containing the desktop link name,
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2081 the link target and the icon target
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2082 @rtype list of tuples of (str, str, str)
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2083 """
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
2084 global cfg
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2085
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2086 majorVersion, minorVersion = sys.version_info[:2]
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2087 entriesTemplates = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2088 (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2089 "eric7 (Python {0}.{1}).lnk",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2090 os.path.join(cfg["bindir"], "eric7.cmd"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2091 os.path.join(cfg["ericPixDir"], "eric7.ico"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2092 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2093 (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2094 "eric7 Browser (Python {0}.{1}).lnk",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2095 os.path.join(cfg["bindir"], "eric7_browser.cmd"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2096 os.path.join(cfg["ericPixDir"], "ericWeb48.ico"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2097 ),
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2098 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2099
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2100 return [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2101 (e[0].format(majorVersion, minorVersion), e[1], e[2]) for e in entriesTemplates
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
2102 ]
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2103
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2104
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2105 def windowsProgramsEntry():
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2106 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2107 Function to generate the name of the Start Menu top entry.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2108
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2109 @return name of the Start Menu top entry
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2110 @rtype str
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2111 """
7203
2079ccbfa335 install, uninstall scripts: re-added the removal of the obsolete eric6_webbrowser stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7192
diff changeset
2112 majorVersion, minorVersion = sys.version_info[:2]
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2113 return "eric7 (Python {0}.{1})".format(majorVersion, minorVersion)
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2114
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2115
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2116 def main(argv):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2117 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2118 The main function of the script.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2119
6594
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
2120 @param argv list of command line arguments
7ecac3b1c7aa install: second attempt to cope with tricks done by pywin32 at interpreter startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6593
diff changeset
2121 @type list of str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2122 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2123 import getopt
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2124
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2125 # Parse the command line.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2126 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2127 global sourceDir, eric7SourceDir, configName
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
2128 global macAppBundlePath, macAppBundleName, macPythonExe
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
2129 global installApis, doCleanDesktopLinks, yes2All
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
2130 global createInstallInfoFile, installCwd
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
2131 global ignorePyqt6Tools
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
2132 global verbose
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2133
8918
2167e507b277 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
2134 if sys.version_info < (3, 7, 0) or sys.version_info > (3, 99, 99):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2135 print("Sorry, eric requires at least Python 3.7 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
2136 exit(5)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2137
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2138 progName = os.path.basename(argv[0])
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2139
7813
5d0dbec7b815 Main Window: added code to update the saved install information after an update.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7812
diff changeset
2140 installCwd = os.getcwd()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2141
1662
dadf3f4ee800 Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1658
diff changeset
2142 if os.path.dirname(argv[0]):
1965
96f5a76e1845 Fixed some PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1914
diff changeset
2143 os.chdir(os.path.dirname(argv[0]))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2144
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2145 initGlobals()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2146
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2147 try:
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
2148 if sys.platform.startswith(("win", "cygwin")):
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
2149 optlist, args = getopt.getopt(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2150 argv[1:],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2151 "chvxza:b:d:f:",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2152 ["help", "no-apis", "no-info", "no-tools", "verbose", "yes"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2153 )
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
2154 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
2155 optlist, args = getopt.getopt(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2156 argv[1:],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2157 "chvxza:b:d:f:i:m:n:p:",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2158 ["help", "no-apis", "no-info", "no-tools", "verbose", "yes"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2159 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2160 else:
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
2161 optlist, args = getopt.getopt(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2162 argv[1:],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2163 "chvxza:b:d:f:i:",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2164 ["help", "no-apis", "no-info", "no-tools", "verbose", "yes"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2165 )
3935
f6ba54e022fa Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3931
diff changeset
2166 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
2167 print(err)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2168 usage()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2169
2586
d6daabefb7a6 Reverted some of the install.py changes for Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2583
diff changeset
2170 global platBinDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2171
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2172 depChecks = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2173
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2174 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
2175 if opt in ["-h", "--help"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2176 usage(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2177 elif opt == "-a":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2178 apisDir = arg
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2179 elif opt == "-b":
2586
d6daabefb7a6 Reverted some of the install.py changes for Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2583
diff changeset
2180 platBinDir = arg
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2181 elif opt == "-d":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2182 modDir = arg
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2183 elif opt == "-i":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2184 distDir = os.path.normpath(arg)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2185 elif opt == "-x":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2186 depChecks = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2187 elif opt == "-c":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2188 doCleanup = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2189 elif opt == "-z":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2190 doCompile = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2191 elif opt == "-f":
8214
51f0d3e047ec install script: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
2192 with open(arg) as f:
51f0d3e047ec install script: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
2193 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2194 exec(compile(f.read(), arg, "exec"), globals())
8214
51f0d3e047ec install script: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
2195 # secok
51f0d3e047ec install script: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
2196 if len(cfg) != configLength:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2197 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2198 "The configuration dictionary in '{0}' is"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2199 " incorrect. Aborting".format(arg)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2200 )
8214
51f0d3e047ec install script: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
2201 exit(6)
51f0d3e047ec install script: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
2202 except Exception:
51f0d3e047ec install script: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
2203 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
2204 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
2205 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
2206 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
2207 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
2208 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
2209 macPythonExe = arg
6663
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
2210 elif opt == "--no-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
2211 installApis = False
6663
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
2212 elif opt == "--clean-desktop":
fe9da2b5d148 install.py: updated help texts and added an option (--clean-desktop) to delete the desktop links before installation on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6660
diff changeset
2213 doCleanDesktopLinks = True
7333
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
2214 elif opt == "--yes":
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
2215 yes2All = True
7821
12406e6ba24c install.py: added option --no-tools to ignore installation of pyqt5-tools.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7814
diff changeset
2216 elif opt == "--no-tools":
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
2217 ignorePyqt6Tools = True
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
2218 elif opt == "--no-info":
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
2219 createInstallInfoFile = False
8656
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
2220 elif opt in ["-v", "--verbose"]:
8fbaa183c41e Added the --verbose (-v) option to the install script to show a bit more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8654
diff changeset
2221 verbose = True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2222
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
2223 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
2224 installFromSource = not os.path.isdir(sourceDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2225
6641
42de1c3e8777 install: moved the dependencies check earlier in the installiation order.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6640
diff changeset
2226 # check dependencies
42de1c3e8777 install: moved the dependencies check earlier in the installiation order.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6640
diff changeset
2227 if depChecks:
42de1c3e8777 install: moved the dependencies check earlier in the installiation order.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6640
diff changeset
2228 doDependancyChecks()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2229
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
2230 if installFromSource:
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
2231 sourceDir = os.path.abspath("..")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2232
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
2233 eric7SourceDir = (
9231
d92a18dffa5e Slight modificytion to the install script to handle cleanup a bit better.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
2234 os.path.join(sourceDir, "src", "eric7")
d92a18dffa5e Slight modificytion to the install script to handle cleanup a bit better.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
2235 if os.path.exists(os.path.join(sourceDir, "src", "eric7"))
d92a18dffa5e Slight modificytion to the install script to handle cleanup a bit better.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
2236 else os.path.join(sourceDir, "eric7")
9209
b99e7fd55fd3 Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9175
diff changeset
2237 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2238
6638
df711aa509d3 install: moved the source cleanup routine to avoid deleting saved Info.py and eric6config.py files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6637
diff changeset
2239 # cleanup source if installing from source
df711aa509d3 install: moved the source cleanup routine to avoid deleting saved Info.py and eric6config.py files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6637
diff changeset
2240 if installFromSource:
df711aa509d3 install: moved the source cleanup routine to avoid deleting saved Info.py and eric6config.py files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6637
diff changeset
2241 print("Cleaning up source ...")
9231
d92a18dffa5e Slight modificytion to the install script to handle cleanup a bit better.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
2242 cleanupSource(sourceDir)
6638
df711aa509d3 install: moved the source cleanup routine to avoid deleting saved Info.py and eric6config.py files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6637
diff changeset
2243 print()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2244
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2245 configName = os.path.join(eric7SourceDir, "eric7config.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
2246 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
2247 # we are installing from source with repo
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2248 infoName = os.path.join(eric7SourceDir, "UI", "Info.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
2249 prepareInfoFile(infoName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2250
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2251 if len(cfg) == 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2252 createInstallConfig()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2253
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2254 # get rid of development config file, if it exists
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8240
diff changeset
2255 with contextlib.suppress(OSError):
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
2256 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
2257 os.rename(configName, configName + ".orig")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2258 configNameC = configName + "c"
626
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
2259 if os.path.exists(configNameC):
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
2260 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
2261 os.remove(configName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2262
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2263 # cleanup old installation
2634
8bd79dfb48a5 Added a few more feedback to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2618
diff changeset
2264 print("Cleaning up old installation ...")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2265 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2266 if doCleanup:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2267 if distDir:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2268 shutil.rmtree(distDir, True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2269 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2270 cleanUp()
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7835
diff changeset
2271 except OSError as msg:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2272 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
2273 exit(7)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2274
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2275 # 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
2276 print("\nCreating configuration file ...")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2277 createConfig()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2278
7804
1cbc27e34ec6 Implementing code to record and/or guess some information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7799
diff changeset
2279 createInstallInfo()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2280
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2281 # Compile .ui files
2634
8bd79dfb48a5 Added a few more feedback to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2618
diff changeset
2282 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
2283 # 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
2284 for root, _, files in os.walk(sourceDir):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2285 for file in [f for f in files if fnmatch.fnmatch(f, "Ui_*.py")]:
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
2286 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
2287 # step 2: compile the forms
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2288 compileUiFiles()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2289
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2290 if doCompile:
2634
8bd79dfb48a5 Added a few more feedback to the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2618
diff changeset
2291 print("\nCompiling source files ...")
5180
9eba139a2756 Changed RegEx to be independent from Python version.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5145
diff changeset
2292 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
2293 sys.stdout = io.StringIO()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2294 if distDir:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
2295 compileall.compile_dir(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2296 eric7SourceDir,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2297 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
2298 rx=skipRe,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2299 quiet=True,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2300 )
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
2301 py_compile.compile(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2302 configName, dfile=os.path.join(distDir, modDir, "eric7config.py")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2303 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2304 else:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
2305 compileall.compile_dir(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2306 eric7SourceDir,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2307 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
2308 rx=skipRe,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2309 quiet=True,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2310 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2311 py_compile.compile(configName, dfile=os.path.join(modDir, "eric7config.py"))
2680
110ac646a3a0 Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
2312 sys.stdout = sys.__stdout__
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
2313 print("\nInstalling eric ...")
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
2314 res = installEric()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2315
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
2316 if createInstallInfoFile:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2317 with open(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2318 os.path.join(cfg["ericDir"], installInfoName), "w"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2319 ) as installInfoFile:
7921
0d429bd82699 install.py: added the '--no-info' flag to supress the generation of the install info file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
2320 json.dump(installInfo, installInfoFile, indent=2)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2321
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
2322 # do some cleanup
8240
93b8a353c4bf Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8214
diff changeset
2323 with contextlib.suppress(OSError):
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
2324 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
2325 os.remove(configName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2326 configNameC = configName + "c"
626
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
2327 if os.path.exists(configNameC):
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
2328 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
2329 os.rename(configName + ".orig", configName)
8240
93b8a353c4bf Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8214
diff changeset
2330 with contextlib.suppress(OSError):
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
2331 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
2332 os.remove(infoName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2333 infoNameC = infoName + "c"
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
2334 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
2335 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
2336 os.rename(infoName + ".orig", infoName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2337
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
2338 print("\nInstallation complete.")
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
2339 print()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2340
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
2341 exit(res)
8988
ffa38e0415df Added a script to install all of eric's dependencies.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8977
diff changeset
2342
ffa38e0415df Added a script to install all of eric's dependencies.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8977
diff changeset
2343
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2344 if __name__ == "__main__":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2345 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2346 main(sys.argv)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2347 except SystemExit:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2348 raise
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
2349 except Exception:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2350 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2351 """An internal error occured. Please report all the output"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2352 """ of the program,\nincluding the following traceback, to"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2353 """ eric-bugs@eric-ide.python-projects.org.\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2354 )
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
2355 raise
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
2356
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
2357 #
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
2358 # eflag: noqa = M801

eric ide

mercurial