scripts/install.py

Mon, 18 Dec 2023 17:45:20 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 18 Dec 2023 17:45:20 +0100
branch
eric7
changeset 10420
5ac83a87954d
parent 10417
c6011e501282
child 10439
21c28b0f9e41
permissions
-rw-r--r--

Converted some source code documentation to the new style.

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
9653
e67609152c5e Updated copyright for 2023.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9632
diff changeset
4 # Copyright (c) 2002 - 2023 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
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
12 import argparse
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
13 import compileall
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
14 import contextlib
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
15 import datetime
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
16 import fnmatch
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
17 import getpass
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
18 import glob
9485
0f3620304d7a Changed code to use 'iimportlib.import_module()' instead of '__import__()'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
19 import importlib
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
20 import io
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
21 import json
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 import os
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
23 import py_compile
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 import re
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8476
diff changeset
25 import shlex
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 import shutil
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
27 import subprocess # secok
9420
92810aebc909 Changed the code to use sysconfig.get_path("scripts") wherever possible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9402
diff changeset
28 import sys
92810aebc909 Changed the code to use sysconfig.get_path("scripts") wherever possible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9402
diff changeset
29 import sysconfig
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
30 import time
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
9986
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
32 from functools import partial
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
33
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 # Define the globals.
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
35 currDir = os.getcwd()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 modDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 pyModDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 platBinDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 distDir = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 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
41 installApis = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 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
43 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
44 forceCleanDesktopLinks = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 doCompile = True
7333
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
46 yes2All = False
9356
803a7a85b071 Changed the install script to only install the qt6-applications package if requested explicitly (--with-tools).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9347
diff changeset
47 withPyqt6Tools = 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
48 verbose = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 cfg = {}
9361
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
50 progLanguages = ["MicroPython", "Python3", "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
51 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
52 eric7SourceDir = ""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
53 configName = "eric7config.py"
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
54 defaultMacAppBundleName = "eric7.app"
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
55 defaultMacAppBundlePath = "/Applications"
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
56 defaultMacUserAppBundlePath = os.path.expanduser("~/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
57 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
58 sys.exec_prefix
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
59 )
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
60 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
61 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
62 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
63 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
64 macPythonExe = defaultMacPythonExe
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
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
66 createInstallInfoFile = True
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
67 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
68 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
69 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
70
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
71 # 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
72 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
73 "sip": [],
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
74 "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
75 "QScintilla2": [],
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
76 }
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
77 PlatformsBlackLists = {
10334
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
78 "freebsd": {
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
79 "sip": [],
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
80 "PyQt6": [],
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
81 "QScintilla2": [],
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
82 },
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
83 "linux": {
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
84 "sip": [],
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
85 "PyQt6": [],
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
86 "QScintilla2": [],
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
87 },
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
88 "mac": {
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
89 "sip": [],
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
90 "PyQt6": [],
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
91 "QScintilla2": [],
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
92 },
10334
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
93 "windows": {
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
94 "sip": [],
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
95 "PyQt6": [],
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
96 "QScintilla2": [],
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
97 },
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
98 }
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
99
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
100
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
101 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
102 """
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
103 Exit the install script.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
104
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
105 @param rcode result code to report back
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
106 @type int
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
107 """
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
108 global currDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
109
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
110 print()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
111
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
112 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
113 with contextlib.suppress(EOFError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
114 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
115
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
116 os.chdir(currDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
117
390
daa7c6ae6248 Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 386
diff changeset
118 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
119
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
120
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 def initGlobals():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
123 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
124 simple assignment.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 """
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
126 global platBinDir, modDir, pyModDir, apisDir, macAppBundlePath
9221
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 if sys.platform.startswith(("win", "cygwin")):
9420
92810aebc909 Changed the code to use sysconfig.get_path("scripts") wherever possible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9402
diff changeset
129 platBinDir = sysconfig.get_path("scripts")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 else:
9420
92810aebc909 Changed the code to use sysconfig.get_path("scripts") wherever possible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9402
diff changeset
131 # install the eric scripts along the python executable
92810aebc909 Changed the code to use sysconfig.get_path("scripts") wherever possible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9402
diff changeset
132 platBinDir = sysconfig.get_path("scripts")
92810aebc909 Changed the code to use sysconfig.get_path("scripts") wherever possible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9402
diff changeset
133 if not os.access(platBinDir, 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
134 # 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
135 platBinDir = os.path.expanduser("~/bin")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
137 modDir = sysconfig.get_path("platlib")
10091
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10090
diff changeset
138 if not os.access(modDir, os.W_OK):
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10090
diff changeset
139 # can't write to the standard path, use the 'user' path instead
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10090
diff changeset
140 if sys.platform.startswith(("win", "cygwin")):
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10090
diff changeset
141 scheme = "nt_user"
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10090
diff changeset
142 elif sys.platform == "darwin":
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10090
diff changeset
143 scheme = "osx_framework_user"
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10090
diff changeset
144 else:
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10090
diff changeset
145 scheme = "posix_user"
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10090
diff changeset
146 modDir = sysconfig.get_path("platlib", scheme)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 pyModDir = modDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
148
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
149 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
150 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
151 # 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
152 qtDataDir = pyqtDataDir
8640
b4e75efa081d Corrected the APIs installation path in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8634
diff changeset
153 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
154 # 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
155 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
156 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
157 # determine dynamically
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
158 try:
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
159 from PyQt6.QtCore import QLibraryInfo # noqa: I101, I102
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
160
8615
d43e7eb22319 Fixed some issues related to Qt enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8611
diff changeset
161 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
162 except ImportError:
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2586
diff changeset
163 qtDataDir = None
8214
51f0d3e047ec install script: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
164 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
165
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
166 if sys.platform == "darwin":
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
167 if os.getuid() == 0:
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
168 macAppBundlePath = defaultMacAppBundlePath
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
169 else:
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
170 macAppBundlePath = defaultMacUserAppBundlePath
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
171
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 def copyToFile(name, text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 Copy a string to a file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
177 @param name name of the file
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
178 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
179 @param text contents to copy to the file
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
180 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 """
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
182 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
183 f.write(text)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
186 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
187 """
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
188 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
189
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
190 @param src source file name
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
191 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
192 @param dst destination file name
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
193 @type str
3931
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
194 """
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
195 global cfg, platBinDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
196
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
197 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
198 text = f.read()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
199
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
200 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
201 text = text.replace("@MARKER@", "")
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
202 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
203
9347
da982d5b0718 Improved the install script to create some more non-existing directories and deal with permission errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
204 dstPath = os.path.dirname(dst)
da982d5b0718 Improved the install script to create some more non-existing directories and deal with permission errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
205 if not os.path.isdir(dstPath):
da982d5b0718 Improved the install script to create some more non-existing directories and deal with permission errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
206 os.makedirs(dstPath)
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
207 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
208 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
209 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
210
ff8e034662d6 Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3897
diff changeset
211
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
212 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
213 """
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
214 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
215
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
216 @param src source file name
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
217 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
218 @param dst destination file name
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
219 @type str
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
220 """
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
221 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
222 # Installing from installer archive
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
223 from eric.src.eric7.UI.Info import Version # noqa: I101, I102
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
224 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
225 # Installing from source tree
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
226 from src.eric7.UI.Info import Version # noqa: I101, I102
5214
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
227 else:
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
228 Version = "Unknown"
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
229
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
230 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
231 text = f.read()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
232
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
233 text = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
234 text.replace("@MARKER@", "")
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
235 .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
236 .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
237 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
238
9347
da982d5b0718 Improved the install script to create some more non-existing directories and deal with permission errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
239 dstPath = os.path.dirname(dst)
da982d5b0718 Improved the install script to create some more non-existing directories and deal with permission errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
240 if not os.path.isdir(dstPath):
da982d5b0718 Improved the install script to create some more non-existing directories and deal with permission errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
241 os.makedirs(dstPath)
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
242 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
243 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
244 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
245
0473e5256ca9 Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5145
diff changeset
246
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
247 def wrapperNames(dname, wfile):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 """
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
249 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
250
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 @param dname name of the directory to place the wrapper into
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
252 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 @param wfile basename (without extension) of the wrapper script
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
254 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
255 @return list containing the names of the wrapper scripts
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
256 @rtype list of str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 """
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
258 wnames = (
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
259 [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
260 if sys.platform.startswith(("win", "cygwin"))
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
261 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
262 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263
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
264 return wnames
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266
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
267 def createPyWrapper(pydir, wfile, saveDir, isGuiScript=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 Create an executable wrapper for a Python script.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
271 @param pydir name of the directory where the Python script will
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
272 eventually be installed
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
273 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
274 @param wfile basename of the wrapper
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
275 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
276 @param saveDir directory to save the file into
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
277 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
278 @param isGuiScript flag indicating a wrapper script for a GUI application
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
279 @type bool
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
280 @return the platform specific name of the wrapper
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
281 @rtype str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 # 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
284 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
285 wname = wfile + ".cmd"
899
4687532058ba Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
286 if isGuiScript:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
287 wrapper = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
288 """@echo off\n"""
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
289 '''start "" "{2}\\pythonw.exe"'''
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
290 ''' "{0}\\{1}.pyw"'''
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
291 """ %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
292 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
293 )
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
294 )
899
4687532058ba Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
295 else:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
296 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
297 '''@"{0}" "{1}\\{2}.py"'''
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
298 """ %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
299 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 # Mac OS X
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 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
303 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
304 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
305 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
306 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
307 wname = wfile
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
308 wrapper = (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
309 """#!/bin/sh\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
310 """\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
311 """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
312 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 # *nix systems
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 else:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
316 wname = wfile
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
317 wrapper = (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
318 """#!/bin/sh\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
319 """\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
320 """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
321 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
322
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
323 wname = os.path.join(saveDir, wname)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 copyToFile(wname, wrapper)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
325 os.chmod(wname, 0o755) # secok
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 return wname
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329
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
330 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
331 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 Copy Python, translation, documentation, wizards configuration,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 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
334
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 @param src name of the source directory
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
336 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 @param dst name of the destination directory
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
338 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 @param filters list of filter pattern determining the files to be copied
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
340 @type list of str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 @param excludeDirs list of (sub)directories to exclude from copying
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
342 @type list of str
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7894
diff changeset
343 @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
344 be skipped
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
345 @type list of str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 """
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
347 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
348 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
349 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
350 excludePatterns = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 names = os.listdir(src)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 except OSError:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
354 # 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
355 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
356
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 for name in names:
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
358 skipIt = False
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
359 for excludePattern in excludePatterns:
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
360 if fnmatch.fnmatch(name, excludePattern):
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
361 skipIt = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 break
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
363 if not skipIt:
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
364 srcname = os.path.join(src, name)
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
365 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
366 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
367 if fnmatch.fnmatch(srcname, fileFilter):
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
368 if not os.path.isdir(dst):
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
369 os.makedirs(dst)
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
370 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
371 os.chmod(dstname, 0o644)
1115
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
372 break
3032cc87dee2 Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents: 945
diff changeset
373 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
374 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
375 copyTree(srcname, dstname, filters, excludePatterns=excludePatterns)
0
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
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 def createGlobalPluginsDir():
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 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
381 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 global cfg, distDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
383
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
384 pdir = os.path.join(cfg["mdir"], "eric7plugins")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 fname = os.path.join(pdir, "__init__.py")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 if not os.path.exists(fname):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 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
388 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
389 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
390 f.write(
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
391 '''# -*- coding: utf-8 -*-
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 Package containing the global plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
396 '''
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
397 )
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
398 os.chmod(fname, 0o644)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400
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
401 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
402 """
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
403 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
404 and directories.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
405
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
406 @param dirName name of the directory to prune
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
407 @type str
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
408 """
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
409 # 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
410 # *.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
411 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
412 for formName, sourceName in [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
413 (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
414 for f in dirListing
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
415 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
416 ]:
3594
778ae276540f Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3593
diff changeset
417 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
418 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
419 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
420 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
421
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4915
diff changeset
422 # 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
423 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
424 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
425 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
426 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
427
6637
54a92e8dca00 install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6636
diff changeset
428 # 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
429 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
430 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
431
6637
54a92e8dca00 install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6636
diff changeset
432 # 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
433 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
434 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
435 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
436 cleanupSource(name)
3595
a8433c7a0d8c Fixed another issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3594
diff changeset
437 if len(os.listdir(name)) == 0:
a8433c7a0d8c Fixed another issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3594
diff changeset
438 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
439
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
440
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 def cleanUp():
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 Uninstall the old eric files.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 """
9420
92810aebc909 Changed the code to use sysconfig.get_path("scripts") wherever possible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9402
diff changeset
445 global platBinDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
446
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 try:
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
448 from eric7.Globals import getConfig # noqa: I101
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449 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
450 # eric wasn't installed previously
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 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
452 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
453 # 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
454 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
455
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 global pyModDir, progLanguages
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
457
146
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 133
diff changeset
458 # Remove the menu entry for Linux systems
10334
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
459 if sys.platform.startswith(("linux", "freebsd")):
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
460 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
461 # 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
462 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
463 cleanUpWindowsLinks()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
464
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 # Remove the wrapper scripts
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 rem_wnames = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
467 "eric7_api",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
468 "eric7_browser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
469 "eric7_compare",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
470 "eric7_configure",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
471 "eric7_diff",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
472 "eric7_doc",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
473 "eric7_editor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
474 "eric7_hexeditor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
475 "eric7_iconeditor",
9377
b9c8dc3b7da1 Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9366
diff changeset
476 "eric7_ide",
9697
cdaa3cc805f7 Started implementing a PDF viewer tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9694
diff changeset
477 "eric7_pdf",
10084
125166c6b66c pip Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10065
diff changeset
478 "eric7_pip",
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
479 "eric7_plugininstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
480 "eric7_pluginrepository",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
481 "eric7_pluginuninstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
482 "eric7_qregularexpression",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
483 "eric7_re",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
484 "eric7_shell",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
485 "eric7_snap",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
486 "eric7_sqlbrowser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
487 "eric7_testing",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
488 "eric7_tray",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
489 "eric7_trpreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
490 "eric7_uipreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
491 "eric7_virtualenv",
9066
a219ade50f7c Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9034
diff changeset
492 # 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
493 "eric7_unittest",
9377
b9c8dc3b7da1 Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9366
diff changeset
494 "eric7",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
496
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
497 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
498 dirs = [platBinDir, getConfig("bindir")]
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
499 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
500 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
501 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
502 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
503 os.remove(rwname)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
504
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
505 # 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
506 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
507 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
508 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
509 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
510 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
511 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
512 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
513 os.remove(f)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
514
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
515 # Cleanup the install directories
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
516 for name in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
517 "ericExamplesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
518 "ericDocDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
519 "ericDTDDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
520 "ericCSSDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
521 "ericIconDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
522 "ericPixDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
523 "ericTemplatesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
524 "ericCodeTemplatesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
525 "ericOthersDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
526 "ericStylesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
527 "ericThemesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
528 "ericDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
529 ]:
8821
0485c183b718 Ignore unknown configuration keys during cleanup of install.py and uninstall.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8820
diff changeset
530 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
531 if os.path.exists(getConfig(name)):
10403
ea3320d5e8e9 Changed code using "shutil.rmtree()" more readable by adding "ignore_errors=" where this parameter is non-default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10373
diff changeset
532 shutil.rmtree(getConfig(name), ignore_errors=True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
533
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
534 # Cleanup translations
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
535 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
536 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
537 ):
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
538 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
539 os.remove(name)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
540
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
541 # 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
542 with contextlib.suppress(AttributeError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
543 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
544 for progLanguage in progLanguages:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
545 for name in getConfig("apis"):
9361
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
546 # step 1: programming language as given
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
547 apiname = os.path.join(apidir, progLanguage, name)
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
548 if os.path.exists(apiname):
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
549 os.remove(apiname)
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
550 # step 2: programming language as lowercase
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
551 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
552 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
553 os.remove(apiname)
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
554 for apiname in glob.glob(
9361
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
555 os.path.join(apidir, progLanguage, "*.bas")
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
556 ) + glob.glob(os.path.join(apidir, progLanguage.lower(), "*.bas")):
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
557 if os.path.exists(apiname):
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
558 os.remove(apiname)
9361
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
559
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
560 # remove empty directories
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
561 with contextlib.suppress(FileNotFoundError, OSError):
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
562 os.rmdir(os.path.join(apidir, progLanguage))
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
563 with contextlib.suppress(FileNotFoundError, OSError):
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9356
diff changeset
564 os.rmdir(os.path.join(apidir, progLanguage.lower()))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
565
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
566 if sys.platform == "darwin":
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
567 # 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
568 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
569 except OSError as msg:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
570 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
571 exit(7)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573
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
574 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
575 """
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
576 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
577 """
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
578 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
579 for name in [
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
580 "/usr/share/appdata/eric7.appdata.xml",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
581 "/usr/share/metainfo/eric7.appdata.xml",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
582 "/usr/share/applications/eric7_browser.desktop",
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
583 "/usr/share/applications/eric7_ide.desktop",
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
584 "/usr/share/icons/eric.png",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
585 "/usr/share/icons/ericWeb.png",
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
586 "/usr/share/pixmaps/eric.png",
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
587 "/usr/share/pixmaps/ericWeb.png",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
588 # obsolete entries below
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
589 "/usr/share/applications/eric7.desktop",
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
590 ]:
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
591 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
592 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
593 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
594 # 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
595 for name in [
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
596 "~/.local/share/appdata/eric7.appdata.xml",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
597 "~/.local/share/metainfo/eric7.appdata.xml",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
598 "~/.local/share/applications/eric7_browser.desktop",
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
599 "~/.local/share/applications/eric7_ide.desktop",
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
600 "~/.local/share/icons/eric.png",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
601 "~/.local/share/icons/ericWeb.png",
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
602 "~/.local/share/pixmaps/eric.png",
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
603 "~/.local/share/pixmaps/ericWeb.png",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
604 # obsolete entries below
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
605 "~/.local/share/applications/eric7.desktop",
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
606 ]:
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 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
608 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
609 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
610
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
611
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
612 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
613 """
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
614 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
615 """
9448
ea215f7afab3 Fixed an issue importing the eric7config module.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9425
diff changeset
616 from eric7.Globals import getConfig
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
617
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 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
619 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
620 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
621 except AttributeError:
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
622 macAppBundlePath = (
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
623 defaultMacAppBundlePath if os.getpid() == 0 else defaultMacUserAppBundlePath
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
624 )
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
625 macAppBundleName = defaultMacAppBundleName
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
626 for bundlePath in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
627 os.path.join(defaultMacAppBundlePath, macAppBundleName),
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
628 os.path.join(defaultMacUserAppBundlePath, macAppBundleName),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
629 os.path.join(macAppBundlePath, macAppBundleName),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
630 ]:
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
631 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
632 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
633
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
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 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
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 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
638 """
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
639 if importlib.util.find_spec("pywintypes") is None:
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
640 # 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
641 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
642
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
643 global doCleanDesktopLinks, forceCleanDesktopLinks
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
644
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
645 regPath = (
10372
1444b4bee64b Fixed some code style issue related to implicitly and explicitly concatenated strings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10341
diff changeset
646 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
647 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
648
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
649 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
650 # 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
651 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
652 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
653 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
654 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry))
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
655 for linkName in windowsDesktopNames(clean=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
656 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
657 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
658 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
659 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
660 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
661 # 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
662 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
663
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
664 # 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
665 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
666 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
667 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
668 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
669 eric7EntryPath = os.path.join(programsFolder, windowsProgramsEntry())
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
670 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
671 try:
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
672 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
673 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
674 # maybe restrictions prohibited link removal
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
675 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
676
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
677
2177
a59ffbc5fe4c Fixed an error in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2160
diff changeset
678 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
679 """
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
680 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
681
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
682 @param src source file name
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
683 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
684 @param dst destination file name or directory name
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
685 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
686 @param perm permissions to be set
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
687 @type int
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
688 """
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
689 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
690 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
691 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
692 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
693
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
694
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 def installEric():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 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
698
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
699 @return result code
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
700 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 """
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
702 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
703 global installApis
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
704
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
705 # 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
706 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
707 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
708 os.mkdir(scriptsDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 wnames = []
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
710 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
711 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
712 for name in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
713 "eric7_browser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
714 "eric7_compare",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
715 "eric7_configure",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
716 "eric7_diff",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
717 "eric7_editor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
718 "eric7_hexeditor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
719 "eric7_iconeditor",
9377
b9c8dc3b7da1 Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9366
diff changeset
720 "eric7_ide",
9697
cdaa3cc805f7 Started implementing a PDF viewer tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9694
diff changeset
721 "eric7_pdf",
10084
125166c6b66c pip Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10065
diff changeset
722 "eric7_pip",
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
723 "eric7_plugininstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
724 "eric7_pluginrepository",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
725 "eric7_pluginuninstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
726 "eric7_qregularexpression",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
727 "eric7_re",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
728 "eric7_shell",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
729 "eric7_snap",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
730 "eric7_sqlbrowser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
731 "eric7_tray",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
732 "eric7_trpreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
733 "eric7_uipreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
734 "eric7_testing",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
735 "eric7_virtualenv",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
736 ]:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
737 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
738
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 # set install prefix, if not None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 if distDir:
10373
093dcebe5ecb Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10372
diff changeset
741 for key in cfg:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
742 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
743
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745 # Install the files
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 # 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
747 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
748 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
749 os.makedirs(cfg[key])
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
750
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
751 # copy the eric config file
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 if distDir:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
753 shutilCopy(configName, cfg["mdir"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
754 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
755 shutilCopy(configName + "c", cfg["mdir"])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 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
757 shutilCopy(configName, modDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
758 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
759 shutilCopy(configName + "c", modDir)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
760
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
761 # 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
762 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
763 eric7SourceDir,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
764 cfg["ericDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
765 ["*.py", "*.pyc", "*.pyo", "*.pyw"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
766 excludePatterns=["eric7config.py*"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
767 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
768 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
769 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
770 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
771 ["*.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
772 )
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
773 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
774 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
775 cfg["ericDocDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
776 ["*.html", "*.qch"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
777 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
778 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
779 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
780 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
781 cfg["ericStylesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
782 ["*.qss", "*.ehj"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
783 )
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
784 copyTree(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
785 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
786 )
8820
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
787 copyTree(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
788 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
789 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
790 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
791 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
792 cfg["ericIconDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
793 ["*.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
794 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
795 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
796 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
797 cfg["ericPixDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
798 ["*.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
799 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
800 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
801 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
802 cfg["ericTemplatesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
803 ["*.tmpl"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
804 )
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
805 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
806 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
807 cfg["ericCodeTemplatesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
808 ["*.tmpl"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
809 )
8776
07b8c13b0607 Updated the setup and install script for the updated coverage package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8754
diff changeset
810 copyTree(
07b8c13b0607 Updated the setup and install script for the updated coverage package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8754
diff changeset
811 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
812 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
813 ["*.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
814 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
815
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
816 # 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
817 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
818 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
819 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
820 ["*.txt"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
821 )
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
822 copyTree(
8354
12ebd3934fef Renamed 'E5Utilities' to 'EricUtilities' and 'E5Network' to 'EricNetwork'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8343
diff changeset
823 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
824 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
825 ["*.dat", "*.txt"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
826 )
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
827 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
828 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
829 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
830 ["*.xpm"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
831 )
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
832 copyTree(
9917
0160b2816f84 Corrected the install script to install the UF2 families file as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9819
diff changeset
833 os.path.join(eric7SourceDir, "MicroPython", "Tools"),
0160b2816f84 Corrected the install script to install the UF2 families file as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9819
diff changeset
834 os.path.join(cfg["ericDir"], "MicroPython", "Tools"),
0160b2816f84 Corrected the install script to install the UF2 families file as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9819
diff changeset
835 ["*.json"],
0160b2816f84 Corrected the install script to install the UF2 families file as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9819
diff changeset
836 )
0160b2816f84 Corrected the install script to install the UF2 families file as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9819
diff changeset
837 copyTree(
10090
8be7dd9460c5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
838 os.path.join(eric7SourceDir, "MicroPython", "BluetoothDialogs", "data"),
8be7dd9460c5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
839 os.path.join(cfg["ericDir"], "MicroPython", "BluetoothDialogs", "data"),
8be7dd9460c5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
840 ["*.yaml"],
8be7dd9460c5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
841 )
8be7dd9460c5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
842 copyTree(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
843 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
844 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
845 ["*.css"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
846 )
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
847 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
848 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
849 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
850 ["*.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
851 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
852
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853 # copy the wrappers
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 for wname in wnames:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
855 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
856 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
857 shutil.rmtree(scriptsDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
858
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859 # copy the license file
9674
43dd357b3bff Modified the pyproject.toml file to include a reference to the license file and changed its extension to be .txt.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
860 shutilCopy(os.path.join(sourceDir, "docs", "LICENSE.txt"), cfg["ericDir"])
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
861
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
862 # create the global plugins directory
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 createGlobalPluginsDir()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
864
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
865 except OSError as msg:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
866 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
867 return 7
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 some text files to the doc area
9680
4acdf7c7101d Corrected an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9679
diff changeset
870 for name in ["LICENSE.txt", "THANKS", "changelog.md", "ThirdParty.md"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
872 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
873 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
874 print(
9722
63135ab601e7 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9697
diff changeset
875 "\nCould not install '{0}'.".format(
63135ab601e7 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9697
diff changeset
876 os.path.join(sourceDir, "docs", name)
63135ab601e7 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9697
diff changeset
877 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
878 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
879 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
880 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
881 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
882 except OSError:
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
883 print("\nCould 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
884
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
885 # copy some more stuff
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
886 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
887 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
888 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
889 except OSError:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
890 print(
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
891 "\nCould not install '{0}'.".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
892 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
893 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
894 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
895
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
896 # 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
897 if installApis:
9366
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
898 if os.access(cfg["apidir"], os.W_OK):
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
899 for progLanguage in progLanguages:
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
900 apidir = os.path.join(cfg["apidir"], progLanguage)
9347
da982d5b0718 Improved the install script to create some more non-existing directories and deal with permission errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
901 if not os.path.exists(apidir):
da982d5b0718 Improved the install script to create some more non-existing directories and deal with permission errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
902 os.makedirs(apidir)
9366
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
903 for apiName in glob.glob(
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
904 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api")
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
905 ):
2160
1874d4410904 Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2145
diff changeset
906 shutilCopy(apiName, apidir)
9366
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
907 for apiName in glob.glob(
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
908 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.bas")
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
909 ):
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
910 shutilCopy(apiName, apidir)
9366
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
911 else:
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
912 print("\nThe API directory '{0}' is not writable.".format(cfg["apidir"]))
9366
57980203d6f8 Improved the install script with respect to API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
913 print("Use the API files provided by the 'API Files' plug-in.")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
914
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
915 # Create menu entry for Linux systems
10334
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
916 if sys.platform.startswith(("linux", "freebsd")):
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
917 createLinuxSpecifics()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
918
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
919 # 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
920 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
921 createWindowsLinks()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
922
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
923 # 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
924 elif sys.platform == "darwin":
10065
de4ae767b0e3 Corrected and checked some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10046
diff changeset
925 createMacAppBundle()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
926
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
927 return 0
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
928
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
929
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
930 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
931 """
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
932 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
933 """
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
934 global distDir, sourceDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
935
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
936 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
937
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
938 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
939 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
940 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
941 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
942 shutilCopy(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
943 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
944 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
945 )
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
946 shutilCopy(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
947 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
948 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
949 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
950
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
951 dst = os.path.normpath(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
952 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
953 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
954 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
955 os.makedirs(dst)
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
956 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
957 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
958 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
959 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
960 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
961 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
962 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
963 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
964
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
965 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
966 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
967 os.makedirs(dst)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
968 copyDesktopFile(
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
969 os.path.join(dataSourceDir, "eric7_ide.desktop.in"),
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
970 os.path.join(dst, "eric7_ide.desktop"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
971 )
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
972 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
973 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
974 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
975 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
976
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
977 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
978 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
979 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
980 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
981 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
982 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
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 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
985 shutilCopy(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
986 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
987 "/usr/share/icons/eric.png",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
988 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
989 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
990 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
991 "/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
992 )
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
993 copyDesktopFile(
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
994 os.path.join(dataSourceDir, "eric7_ide.desktop.in"),
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
995 "/usr/share/applications/eric7_ide.desktop",
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
996 )
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
997 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
998 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
999 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
1000 "/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
1001 )
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
1002 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
1003 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
1004 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
1005 "/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
1006 )
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
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", "ericWeb48_icon.png"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1009 "/usr/share/icons/ericWeb.png",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1010 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1011 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
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 "/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
1014 )
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1015 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
1016 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
1017 "/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
1018 )
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
1019 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
1020 # 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
1021 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
1022 # create directories first
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1023 for directory in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1024 os.path.join(localPath, name)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1025 for name in (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1026 "icons",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1027 "icons/hicolor/48x48/apps",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1028 "applications",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1029 "metainfo",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1030 "appdata",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1031 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1032 ]:
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
1033 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
1034 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
1035 # 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
1036 shutilCopy(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1037 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
1038 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
1039 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1040 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1041 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
1042 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
1043 )
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
1044 copyDesktopFile(
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
1045 os.path.join(dataSourceDir, "eric7_ide.desktop.in"),
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
1046 os.path.join(localPath, "applications", "eric7_ide.desktop"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1047 )
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1048 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
1049 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
1050 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
1051 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1052 copyAppStreamFile(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1053 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
1054 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
1055 )
8660
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1056 shutilCopy(
1848e8e4b380 Improved installation procedure to also create application icons on ChromeOS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8656
diff changeset
1057 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
1058 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
1059 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1060 shutilCopy(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1061 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
1062 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
1063 )
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1064 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
1065 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
1066 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
1067 )
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
1068
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
1069
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
1070 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
1071 """
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
1072 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
1073 """
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1074 if importlib.util.find_spec("win32com") is None:
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
1075 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
1076 "pywin32",
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1077 "\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
1078 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
1079 )
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
1080 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
1081 # 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
1082 # 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
1083 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
1084 sys.executable,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1085 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
1086 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1087 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
1088 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
1089 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
1090 "\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
1091 " 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
1092 )
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
1093 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1094
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1095 regPath = (
10372
1444b4bee64b Fixed some code style issue related to implicitly and explicitly concatenated strings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10341
diff changeset
1096 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1097 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1098
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
1099 # 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
1100 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
1101 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
1102 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
1103 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
1104 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
1105 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
1106 createWindowsShortcut(linkPath, targetPath, iconPath)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1107
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
1108 # 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
1109 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
1110 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
1111 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
1112 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
1113 eric7EntryPath = os.path.join(programsFolder, windowsProgramsEntry())
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1114 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
1115 try:
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1116 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
1117 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
1118 # 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
1119 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1120
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
1121 for linkName, targetPath, iconPath in windowsDesktopEntries():
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1122 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
1123 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
1124
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
1125
10065
de4ae767b0e3 Corrected and checked some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10046
diff changeset
1126 def createMacAppBundle():
1387
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1127 """
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1128 Create a Mac application bundle.
1734bc5f4f82 Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1385
diff changeset
1129 """
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1130 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
1131
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
1132 directories = {
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1133 "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
1134 "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
1135 "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
1136 }
7227
5ba312e6599a install.py: fixed an issue causing installation on macOS to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7220
diff changeset
1137 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
1138 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
1139 os.makedirs(directory)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1140
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
1141 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
1142 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
1143 os.symlink(macPythonExe, starter)
f83826045e51 Change install.py for Mac again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2307
diff changeset
1144 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
1145 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
1146
9377
b9c8dc3b7da1 Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9366
diff changeset
1147 wname = os.path.join(directories["exe"], "eric7_ide")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1148
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
1149 # 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
1150 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
1151 try:
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1152 from PyQt6.QtCore import QLibraryInfo # noqa: I101, I102
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1153
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1154 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
1155 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
1156 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
1157 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
1158 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
1159
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
1160 # 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
1161 pathLine = ""
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1162 path = os.getenv("PATH", "")
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1163 if path:
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1164 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
1165 pathlist = path.split(os.pathsep)
4911
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1166 pathlist_n = [pybin]
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1167 for path_ in pathlist:
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1168 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
1169 pathlist_n.append(path_)
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1170 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
1171
4911
652cb0520e9a Improved the Mac app bundle creation function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4889
diff changeset
1172 # create the wrapper script
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1173 wrapper = (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1174 """#!/bin/sh\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1175 """\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1176 """{0}"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1177 """{1}"""
9402
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
1178 """exec "{2}" "-m" "eric7" "$@"\n""".format(pathLine, dyldLine, starter)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1179 )
1390
f4a7915db1e6 Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1389
diff changeset
1180 copyToFile(wname, wrapper)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1181 os.chmod(wname, 0o755) # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1182
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1183 shutilCopy(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1184 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
1185 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
1186 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1187
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1188 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
1189 # Installing from archive
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1190 from eric.eric7.UI.Info import CopyrightShort, Version # noqa: I101, I102
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1191 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
1192 # Installing from source tree
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1193 from eric7.UI.Info import CopyrightShort, Version # noqa: I101
6664
50c9c1c9cf30 install.py: extended and corrected the macOS application bundle generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6663
diff changeset
1194 else:
50c9c1c9cf30 install.py: extended and corrected the macOS application bundle generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6663
diff changeset
1195 Version = "Unknown"
9653
e67609152c5e Updated copyright for 2023.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9632
diff changeset
1196 CopyrightShort = "(c) 2002 - 2023 Detlev Offenbach"
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1197
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
1198 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
1199 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
1200 """<?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
1201 """<!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
1202 """ "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
1203 """<plist version="1.0">\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1204 """<dict>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1205 """ <key>CFBundleExecutable</key>\n"""
9377
b9c8dc3b7da1 Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9366
diff changeset
1206 """ <string>eric7_ide</string>\n"""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1207 """ <key>CFBundleIconFile</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1208 """ <string>eric.icns</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1209 """ <key>CFBundleInfoDictionaryVersion</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1210 """ <string>{1}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1211 """ <key>CFBundleName</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1212 """ <string>{0}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1213 """ <key>CFBundleDisplayName</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1214 """ <string>{0}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1215 """ <key>CFBundlePackageType</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1216 """ <string>APPL</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1217 """ <key>CFBundleSignature</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1218 """ <string>ERIC-IDE</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1219 """ <key>CFBundleVersion</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1220 """ <string>{1}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1221 """ <key>CFBundleGetInfoString</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1222 """ <string>{1}, {2}</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1223 """ <key>CFBundleIdentifier</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1224 """ <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
1225 """ <key>NSRequiresAquaSystemAppearance</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1226 """ <string>false</string>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1227 """ <key>LSEnvironment</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1228 """ <dict>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1229 """ <key>LANG</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1230 """ <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
1231 """ <key>LC_ALL</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1232 """ <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
1233 """ <key>LC_CTYPE</key>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1234 """ <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
1235 """ </dict>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1236 """</dict>\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1237 """</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
1238 macAppBundleName.replace(".app", ""),
50c9c1c9cf30 install.py: extended and corrected the macOS application bundle generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6663
diff changeset
1239 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
1240 CopyrightShort,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1241 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1242 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1243
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1244
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1245 def createInstallConfig():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1246 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1247 Create the installation config dictionary.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1248 """
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1249 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
1250
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
1251 ericdir = os.path.join(modDir, "eric7")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1252 cfg = {
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1253 "ericDir": ericdir,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1254 "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
1255 "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
1256 "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
1257 "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
1258 "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
1259 "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
1260 "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
1261 "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
1262 "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
1263 "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
1264 "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
1265 "ericOthersDir": ericdir,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1266 "bindir": platBinDir,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1267 "mdir": modDir,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1268 }
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1269 if installApis:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1270 if apisDir:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1271 cfg["apidir"] = apisDir
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1272 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1273 cfg["apidir"] = os.path.join(ericdir, "api")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1274 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1275 cfg["apidir"] = ""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1276
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1277
8820
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1278 configLength = 16
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1279
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1280
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1281 def createConfig():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1282 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1283 Create a config file with the respective config entries.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1284 """
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
1285 global cfg, macAppBundlePath, configName
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1286
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1287 apis = []
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1288 if installApis:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
1289 for progLanguage in progLanguages:
6960
1d4e02425869 install.py: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6956
diff changeset
1290 for apiName in sorted(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1291 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
1292 ):
40
c2e5472b112c Changed some code to adjust eric5 to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 21
diff changeset
1293 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
1294
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
1295 macConfig = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1296 (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1297 """ 'macAppBundlePath': r'{0}',\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1298 """ 'macAppBundleName': r'{1}',\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1299 ).format(macAppBundlePath, macAppBundleName)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1300 if sys.platform == "darwin"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1301 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
1302 )
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1303 config = (
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1304 """# -*- coding: utf-8 -*-\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1305 """#\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
1306 """# 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
1307 """ installation\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1308 """#\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1309 """\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1310 """_pkg_config = {{\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1311 """ 'ericDir': r'{0}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1312 """ 'ericPixDir': r'{1}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1313 """ 'ericIconDir': r'{2}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1314 """ 'ericDTDDir': r'{3}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1315 """ 'ericCSSDir': r'{4}',\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1316 """ 'ericStylesDir': r'{5}',\n"""
8820
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1317 """ 'ericThemesDir': r'{6}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1318 """ 'ericDocDir': r'{7}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1319 """ 'ericExamplesDir': r'{8}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1320 """ 'ericTranslationsDir': r'{9}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1321 """ 'ericTemplatesDir': r'{10}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1322 """ 'ericCodeTemplatesDir': r'{11}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1323 """ 'ericOthersDir': r'{12}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1324 """ 'bindir': r'{13}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1325 """ 'mdir': r'{14}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1326 """ 'apidir': r'{15}',\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1327 """ 'apis': {16},\n"""
149f941d072e Finished implementing a manager for color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8776
diff changeset
1328 """{17}"""
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1329 """}}\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1330 """\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1331 """def getConfig(name):\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1332 """ '''\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1333 """ 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
1334 """\n"""
5628
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1335 """ @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
1336 """ @type str\n"""
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1337 """ @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
1338 """ config entry\n"""
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1339 """ '''\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1340 """ try:\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1341 """ return _pkg_config[name]\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1342 """ except KeyError:\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1343 """ pass\n"""
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1344 """\n"""
5628
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1345 """ raise AttributeError(\n"""
3a1bef0560b1 Corrected some left overs of a failed installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
1346 """ '"{{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
1347 """.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
1348 ).format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1349 cfg["ericDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1350 cfg["ericPixDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1351 cfg["ericIconDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1352 cfg["ericDTDDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1353 cfg["ericCSSDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1354 cfg["ericStylesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1355 cfg["ericThemesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1356 cfg["ericDocDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1357 cfg["ericExamplesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1358 cfg["ericTranslationsDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1359 cfg["ericTemplatesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1360 cfg["ericCodeTemplatesDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1361 cfg["ericOthersDir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1362 cfg["bindir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1363 cfg["mdir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1364 cfg["apidir"],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1365 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
1366 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
1367 )
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
1368 copyToFile(configName, config)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1369
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1370
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
1371 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
1372 """
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
1373 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
1374 """
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
1375 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
1376
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
1377 if createInstallInfoFile:
10192
f457742dd3d6 Modified the datetime.datetime methods to include the 'tz' argument.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10177
diff changeset
1378 installDateTime = datetime.datetime.now(tz=datetime.timezone.utc)
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
1379 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
1380 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
1381 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
1382 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
1383 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
1384 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
1385 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
1386 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
1387 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
1388 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
1389 os.path.expanduser("~")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1390 )
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
1391 installInfo["installed"] = True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1392 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
1393 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
1394 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
1395 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
1396 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
1397 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
1398 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
1399 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
1400 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
1401
7823
9a4e93471a06 install.py: fixed a code style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7821
diff changeset
1402
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1403 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
1404 """
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
1405 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
1406
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
1407 @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
1408 @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
1409 @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
1410 @type str
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1411 @param force flag indicating to perform the installation
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1412 without asking the user
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1413 @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
1414 @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
1415 @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
1416 """
7333
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
1417 global yes2All
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1418
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
1419 ok = False
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1420 if yes2All or force:
7333
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
1421 answer = "y"
8479201bdf7b install.py
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7329
diff changeset
1422 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1423 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1424 "{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
1425 message, packageName
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1426 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1427 end=" ",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1428 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1429 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
1430 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
1431 exitCode = subprocess.run( # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1432 [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1433 sys.executable,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1434 "-m",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1435 "pip",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1436 "install",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1437 "--prefer-binary",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1438 "--upgrade",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1439 packageName,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1440 ]
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
1441 ).returncode
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1442 ok = exitCode == 0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1443
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
1444 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
1445
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
1446
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1447 def isPipOutdated():
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1448 """
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1449 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
1450
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1451 @return flag indicating an outdated pip
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1452 @rtype bool
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1453 """
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1454 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
1455 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
1456 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
1457 [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
1458 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
1459 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
1460 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
1461 )
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
1462 .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
1463 .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
1464 )
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
1465 # 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
1466 except (OSError, subprocess.CalledProcessError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1467 pipOut = "[]" # default empty list
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1468 try:
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1469 jsonList = json.loads(pipOut)
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1470 except Exception:
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1471 jsonList = []
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1472 for package in jsonList:
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1473 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
1474 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1475 "'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
1476 package["version"], package["latest_version"]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1477 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1478 )
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1479 return True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1480
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1481 return False
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1482
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1483
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
1484 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
1485 """
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
1486 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
1487 """
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
1488 global yes2All
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1489
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
1490 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
1491 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
1492 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
1493 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
1494 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
1495 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
1496 subprocess.run( # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1497 [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
1498 )
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
1499
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
1500
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1501 def versionToStr(version):
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1502 """
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1503 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
1504
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1505 @param version version number to convert
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1506 @type int
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1507 @return version string
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1508 @rtype str
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1509 """
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1510 parts = []
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1511 while version:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1512 parts.append(version & 0xFF)
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1513 version >>= 8
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1514 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
1515
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1516
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1517 def doDependancyChecks():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1518 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1519 Perform some dependency checks.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1520 """
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
1521 global verbose
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1522
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1523 requiredVersions = {
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1524 "pyqt6": 0x60200, # v6.2.0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1525 "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
1526 "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
1527 "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
1528 "sip": 0x60100, # v6.1.0
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1529 }
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1530
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
1531 try:
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
1532 isSudo = os.getuid() == 0
8261
0c2aa0ad149f install script: little change for macOS installations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
1533 # 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
1534 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
1535 isSudo = False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1536
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1537 print("Checking dependencies")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1538
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
1539 # 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
1540 if not isSudo and isPipOutdated():
7453
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1541 updatePip()
54431a52b7f2 install.py: refined the pip update process
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7448
diff changeset
1542 print("\n")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1543
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1544 # perform dependency checks
10162
e7040c88b39e Made some modification in preparation for Python 3.12.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10122
diff changeset
1545 if sys.version_info < (3, 8, 0) or sys.version_info >= (3, 13, 0):
e7040c88b39e Made some modification in preparation for Python 3.12.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10122
diff changeset
1546 print("Sorry, you must have Python 3.8.0 or higher, but less 3.13.0.")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1547 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
1548 exit(5)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1549
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1550 if (
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1551 importlib.util.find_spec("xml") is None
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1552 or importlib.util.find_spec("xml.etree") is None
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1553 ):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1554 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
1555 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
1556 exit(5)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1557
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1558 print("PyQt & Qt")
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1559 print("---------")
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1560 try:
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1561 from PyQt6.QtCore import qVersion # noqa: I101, I102
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
1562 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
1563 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
1564 "\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
1565 )
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
1566 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
1567 "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
1568 )
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1569 if installed:
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1570 # try to import it again
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1571 try:
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1572 from PyQt6.QtCore import qVersion # noqa: I101, I102
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1573 except ImportError as msg:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1574 print("Sorry, please install PyQt6.")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1575 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
1576 exit(1)
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1577 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1578 print("Sorry, please install PyQt6.")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1579 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
1580 exit(1)
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1581 print("Found PyQt6")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1582
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1583 pyuic = "pyuic6"
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1584 if importlib.util.find_spec("PyQt6.uic") is None:
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
1585 print("Sorry, {0} is not installed.".format(pyuic))
9b30c587513c Added a check for pyuic to the install script to prevent errors later on in the installation, if it is not installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
1586 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
1587 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
1588
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1589 if importlib.util.find_spec("PyQt6.QtWebEngineWidgets") is None:
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1590 if isSudo:
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1591 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
1592 else:
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1593 msg = "Optional 'PyQt6-WebEngine' could not be detected."
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1594 pipInstall(
8739
55e07d9608f0 Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8721
diff changeset
1595 "PyQt6-WebEngine>={0}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1596 versionToStr(requiredVersions["pyqt6-webengine"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1597 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1598 msg,
8634
2bbfaad44cbd Activated some code related to Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8615
diff changeset
1599 )
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1600 print("Found PyQt6-WebEngine")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1601
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1602 if importlib.util.find_spec("PyQt6.QtCharts") is None:
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
1603 if isSudo:
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1604 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
1605 else:
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1606 msg = "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
1607 pipInstall(
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1608 "PyQt6-Charts>={0}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1609 versionToStr(requiredVersions["pyqt6-charts"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1610 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1611 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
1612 )
8343
242d5dae2937 Corrected some place to import QtCharts instead of QtChart.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8339
diff changeset
1613 print("Found PyQt6-Charts")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1614
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1615 if importlib.util.find_spec("PyQt6.Qsci") is None:
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1616 msg = "'PyQt6-QScintilla' 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
1617 installed = not isSudo and pipInstall(
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1618 "PyQt6-QScintilla>={0}".format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1619 versionToStr(requiredVersions["pyqt6-qscintilla"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1620 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1621 msg,
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1622 )
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1623 message = None if installed else "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
1624 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
1625 print("Sorry, please install QScintilla2 and")
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1626 print("its PyQt6 wrapper.")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1627 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
1628 exit(1)
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1629 print("Found PyQt6-QScintilla")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1630
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1631 pyqt6BaseModulesList = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1632 "PyQt6.QtGui",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1633 "PyQt6.QtNetwork",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1634 "PyQt6.QtPrintSupport",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1635 "PyQt6.QtSql",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1636 "PyQt6.QtSvg",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1637 "PyQt6.QtSvgWidgets",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1638 "PyQt6.QtWidgets",
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
1639 ]
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1640 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
1641 # 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
1642 # value is tuple of package name, pip install constraint
9107
8e9525a780ae Syntax Checker
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9066
diff changeset
1643 "tomlkit": ("tomlkit", ""),
8258
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1644 "asttokens": ("asttokens", ""),
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1645 "EditorConfig": ("editorconfig", ""),
82b608e352ec Third Party packages
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
1646 "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
1647 "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
1648 "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
1649 "packaging": ("packaging", ""),
9117
c6afba2049cf CycloneDX Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
1650 "cyclonedx-python-lib": ("cyclonedx", ""),
c6afba2049cf CycloneDX Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
1651 "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
1652 "trove-classifiers": ("trove_classifiers", ""),
9214
bd28e56047d7 Code Formatting
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1653 "black": ("black", ">=22.6.0"),
9453
e5065dde905d Code Formatting
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9448
diff changeset
1654 "isort": ("isort", ">=5.10.0"),
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1655 "coverage": ("coverage", ">=6.5.0"),
9744
92fbd6bdba84 Changed code converting a version string into a version tuple to use the 'semver' package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9732
diff changeset
1656 "semver": ("semver", ""),
10177
27a6e35c64ed Changed the included 'pipdeptree' to an external dependency.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10162
diff changeset
1657 "pipdeptree": ("pipdeptree", ""),
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
1658 }
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1659 optionalModulesList = {
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1660 # key is pip project name
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1661 # value is tuple of package name, pip install constraint
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1662 "docutils": ("docutils", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1663 "Markdown": ("markdown", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1664 "pyyaml": ("yaml", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1665 "chardet": ("chardet", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1666 "pyenchant": ("enchant", ""),
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1667 "wheel": ("wheel", ""),
10341
3fdffd9cc21d Syntax Checker
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10334
diff changeset
1668 "esprima": ("esprima", ""),
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1669 }
9356
803a7a85b071 Changed the install script to only install the qt6-applications package if requested explicitly (--with-tools).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9347
diff changeset
1670 if withPyqt6Tools:
8548
c87eb20797b7 Activated support for the 'qt6-applications' project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8522
diff changeset
1671 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
1672
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1673 # check mandatory PyQt6 modules
3681
3a79355b9ca5 Fixed a bugs in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3678
diff changeset
1674 modulesOK = True
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1675 for pyqt6BaseModule in sorted(pyqt6BaseModulesList):
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1676 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
1677 try:
9485
0f3620304d7a Changed code to use 'iimportlib.import_module()' instead of '__import__()'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
1678 importlib.import_module(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
1679 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
1680 except ImportError as err:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1681 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
1682 if verbose:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1683 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
1684 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
1685 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
1686 exit(1)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1687
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1688 # check required modules
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1689 print("\nRequired Packages")
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1690 print("-----------------")
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1691 requiredMissing = False
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1692 for requiredPackage in sorted(requiredModulesList):
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1693 try:
9485
0f3620304d7a Changed code to use 'iimportlib.import_module()' instead of '__import__()'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
1694 importlib.import_module(requiredModulesList[requiredPackage][0])
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1695 print("Found", requiredPackage)
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1696 except ImportError as err:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1697 if isSudo:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1698 print("Required '{0}' could not be detected.".format(requiredPackage))
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1699 requiredMissing = True
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1700 else:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1701 msg = "Required '{0}' could not be detected.{1}".format(
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1702 requiredPackage, "\nError: {0}".format(err) if verbose else ""
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1703 )
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1704 pipInstall(
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1705 requiredPackage + requiredModulesList[requiredPackage][1],
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1706 msg,
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1707 force=True,
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1708 )
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1709 if requiredMissing:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1710 print("Some required packages are missing and could not be installed.")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1711 print("Install them manually with:")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1712 print(" {0} install-dependencies.py --required".format(sys.executable))
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1713
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
1714 # check optional modules
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1715 print("\nOptional Packages")
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1716 print("-----------------")
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1717 optionalMissing = False
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
1718 for optPackage in sorted(optionalModulesList):
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
1719 try:
9485
0f3620304d7a Changed code to use 'iimportlib.import_module()' instead of '__import__()'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
1720 importlib.import_module(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
1721 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
1722 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
1723 if isSudo:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1724 print("Optional '{0}' could not be detected.".format(optPackage))
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1725 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
1726 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
1727 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
1728 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
1729 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1730 pipInstall(optPackage + optionalModulesList[optPackage][1], msg)
9314
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1731 if optionalMissing:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1732 print("Some optional packages are missing and could not be installed.")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1733 print("Install them manually with:")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1734 print(" {0} install-dependencies.py --optional".format(sys.executable))
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1735
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1736 if requiredMissing and optionalMissing:
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1737 print("Alternatively you may install all of them with:")
7ba79b00ea96 install scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9278
diff changeset
1738 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
1739
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1740 # 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
1741 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
1742 PlatformBlackLists = PlatformsBlackLists["windows"]
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1743 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
1744 PlatformBlackLists = PlatformsBlackLists["linux"]
10334
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
1745 elif sys.platform.startswith("freebsd"):
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
1746 PlatformBlackLists = PlatformsBlackLists["freebsd"]
1914
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1747 else:
fa4d57a6c3a9 Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1770
diff changeset
1748 PlatformBlackLists = PlatformsBlackLists["mac"]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1749
8386
41a27cbdb5c1 install.py: modified the version display slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
1750 print("\nVersion Information")
41a27cbdb5c1 install.py: modified the version display slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
1751 print("-------------------")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1752
8754
e7d63a5a2ae9 Corrected the last change a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8753
diff changeset
1753 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
1754
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1755 # check version of Qt
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1756 # ===================
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1757 qtMajor = int(qVersion().split(".")[0])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1758 qtMinor = int(qVersion().split(".")[1])
8386
41a27cbdb5c1 install.py: modified the version display slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
1759 print("Qt6: {0}".format(qVersion().strip()))
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1760 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
1761 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
1762 exit(2)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1763
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1764 # check version of sip
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1765 # ====================
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
1766 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
1767 try:
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1768 from PyQt6 import sip # noqa: I101, I102
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6360
diff changeset
1769 except ImportError:
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1770 import sip # noqa: I101, I102
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1771 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
1772 # 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
1773 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
1774 if sip.SIP_VERSION < requiredVersions["sip"]:
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1775 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1776 "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
1777 " a recent development release.".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1778 versionToStr(requiredVersions["sip"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1779 )
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1780 )
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
1781 exit(3)
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1782 # 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
1783 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
1784 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
1785 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1786 "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
1787 versionToStr(vers)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1788 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1789 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1790 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
1791 exit(3)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1792
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1793 # check version of PyQt6
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1794 # ======================
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1795 from PyQt6.QtCore import PYQT_VERSION, PYQT_VERSION_STR # noqa: I101, I102
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1796
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1797 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
1798 # 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
1799 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
1800 if PYQT_VERSION < requiredVersions["pyqt6"]:
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1801 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1802 "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
1803 " a recent development release.".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1804 versionToStr(requiredVersions["pyqt6"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1805 )
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1806 )
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1807 exit(4)
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1808 # check for blacklisted versions
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1809 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
1810 if vers == PYQT_VERSION:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1811 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1812 "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
1813 versionToStr(vers)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1814 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1815 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1816 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
1817 exit(4)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1818
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1819 # check version of QScintilla
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1820 # ===========================
10046
35b27af462ef Code Style Checker
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10042
diff changeset
1821 from PyQt6.Qsci import ( # noqa: I101, I102
35b27af462ef Code Style Checker
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10042
diff changeset
1822 QSCINTILLA_VERSION,
35b27af462ef Code Style Checker
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10042
diff changeset
1823 QSCINTILLA_VERSION_STR,
35b27af462ef Code Style Checker
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10042
diff changeset
1824 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1825
8386
41a27cbdb5c1 install.py: modified the version display slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
1826 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
1827 # 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
1828 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
1829 if QSCINTILLA_VERSION < requiredVersions["pyqt6-qscintilla"]:
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1830 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1831 "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
1832 " a recent development release.".format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1833 versionToStr(requiredVersions["pyqt6-qscintilla"])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1834 )
8440
f71f33c0d47a Streamline the install script a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8430
diff changeset
1835 )
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1836 exit(5)
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
1837 # check for blacklisted versions
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1838 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
1839 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
1840 print(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1841 "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
1842 " eric.".format(versionToStr(vers))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1843 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1844 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
1845 exit(5)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1846
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
1847 # 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
1848 with contextlib.suppress(NameError, AttributeError):
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1849 from PyQt6.QtCharts import PYQT_CHART_VERSION_STR # noqa: I101, I102
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1850
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1851 print("PyQt6-Charts:", PYQT_CHART_VERSION_STR)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1852
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
1853 with contextlib.suppress(ImportError, AttributeError):
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1854 from PyQt6 import QtWebEngineCore # noqa: I101, I102
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1855
8553
10d31e5ce9e5 First batch of changes for QtWebEngine as of Qt 6.2.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8548
diff changeset
1856 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
1857
8388
f864abd11a5b install.py: beautified the output a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8387
diff changeset
1858 print()
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1859 print("All dependencies ok.")
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1860 print()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1861
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1862
4435
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1863 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
1864 """
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1865 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
1866 .ui file.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1867
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
1868 @param py_dir suggested name of the directory
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
1869 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
1870 @param py_file suggested name for the compile source file
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
1871 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
1872 @return tuple of directory name and source file name
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
1873 @rtype tuple of (str, str)
4435
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1874 """
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1875 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
1876
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1877
9986
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1878 def __compileOneUi(ui_path, mapFunc=None):
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1879 """
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1880 Function to compile a single form file to Python code.
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1881
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1882 @param ui_path path of the Qt form file
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1883 @type str
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1884 @param mapFunc function to change directory and/or name of the resulting Python file
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1885 (defaults to None)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1886 @type func (optional)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1887 """
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
1888 from PyQt6.uic import compileUi # noqa: I102
9986
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1889
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1890 py_dir, py_file = os.path.split(ui_path[:-3] + ".py")
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1891
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1892 # Allow the caller to change the name of the .py file or generate
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1893 # it in a different directory.
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1894 if mapFunc is not None:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1895 py_dir, py_file = mapFunc(py_dir, py_file)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1896
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1897 # Make sure the destination directory exists.
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1898 os.makedirs(py_dir, exist_ok=True)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1899
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1900 py_path = os.path.join(py_dir, py_file)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1901
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1902 with open(py_path, "w", encoding="utf-8") as py_file:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1903 compileUi(ui_path, py_file, execute=False, indent=4)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1904
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1905
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1906 def compileUiDir(root, recurse=False, mapFunc=None, workers=1):
4435
9f6555d3c3c0 Fixed some code style issues and removed code no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4380
diff changeset
1907 """
9986
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1908 Function to compile all Qt form files of a directory or directory tree
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1909 to Python code.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1910
9986
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1911 @param root directory to scan for Qt form files (i.e. files ending with '.ui'
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1912 @type str
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1913 @param recurse flag indicating to recurse into sub-directories (defaults to False)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1914 @type bool (optional)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1915 @param mapFunc function to change directory and/or name of the resulting Python file
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1916 (defaults to None)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1917 @type func (optional)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1918 @param workers number of worker processes to be used to compile (defaults to 1)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1919 @type int (optional)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1920 """
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1921 if recurse:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1922 ui_files = []
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1923 for rootDir, _, files in os.walk(root):
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1924 ui_files.extend(
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1925 os.path.join(rootDir, ui) for ui in files if ui.endswith(".ui")
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1926 )
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1927 else:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1928 ui_files = [
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1929 os.path.join(root, ui)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1930 for ui in os.listdir(root)
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1931 if os.path.isfile(os.path.join(root, ui) and ui.endswith(".ui"))
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1932 ]
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1933
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1934 ProcessPoolExecutor = None
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1935 if workers != 1:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1936 try:
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
1937 from concurrent.futures import ProcessPoolExecutor # noqa: I101, I103
9986
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1938 except NotImplementedError:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1939 workers = 1
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1940
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1941 if workers != 1 and ProcessPoolExecutor is not None:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1942 # If workers == 0, let ProcessPoolExecutor determine worker count.
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1943 workers = workers or None
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1944 with ProcessPoolExecutor(max_workers=workers) as executor:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1945 executor.map(
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1946 partial(__compileOneUi, mapFunc=mapFunc),
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1947 ui_files,
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1948 )
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1949 else:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1950 for ui_file in ui_files:
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
1951 __compileOneUi(ui_file, mapFunc=mapFunc)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1952
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
1953
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
1954 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
1955 """
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
1956 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
1957
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
1958 @param fileName name of the Python file containing the info
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
1959 @type str
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
1960 """
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
1961 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
1962 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1963
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
1964 with contextlib.suppress(OSError):
4307
6a8ec996a49c Little enhancement of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4239
diff changeset
1965 os.rename(fileName, fileName + ".orig")
8522
4f263b89a293 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8501
diff changeset
1966 localHg = (
9420
92810aebc909 Changed the code to use sysconfig.get_path("scripts") wherever possible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9402
diff changeset
1967 os.path.join(sysconfig.get_path("scripts"), "hg.exe")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1968 if sys.platform.startswith(("win", "cygwin"))
9420
92810aebc909 Changed the code to use sysconfig.get_path("scripts") wherever possible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9402
diff changeset
1969 else os.path.join(sysconfig.get_path("scripts"), "hg")
8522
4f263b89a293 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8501
diff changeset
1970 )
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
1971 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
1972 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
1973 hgOut = subprocess.run( # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1974 [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
1975 ).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
1976 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
1977 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
1978 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
1979 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
1980 if hgOut:
4239
4883661fc427 Little improvement to the recent install.py change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4238
diff changeset
1981 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
1982 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
1983 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
1984 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
1985 text = f.read()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
1986 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
1987 "@@VERSION@@", "rev_" + hgOut
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1988 )
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
1989 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
1990 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
1991 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
1992
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
1993
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
1994 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
1995 """
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
1996 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
1997
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
1998 @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
1999 @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
2000 @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
2001 @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
2002 @return value of requested registry variable
10417
c6011e501282 Modernized some code and converted Debug Client and Debugger source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10403
diff changeset
2003 @rtype Any
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
2004 """
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
2005 try:
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
2006 import winreg # noqa: I101, I103
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
2007 except ImportError:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
2008 return None
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2009
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
2010 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2011 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
2012 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
2013 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
2014 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
2015 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
2016 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
2017
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
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
2019 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
2020 """
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
2021 Create Windows shortcut.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2022
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
2023 @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
2024 @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
2025 @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
2026 @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
2027 @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
2028 @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
2029 """
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
2030 from pywintypes import com_error # noqa: I102
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
2031 from win32com.client import Dispatch # noqa: I102
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2032
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
2033 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
2034 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
2035 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
2036 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
2037 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
2038 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
2039 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
2040
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
2041
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2042 def windowsDesktopNames(clean=False):
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
2043 """
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
2044 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
2045
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2046 @param clean flag indicating to get the desktop names for a cleanup operation
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2047 @type bool
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
2048 @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
2049 @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
2050 """
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2051 return [e[0] for e in windowsDesktopEntries(clean=clean)]
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
2052
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
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2054 def windowsDesktopEntries(clean=False):
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
2055 """
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
2056 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
2057
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2058 @param clean flag indicating to get the desktop entries for a cleanup operation
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2059 @type bool
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
2060 @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
2061 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
2062 @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
2063 """
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7185
diff changeset
2064 global cfg
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
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 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
2067 entriesTemplates = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2068 (
9377
b9c8dc3b7da1 Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9366
diff changeset
2069 "eric7 IDE (Python {0}.{1}).lnk",
b9c8dc3b7da1 Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9366
diff changeset
2070 os.path.join(cfg["bindir"], "eric7_ide.cmd"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2071 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
2072 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2073 (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2074 "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
2075 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
2076 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
2077 ),
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
2078 ]
9402
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2079
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2080 if clean:
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2081 # clean obsolete entries as well
9402
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2082 entriesTemplates.extend(
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2083 [
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2084 (
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2085 "eric7 (Python {0}.{1}).lnk",
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2086 os.path.join(cfg["bindir"], "eric7_ide.cmd"),
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2087 os.path.join(cfg["ericPixDir"], "eric7.ico"),
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2088 ),
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2089 ]
f5d9aa5c62db Reformatted the code with the black tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9401
diff changeset
2090 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2091
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
2092 return [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2093 (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
2094 ]
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
2095
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
2096
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
2097 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
2098 """
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
2099 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
2100
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
2101 @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
2102 @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
2103 """
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
2104 majorVersion, minorVersion = sys.version_info[:2]
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9378
diff changeset
2105 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
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
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2108 def createArgumentParser():
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2109 """
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2110 Function to create an argument parser.
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2111
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2112 @return created argument parser object
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2113 @rtype argparse.ArgumentParser
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2114 """
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2115 parser = argparse.ArgumentParser(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2116 description="Install eric7 from the source code tree.",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2117 epilog="The file given to the -f option must be valid Python code defining a"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2118 "dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir', ericIconDir',"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2119 " 'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericThemesDir', ericDocDir',"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2120 " ericExamplesDir', ericTranslationsDir', 'ericTemplatesDir',"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2121 " 'ericCodeTemplatesDir', ericOthersDir','bindir', 'mdir' and 'apidir."
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2122 "These define the directories for the installation of the various parts of"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2123 " eric.",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2124 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2125
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2126 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2127 "-a",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2128 metavar="dir",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2129 default=apisDir if apisDir else None,
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2130 help="directory where the API files will be installed ({0})".format(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2131 "default: {0}".format(apisDir) if apisDir else "no default value"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2132 ),
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2133 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2134 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2135 "--no-apis",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2136 action="store_true",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2137 help="don't install API files",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2138 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2139 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2140 "-b",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2141 metavar="dir",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2142 default=platBinDir,
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2143 help="directory where the binaries will be installed (default: {0})".format(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2144 platBinDir
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2145 ),
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2146 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2147 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2148 "-d",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2149 metavar="dir",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2150 default=modDir,
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2151 help="directory where eric Python files will be installed"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2152 " (default: {0})".format(modDir),
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2153 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2154 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2155 "-f",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2156 metavar="file",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2157 help="configuration file naming the various installation paths",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2158 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2159 if not sys.platform.startswith(("win", "cygwin")):
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2160 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2161 "-i",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2162 metavar="dir",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2163 default=distDir,
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2164 help="temporary install prefix (default: {0})".format(distDir),
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2165 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2166 if sys.platform == "darwin":
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2167 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2168 "-m",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2169 metavar="name",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2170 default=macAppBundleName,
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2171 help="name of the Mac app bundle (default: {0})".format(macAppBundleName),
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2172 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2173 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2174 "-n",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2175 metavar="path",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2176 default=macAppBundlePath,
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2177 help="path of the directory the Mac app bundle will be created in"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2178 " (default: {0})".format(macAppBundlePath),
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2179 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2180 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2181 "-p",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2182 metavar="python",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2183 default=macPythonExe,
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2184 help="path of the python executable (default: {0})".format(macPythonExe),
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2185 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2186 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2187 "-c",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2188 action="store_false",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2189 help="don't cleanup old installation first",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2190 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2191 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2192 "-v",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2193 "--verbose",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2194 action="store_true",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2195 help="print some more information",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2196 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2197 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2198 "-x",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2199 action="store_false",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2200 help="don't perform dependency checks (use on your own risk)",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2201 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2202 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2203 "-z",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2204 action="store_false",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2205 help="don't compile the installed python files",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2206 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2207 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2208 "--yes",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2209 action="store_true",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2210 help="answer 'yes' to all questions",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2211 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2212 if sys.platform.startswith(("win", "cygwin")):
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2213 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2214 "--clean-desktop",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2215 action="store_true",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2216 help="delete desktop links before installation",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2217 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2218 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2219 "--no-info",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2220 action="store_true",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2221 help="don't create the install info file",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2222 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2223 parser.add_argument(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2224 "--with-tools",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2225 action="store_true",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2226 help="install the 'qt6-applications' package",
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2227 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2228
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2229 return parser
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2230
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2231
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2232 def main(argv):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2233 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2234 The main function of the script.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2235
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
2236 @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
2237 @type list of str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2238 """
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2239 global modDir, doCleanup, doCompile, distDir, cfg, apisDir
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2240 global sourceDir, eric7SourceDir, configName, platBinDir
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
2241 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
2242 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
2243 global createInstallInfoFile, installCwd
9356
803a7a85b071 Changed the install script to only install the qt6-applications package if requested explicitly (--with-tools).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9347
diff changeset
2244 global withPyqt6Tools
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
2245 global verbose
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2246
10119
64147a7e6393 Removed support for Python 3.7 because that is EOL.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10118
diff changeset
2247 if sys.version_info < (3, 8, 0) or sys.version_info > (3, 99, 99):
64147a7e6393 Removed support for Python 3.7 because that is EOL.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10118
diff changeset
2248 print("Sorry, eric requires at least Python 3.8 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
2249 exit(5)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2250
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
2251 installCwd = os.getcwd()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2252
1662
dadf3f4ee800 Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1658
diff changeset
2253 if os.path.dirname(argv[0]):
1965
96f5a76e1845 Fixed some PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1914
diff changeset
2254 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
2255
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2256 initGlobals()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2257
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2258 parser = createArgumentParser()
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2259 args = parser.parse_args()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2260
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2261 apisDir = args.a
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2262 platBinDir = args.b
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2263 modDir = args.d
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2264 depChecks = args.x
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2265 doCleanup = args.c
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2266 doCompile = args.z
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2267 installApis = not args.no_apis
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2268 yes2All = args.yes
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2269 withPyqt6Tools = args.with_tools
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2270 createInstallInfoFile = not args.no_info
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2271 verbose = args.verbose
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2272 if sys.platform == "darwin":
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2273 macAppBundleName = args.m
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2274 macAppBundlePath = args.n
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2275 macPythonExe = args.p
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2276 if sys.platform.startswith(("win", "cygwin")):
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2277 doCleanDesktopLinks = args.clean_desktop
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2278 else:
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2279 if args.i:
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2280 distDir = os.path.normpath(args.i)
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2281 if args.f:
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2282 with open(args.f) as f:
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2283 try:
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2284 exec(compile(f.read(), args.f, "exec"), globals())
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2285 # secok
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2286 if len(cfg) != configLength:
9679
22314ef6d754 Changed the install script to output a descriptive message when an invalid configuration file is given using the -f option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
2287 print(
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2288 "The configuration dictionary in '{0}' is"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2289 " incorrect. Aborting".format(args.f)
9679
22314ef6d754 Changed the install script to output a descriptive message when an invalid configuration file is given using the -f option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
2290 )
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2291 exit(6)
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2292 except Exception as exc:
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2293 print(
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2294 "The configuration file '{0}' is not valid Python source."
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2295 " It will be ignored. Installation will be performed with"
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2296 " defaults.".format(args.f)
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2297 )
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2298 print("ERROR: {0}".format(str(exc)))
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
2299 cfg = {}
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2300
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
2301 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
2302 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
2303
6641
42de1c3e8777 install: moved the dependencies check earlier in the installiation order.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6640
diff changeset
2304 # check dependencies
42de1c3e8777 install: moved the dependencies check earlier in the installiation order.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6640
diff changeset
2305 if depChecks:
42de1c3e8777 install: moved the dependencies check earlier in the installiation order.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6640
diff changeset
2306 doDependancyChecks()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2307
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
2308 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
2309 sourceDir = os.path.abspath("..")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2310
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
2311 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
2312 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
2313 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
2314 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
2315 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2316
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
2317 # 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
2318 if installFromSource:
9694
90a7081e2837 Updated the various scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9690
diff changeset
2319 print("Cleaning up source ...", end="", flush=True)
9231
d92a18dffa5e Slight modificytion to the install script to handle cleanup a bit better.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
2320 cleanupSource(sourceDir)
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2321 print(" Done")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2322
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2323 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
2324 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
2325 # we are installing from source with repo
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2326 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
2327 prepareInfoFile(infoName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2328
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2329 if len(cfg) == 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2330 createInstallConfig()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2331
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2332 # 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
2333 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
2334 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
2335 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
2336 configNameC = configName + "c"
626
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
2337 if os.path.exists(configNameC):
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
2338 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
2339 os.remove(configName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2340
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2341 # cleanup old installation
9694
90a7081e2837 Updated the various scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9690
diff changeset
2342 print("Cleaning up old installation ...", end="", flush=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2343 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2344 if doCleanup:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2345 if distDir:
10403
ea3320d5e8e9 Changed code using "shutil.rmtree()" more readable by adding "ignore_errors=" where this parameter is non-default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10373
diff changeset
2346 shutil.rmtree(distDir, ignore_errors=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2347 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2348 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
2349 except OSError as msg:
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2350 sys.stderr.write("\nError: {0}\nTry install as root.\n".format(msg))
2421
d3bf4def72d7 Correct the last change.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents: 2420
diff changeset
2351 exit(7)
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2352 print(" Done")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2353
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2354 # Create a config file and delete the default one
9694
90a7081e2837 Updated the various scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9690
diff changeset
2355 print("Creating configuration file ...", end="", flush=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2356 createConfig()
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2357 print(" Done")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2358
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2359 # Create an install info file
9694
90a7081e2837 Updated the various scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9690
diff changeset
2360 print("Creating an install info file ...", end="", flush=True)
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
2361 createInstallInfo()
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2362 print(" Done")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2363
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2364 # Compile .ui files
9694
90a7081e2837 Updated the various scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9690
diff changeset
2365 print("Compiling user interface files ...", end="", flush=True)
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
2366 # 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
2367 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
2368 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
2369 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
2370 # step 2: compile the forms
9986
2c571c1c7b0d Scripts
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9917
diff changeset
2371 compileUiDir(eric7SourceDir, recurse=True, mapFunc=__pyName, workers=0)
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2372 print(" Done")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2373
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2374 if doCompile:
9694
90a7081e2837 Updated the various scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9690
diff changeset
2375 print("Compiling source files ...", end="", flush=True)
5180
9eba139a2756 Changed RegEx to be independent from Python version.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5145
diff changeset
2376 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
2377 sys.stdout = io.StringIO()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2378 if distDir:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
2379 compileall.compile_dir(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2380 eric7SourceDir,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2381 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
2382 rx=skipRe,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2383 quiet=True,
9732
3985549d7d36 Changed the install script to do parallel source code compilation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9727
diff changeset
2384 workers=0,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2385 )
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2969
diff changeset
2386 py_compile.compile(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2387 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
2388 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2389 else:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
2390 compileall.compile_dir(
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8310
diff changeset
2391 eric7SourceDir,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2392 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
2393 rx=skipRe,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2394 quiet=True,
9732
3985549d7d36 Changed the install script to do parallel source code compilation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9727
diff changeset
2395 workers=0,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2396 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2397 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
2398 sys.stdout = sys.__stdout__
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2399 print(" Done")
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2400
9694
90a7081e2837 Updated the various scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9690
diff changeset
2401 print("Installing eric ...", end="", flush=True)
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
2402 res = installEric()
9690
2dc33116df50 Debug Client - Python
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9680
diff changeset
2403 print(" Done")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2404
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
2405 if createInstallInfoFile:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2406 with open(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2407 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
2408 ) 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
2409 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
2410
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
2411 # 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
2412 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
2413 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
2414 os.remove(configName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2415 configNameC = configName + "c"
626
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
2416 if os.path.exists(configNameC):
41e79c291eff Fixed another bug in the modified install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 625
diff changeset
2417 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
2418 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
2419 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
2420 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
2421 os.remove(infoName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2422 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
2423 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
2424 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
2425 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
2426
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
2427 print("\nInstallation complete.")
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
2428 print()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2429
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
2430 exit(res)
8988
ffa38e0415df Added a script to install all of eric's dependencies.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8977
diff changeset
2431
ffa38e0415df Added a script to install all of eric's dependencies.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8977
diff changeset
2432
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2433 if __name__ == "__main__":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2434 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2435 main(sys.argv)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2436 except SystemExit:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2437 raise
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
2438 except Exception:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2439 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9218
diff changeset
2440 """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
2441 """ 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
2442 """ 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
2443 )
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
2444 raise
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
2445
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
2446 #
10042
ca636e8d80fd Applied the new "noqa:" to the install.py script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9986
diff changeset
2447 # eflag: noqa = M801

eric ide

mercurial