Thu, 10 Jan 2019 14:18:48 +0100
Updated copyright for 2019.
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 | |
6645
ad476851d7e0
Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6641
diff
changeset
|
4 | # Copyright (c) 2002 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | # |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
6 | # This is the install script for eric6. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
9 | Installation script for the eric6 IDE and all eric6 related tools. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | |
4561
5bc6ed226471
Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4543
diff
changeset
|
12 | from __future__ import unicode_literals, print_function |
2680
110ac646a3a0
Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2677
diff
changeset
|
13 | try: |
6211
4f0e08c95ca9
install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6208
diff
changeset
|
14 | # Python2 only |
2846
b852fe4d153a
Fix for the installer script
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2791
diff
changeset
|
15 | import cStringIO as io |
6364
6a496f0886ad
Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6360
diff
changeset
|
16 | try: |
6365
85f8745427a6
Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6364
diff
changeset
|
17 | from PyQt5 import sip |
6364
6a496f0886ad
Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6360
diff
changeset
|
18 | except ImportError: |
6365
85f8745427a6
Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6364
diff
changeset
|
19 | import sip |
3942
a79c9261e7a8
Changed the last fix slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3939
diff
changeset
|
20 | sip.setapi('QString', 2) |
a79c9261e7a8
Changed the last fix slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3939
diff
changeset
|
21 | sip.setapi('QVariant', 2) |
a79c9261e7a8
Changed the last fix slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3939
diff
changeset
|
22 | sip.setapi('QTextStream', 2) |
6211
4f0e08c95ca9
install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6208
diff
changeset
|
23 | input = raw_input # __IGNORE_WARNING__ |
2680
110ac646a3a0
Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2677
diff
changeset
|
24 | except (ImportError): |
6211
4f0e08c95ca9
install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6208
diff
changeset
|
25 | import io # __IGNORE_WARNING__ |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2480
diff
changeset
|
26 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | import sys |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | import os |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | import re |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | import compileall |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | import py_compile |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | import glob |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | import shutil |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | import fnmatch |
2680
110ac646a3a0
Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2677
diff
changeset
|
35 | import codecs |
4238
53bd830433dc
Changed the install script to include the Mercurial revision number when install from the sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4178
diff
changeset
|
36 | import subprocess |
5214
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
37 | import time |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | # Define the globals. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | progName = None |
1658
c61997a63efe
Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1538
diff
changeset
|
41 | currDir = os.getcwd() |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | modDir = None |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | pyModDir = None |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | platBinDir = None |
4455
ca13a6f6c452
Prepared the Python3 debug client for some obsolescences of the inspect.py module.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4435
diff
changeset
|
45 | platBinDirOld = None |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | distDir = None |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | apisDir = None |
3943
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
48 | installApis = True |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | doCleanup = True |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | doCompile = True |
3597
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
51 | includePythonVariant = False |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | cfg = {} |
3468
869d0b6e1e16
Added an API file for QSS and corrected an issue in the APIs manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
53 | progLanguages = ["Python", "Ruby", "QSS"] |
622
54c2a58acef4
Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
620
diff
changeset
|
54 | sourceDir = "eric" |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
55 | configName = 'eric6config.py' |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
56 | defaultMacAppBundleName = "eric6.app" |
3714
4080395e3426
Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3705
diff
changeset
|
57 | defaultMacAppBundlePath = "/Applications" |
3955
9c3e54d351e2
Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3950
diff
changeset
|
58 | defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
59 | sys.exec_prefix) |
3955
9c3e54d351e2
Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3950
diff
changeset
|
60 | macAppBundleName = defaultMacAppBundleName |
9c3e54d351e2
Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3950
diff
changeset
|
61 | macAppBundlePath = defaultMacAppBundlePath |
9c3e54d351e2
Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3950
diff
changeset
|
62 | macPythonExe = defaultMacPythonExe |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
63 | pyqtVariant = "" |
3937
607dd5b0079b
Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3936
diff
changeset
|
64 | pyqtOverride = False |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | |
565
21191e634b47
Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
564
diff
changeset
|
66 | # Define blacklisted versions of the prerequisites |
21191e634b47
Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
564
diff
changeset
|
67 | BlackLists = { |
1188
87c12a25512c
Added a blacklisted sip version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1161
diff
changeset
|
68 | "sip": ["4.11", "4.12.3"], |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
69 | "PyQt4": [], |
3657
ae833e7fcd6c
Adopted the install script for PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3656
diff
changeset
|
70 | "PyQt5": [], |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
71 | "QScintilla2": [], |
565
21191e634b47
Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
564
diff
changeset
|
72 | } |
1914
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
73 | PlatformsBlackLists = { |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
74 | "windows": { |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
75 | "sip": [], |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
76 | "PyQt4": [], |
3657
ae833e7fcd6c
Adopted the install script for PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3656
diff
changeset
|
77 | "PyQt5": [], |
1914
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
78 | "QScintilla2": [], |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
79 | }, |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
80 | |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
81 | "linux": { |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
82 | "sip": [], |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
83 | "PyQt4": [], |
3656
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3628
diff
changeset
|
84 | "PyQt5": [], |
1914
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
85 | "QScintilla2": [], |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
86 | }, |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
87 | |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
88 | "mac": { |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
89 | "sip": [], |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
90 | "PyQt4": [], |
3657
ae833e7fcd6c
Adopted the install script for PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3656
diff
changeset
|
91 | "PyQt5": [], |
1914
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
92 | "QScintilla2": [], |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
93 | }, |
fa4d57a6c3a9
Added platform specific blacklists due to recent PyQt4 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1770
diff
changeset
|
94 | } |
565
21191e634b47
Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
564
diff
changeset
|
95 | |
3597
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
96 | # Define file name markers for Python variants |
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
97 | PythonMarkers = { |
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
98 | 2: "_py2", |
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
99 | 3: "_py3", |
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
100 | } |
4054
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
101 | # Define a mapping of markers to full text |
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
102 | PythonTextMarkers = { |
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
103 | "_py2": "Python 2", |
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
104 | "_py3": "Python 3", |
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
105 | } |
3597
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
106 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
107 | |
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
108 | def exit(rcode=0): |
390
daa7c6ae6248
Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
386
diff
changeset
|
109 | """ |
daa7c6ae6248
Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
386
diff
changeset
|
110 | Exit the install script. |
3019
7912530a33e2
Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3003
diff
changeset
|
111 | |
7912530a33e2
Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3003
diff
changeset
|
112 | @param rcode result code to report back (integer) |
390
daa7c6ae6248
Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
386
diff
changeset
|
113 | """ |
1658
c61997a63efe
Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1538
diff
changeset
|
114 | global currDir |
c61997a63efe
Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1538
diff
changeset
|
115 | |
5963
14522ec8cd08
Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5810
diff
changeset
|
116 | print() |
14522ec8cd08
Made QtWebKit/QtWebKitWidgets or QtWebEngineWidgets a mandatory installation prerequisite and reverted the code, that made the HTML code info viewer optional.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5810
diff
changeset
|
117 | |
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
|
118 | if sys.platform.startswith(("win", "cygwin")): |
2680
110ac646a3a0
Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2677
diff
changeset
|
119 | # different meaning of input between Py2 and Py3 |
2428
11e6e63a89d0
Wrapped calls to input() by try-except in install.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2423
diff
changeset
|
120 | try: |
11e6e63a89d0
Wrapped calls to input() by try-except in install.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2423
diff
changeset
|
121 | input("Press enter to continue...") |
2680
110ac646a3a0
Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2677
diff
changeset
|
122 | except (EOFError, SyntaxError): |
2428
11e6e63a89d0
Wrapped calls to input() by try-except in install.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2423
diff
changeset
|
123 | pass |
390
daa7c6ae6248
Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
386
diff
changeset
|
124 | |
1658
c61997a63efe
Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1538
diff
changeset
|
125 | os.chdir(currDir) |
c61997a63efe
Changed the install script to deal with installations initiated from a directory not containing the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1538
diff
changeset
|
126 | |
390
daa7c6ae6248
Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
386
diff
changeset
|
127 | sys.exit(rcode) |
daa7c6ae6248
Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
386
diff
changeset
|
128 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
129 | |
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
130 | def usage(rcode=2): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | Display a usage message and exit. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | @param rcode the return code passed back to the calling process. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | """ |
3507
b09e10d4f343
Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3468
diff
changeset
|
136 | global progName, modDir, distDir, apisDir |
b09e10d4f343
Changed the install script to accept a '-n' option to set the name of the directory where the Mac application bundle should be created in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3468
diff
changeset
|
137 | global macAppBundleName, macAppBundlePath, macPythonExe |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
138 | global pyqtVariant |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
140 | print() |
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
141 | print("Usage:") |
2306
0f020f39977b
Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2275
diff
changeset
|
142 | if sys.platform == "darwin": |
3597
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
143 | print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
144 | " [-m name] [-p python] [--pyqt=version]".format(progName)) |
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
|
145 | elif sys.platform.startswith(("win", "cygwin")): |
3597
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
146 | print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file]" |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
147 | " [--pyqt=version]" |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
148 | .format(progName)) |
2306
0f020f39977b
Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2275
diff
changeset
|
149 | else: |
3597
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
150 | print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
151 | " [--pyqt=version]" |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
152 | .format(progName)) |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
153 | print("where:") |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
154 | print(" -h, --help display this help message") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
155 | print(" -a dir where the API files will be installed") |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | if apisDir: |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
157 | print(" (default: {0})".format(apisDir)) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | else: |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
159 | print(" (no default value)") |
3943
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
160 | print(" --noapis don't install API files") |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
161 | print(" -b dir where the binaries will be installed") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
162 | print(" (default: {0})".format(platBinDir)) |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
163 | print(" -d dir where eric6 python files will be installed") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
164 | print(" (default: {0})".format(modDir)) |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
165 | print(" -f file configuration file naming the various installation" |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
166 | " paths") |
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
|
167 | if not sys.platform.startswith(("win", "cygwin")): |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
168 | print(" -i dir temporary install prefix") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
169 | print(" (default: {0})".format(distDir)) |
2306
0f020f39977b
Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2275
diff
changeset
|
170 | if sys.platform == "darwin": |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
171 | print(" -m name name of the Mac app bundle") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
172 | print(" (default: {0})".format(macAppBundleName)) |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
173 | print(" -n path path of the directory the Mac app bundle will") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
174 | print(" be created in") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
175 | print(" (default: {0})".format(macAppBundlePath)) |
3955
9c3e54d351e2
Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3950
diff
changeset
|
176 | print(" -p python path of the python executable") |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
177 | print(" (default: {0})".format(macPythonExe)) |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
178 | print(" -c don't cleanup old installation first") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
179 | print(" -x don't perform dependency checks (use on your own" |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
180 | " risk)") |
3935
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
181 | print(" -y add the Python variant to the executable names") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
182 | print(" -z don't compile the installed python files") |
f6ba54e022fa
Added install option --pyqt= to specify the PyQt variant to use.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3931
diff
changeset
|
183 | print(" --pyqt=version version of PyQt to be used (one of 4 or 5)") |
4380
d79c055a12cc
Enhanced the install.py help info in case no PyQt variant can be found.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4374
diff
changeset
|
184 | if pyqtVariant: |
d79c055a12cc
Enhanced the install.py help info in case no PyQt variant can be found.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4374
diff
changeset
|
185 | print(" (default: {0})".format(pyqtVariant[-1])) |
d79c055a12cc
Enhanced the install.py help info in case no PyQt variant can be found.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4374
diff
changeset
|
186 | else: |
d79c055a12cc
Enhanced the install.py help info in case no PyQt variant can be found.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4374
diff
changeset
|
187 | print(" (no PyQt variant found)") |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
188 | print() |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
189 | print("The file given to the -f option must be valid Python code" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
190 | " defining a") |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
191 | print("dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir'," |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
192 | " 'ericIconDir',") |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
193 | print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir'," |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
194 | " 'ericExamplesDir',") |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
195 | print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',") |
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
196 | print("'ericOthersDir','bindir', 'mdir' and 'apidir.") |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
197 | print("These define the directories for the installation of the various" |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
198 | " parts of eric6.") |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | |
390
daa7c6ae6248
Change install script to always keep it open on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
386
diff
changeset
|
200 | exit(rcode) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
203 | def determinePyQtVariant(): |
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
204 | """ |
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
205 | Module function to determine the PyQt variant to be used. |
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
206 | """ |
3937
607dd5b0079b
Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3936
diff
changeset
|
207 | global pyqtVariant, pyqtOverride |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
208 | |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
209 | pyqtVariant = "" |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
210 | # need to handle the --pyqt= option here |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
211 | if "--pyqt=4" in sys.argv: |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
212 | pyqtVariant = "PyQt4" |
3937
607dd5b0079b
Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3936
diff
changeset
|
213 | pyqtOverride = True |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
214 | elif "--pyqt=5" in sys.argv: |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
215 | pyqtVariant = "PyQt5" |
3937
607dd5b0079b
Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3936
diff
changeset
|
216 | pyqtOverride = True |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
217 | else: |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
218 | try: |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
219 | import PyQt5 # __IGNORE_WARNING__ |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
220 | pyqtVariant = "PyQt5" |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
221 | del sys.modules["PyQt5"] |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
222 | except ImportError: |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
223 | try: |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
224 | import PyQt4 # __IGNORE_WARNING__ |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
225 | pyqtVariant = "PyQt4" |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
226 | del sys.modules["PyQt4"] |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
227 | except ImportError: |
6211
4f0e08c95ca9
install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6208
diff
changeset
|
228 | # default to PyQt5, installation will be asked for |
4f0e08c95ca9
install script: extended the install script by code to install PyQt5 and/or QScintilla via pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6208
diff
changeset
|
229 | pyqtVariant = "PyQt5" |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
230 | |
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
231 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | def initGlobals(): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
233 | """ |
2965
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2763
diff
changeset
|
234 | Module function to set the values of globals that need more than a |
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2763
diff
changeset
|
235 | simple assignment. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | """ |
4456
9a2304647d95
Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4455
diff
changeset
|
237 | global platBinDir, modDir, pyModDir, apisDir, pyqtVariant, platBinDirOld |
6304
68f9aa03bf75
install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6275
diff
changeset
|
238 | |
68f9aa03bf75
install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6275
diff
changeset
|
239 | try: |
68f9aa03bf75
install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6275
diff
changeset
|
240 | import distutils.sysconfig |
68f9aa03bf75
install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6275
diff
changeset
|
241 | except ImportError: |
68f9aa03bf75
install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6275
diff
changeset
|
242 | print("Please install the 'distutils' package first.") |
68f9aa03bf75
install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6275
diff
changeset
|
243 | exit(5) |
68f9aa03bf75
install: show a message to the user if the distutile package cannot be imported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6275
diff
changeset
|
244 | |
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
|
245 | if sys.platform.startswith(("win", "cygwin")): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | platBinDir = sys.exec_prefix |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | if platBinDir.endswith("\\"): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
248 | platBinDir = platBinDir[:-1] |
4456
9a2304647d95
Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4455
diff
changeset
|
249 | platBinDirOld = platBinDir |
9a2304647d95
Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4455
diff
changeset
|
250 | platBinDir = os.path.join(platBinDir, "Scripts") |
9a2304647d95
Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4455
diff
changeset
|
251 | if not os.path.exists(platBinDir): |
9a2304647d95
Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4455
diff
changeset
|
252 | platBinDir = platBinDirOld |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
253 | else: |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
254 | pyBinDir = os.path.normpath(os.path.dirname(sys.executable)) |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
255 | if os.access(pyBinDir, os.W_OK): |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
256 | # install the eric scripts along the python executable |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
257 | platBinDir = pyBinDir |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
258 | else: |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
259 | # install them in the user's bin directory |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
260 | platBinDir = os.path.expanduser("~/bin") |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
261 | if platBinDir != "/usr/local/bin" and \ |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
262 | os.access("/usr/local/bin", os.W_OK): |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
263 | platBinDirOld = "/usr/local/bin" |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | modDir = distutils.sysconfig.get_python_lib(True) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | pyModDir = modDir |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
267 | |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
268 | pyqtDataDir = os.path.join(modDir, pyqtVariant) |
2608
01118174a2f5
Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2586
diff
changeset
|
269 | if os.path.exists(os.path.join(pyqtDataDir, "qsci")): |
01118174a2f5
Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2586
diff
changeset
|
270 | # it's the installer |
01118174a2f5
Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2586
diff
changeset
|
271 | qtDataDir = pyqtDataDir |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
272 | elif os.path.exists(os.path.join(pyqtDataDir, "Qt", "qsci")): |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
273 | # it's the wheel |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
274 | qtDataDir = os.path.join(pyqtDataDir, "Qt") |
2608
01118174a2f5
Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2586
diff
changeset
|
275 | else: |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
276 | # determine dynamically |
2608
01118174a2f5
Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2586
diff
changeset
|
277 | try: |
3778
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
278 | if pyqtVariant == "PyQt4": |
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
279 | from PyQt4.QtCore import QLibraryInfo |
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
280 | else: |
0c5bc18da740
Added more changes to make eric6 usable with PyQt4 as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3758
diff
changeset
|
281 | from PyQt5.QtCore import QLibraryInfo |
2608
01118174a2f5
Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2586
diff
changeset
|
282 | qtDataDir = QLibraryInfo.location(QLibraryInfo.DataPath) |
01118174a2f5
Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2586
diff
changeset
|
283 | except ImportError: |
01118174a2f5
Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2586
diff
changeset
|
284 | qtDataDir = None |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | if qtDataDir: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
286 | apisDir = os.path.join(qtDataDir, "qsci", "api") |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
287 | else: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
288 | apisDir = None |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
291 | def copyToFile(name, text): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
292 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
293 | Copy a string to a file. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
295 | @param name the name of the file. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
296 | @param text the contents to copy to the file. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
297 | """ |
2680
110ac646a3a0
Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2677
diff
changeset
|
298 | f = open(name, "w") |
2846
b852fe4d153a
Fix for the installer script
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2791
diff
changeset
|
299 | if sys.version_info[0] == 2: |
b852fe4d153a
Fix for the installer script
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2791
diff
changeset
|
300 | text = codecs.encode(text, "utf-8") |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | f.write(text) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | f.close() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
303 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | |
3931
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
305 | def copyDesktopFile(src, dst, marker): |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
306 | """ |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
307 | Modify a desktop file and write it to its destination. |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
308 | |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
309 | @param src source file name (string) |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
310 | @param dst destination file name (string) |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
311 | @param marker marker to be used (string) |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
312 | """ |
6275
8ce9f9c467ec
Fixed some install script issues related to defining the bin dir via -b switch.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6216
diff
changeset
|
313 | global cfg, platBinDir |
6216
2a0eeba143e7
install script: corrected the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6214
diff
changeset
|
314 | |
3939
fc1ea4bbb201
Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3937
diff
changeset
|
315 | if sys.version_info[0] == 2: |
fc1ea4bbb201
Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3937
diff
changeset
|
316 | f = codecs.open(src, "r", "utf-8") |
fc1ea4bbb201
Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3937
diff
changeset
|
317 | else: |
3962
b75057280077
Little fix in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3955
diff
changeset
|
318 | f = open(src, "r", encoding="utf-8") |
3931
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
319 | text = f.read() |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
320 | f.close() |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
321 | |
6275
8ce9f9c467ec
Fixed some install script issues related to defining the bin dir via -b switch.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6216
diff
changeset
|
322 | text = text.replace("@BINDIR@", platBinDir) |
3931
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
323 | text = text.replace("@MARKER@", marker) |
4054
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
324 | if marker: |
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
325 | t_marker = " ({0})".format(PythonTextMarkers[marker]) |
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
326 | else: |
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
327 | t_marker = "" |
3ef699270e61
Corrected a little typo and improved the .desktop file generation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4033
diff
changeset
|
328 | text = text.replace("@PY_MARKER@", t_marker) |
3931
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
329 | |
3939
fc1ea4bbb201
Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3937
diff
changeset
|
330 | if sys.version_info[0] == 2: |
fc1ea4bbb201
Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3937
diff
changeset
|
331 | f = codecs.open(dst, "w", "utf-8") |
fc1ea4bbb201
Fixed issues with the install script under Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3937
diff
changeset
|
332 | else: |
3962
b75057280077
Little fix in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3955
diff
changeset
|
333 | f = open(dst, "w", encoding="utf-8") |
3931
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
334 | f.write(text) |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
335 | f.close() |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
336 | os.chmod(dst, 0o644) |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
337 | |
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
338 | |
5214
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
339 | def copyAppStreamFile(src, dst, marker): |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
340 | """ |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
341 | Modify an appstream file and write it to its destination. |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
342 | |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
343 | @param src source file name (string) |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
344 | @param dst destination file name (string) |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
345 | @param marker marker to be used (string) |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
346 | """ |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
347 | if os.path.exists(os.path.join("eric", "UI", "Info.py")): |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
348 | # Installing from archive |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
349 | from eric.UI.Info import Version |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
350 | elif os.path.exists(os.path.join("UI", "Info.py")): |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
351 | # Installing from source tree |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
352 | from UI.Info import Version |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
353 | else: |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
354 | Version = "Unknown" |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
355 | |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
356 | if sys.version_info[0] == 2: |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
357 | f = codecs.open(src, "r", "utf-8") |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
358 | else: |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
359 | f = open(src, "r", encoding="utf-8") |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
360 | text = f.read() |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
361 | f.close() |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
362 | |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
363 | text = text.replace("@MARKER@", marker)\ |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
364 | .replace("@VERSION@", Version.split(None, 1)[0])\ |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
365 | .replace("@DATE@", time.strftime("%Y-%m-%d")) |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
366 | |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
367 | if sys.version_info[0] == 2: |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
368 | f = codecs.open(dst, "w", "utf-8") |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
369 | else: |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
370 | f = open(dst, "w", encoding="utf-8") |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
371 | f.write(text) |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
372 | f.close() |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
373 | os.chmod(dst, 0o644) |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
374 | |
0473e5256ca9
Fixes to comply with the current AppStream file format and contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5145
diff
changeset
|
375 | |
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
|
376 | def wrapperNames(dname, wfile): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
377 | """ |
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
|
378 | Create the platform specific names for the wrapper script. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
379 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
380 | @param dname name of the directory to place the wrapper into |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
381 | @param wfile basename (without extension) of the wrapper script |
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
|
382 | @return the names of the wrapper scripts |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
383 | """ |
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
|
384 | if sys.platform.startswith(("win", "cygwin")): |
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
|
385 | wnames = (dname + "\\" + wfile + ".cmd", |
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
|
386 | dname + "\\" + wfile + ".bat") |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
387 | else: |
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
|
388 | wnames = (dname + "/" + wfile, ) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | |
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
|
390 | return wnames |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
391 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | |
3613
47e29cc0f29c
Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3612
diff
changeset
|
393 | def createPyWrapper(pydir, wfile, isGuiScript=True): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
395 | Create an executable wrapper for a Python script. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
396 | |
899
4687532058ba
Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
896
diff
changeset
|
397 | @param pydir the name of the directory where the Python script will |
3612
786d97a08a14
Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3609
diff
changeset
|
398 | eventually be installed (string) |
786d97a08a14
Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3609
diff
changeset
|
399 | @param wfile the basename of the wrapper (string) |
902
c06241839b12
Fixed a source docu string in the new installer script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
900
diff
changeset
|
400 | @param isGuiScript flag indicating a wrapper script for a GUI |
c06241839b12
Fixed a source docu string in the new installer script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
900
diff
changeset
|
401 | application (boolean) |
3612
786d97a08a14
Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3609
diff
changeset
|
402 | @return the platform specific name of the wrapper (string) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
403 | """ |
3937
607dd5b0079b
Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3936
diff
changeset
|
404 | global includePythonVariant, pyqtVariant, pyqtOverride |
3613
47e29cc0f29c
Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3612
diff
changeset
|
405 | |
47e29cc0f29c
Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3612
diff
changeset
|
406 | if includePythonVariant: |
47e29cc0f29c
Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3612
diff
changeset
|
407 | marker = PythonMarkers[sys.version_info.major] |
47e29cc0f29c
Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3612
diff
changeset
|
408 | else: |
47e29cc0f29c
Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3612
diff
changeset
|
409 | marker = "" |
47e29cc0f29c
Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3612
diff
changeset
|
410 | |
3937
607dd5b0079b
Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3936
diff
changeset
|
411 | if pyqtOverride and pyqtVariant == "PyQt4": |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
412 | pyqt4opt = " --pyqt4" |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
413 | else: |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
414 | pyqt4opt = "" |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
415 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | # 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
|
417 | if sys.platform.startswith(("win", "cygwin")): |
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
|
418 | wname = wfile + marker + ".cmd" |
899
4687532058ba
Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
896
diff
changeset
|
419 | if isGuiScript: |
900
c5d8b27ac6c1
Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
899
diff
changeset
|
420 | wrapper = \ |
1402
474db48f495c
Fixed an issue in creating the startup scripts for Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1400
diff
changeset
|
421 | '''@echo off\n''' \ |
2583
92b902f6455e
Fixed the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2577
diff
changeset
|
422 | '''start "" "{2}\\pythonw.exe"''' \ |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
423 | ''' "{0}\\{1}.pyw"{3}''' \ |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
424 | ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format( |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
425 | pydir, wfile, sys.exec_prefix, pyqt4opt) |
899
4687532058ba
Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
896
diff
changeset
|
426 | else: |
900
c5d8b27ac6c1
Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
899
diff
changeset
|
427 | wrapper = \ |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
428 | '''@"{0}\\python" "{1}\\{2}.py"{3}''' \ |
1402
474db48f495c
Fixed an issue in creating the startup scripts for Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1400
diff
changeset
|
429 | ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format( |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
430 | sys.exec_prefix, pydir, wfile, pyqt4opt) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
431 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | # Mac OS X |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | 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
|
434 | 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
|
435 | 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
|
436 | 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
|
437 | pyexec = "{0}/bin/python{1}".format(sys.exec_prefix, major) |
786d97a08a14
Extended the install script and fixed a few issue related to installations with Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3609
diff
changeset
|
438 | wname = wfile + marker |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
439 | wrapper = ('''#!/bin/sh\n''' |
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
440 | '''\n''' |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
441 | '''exec "{0}" "{1}/{2}.py"{3} "$@"\n''' |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
442 | .format(pyexec, pydir, wfile, pyqt4opt)) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
443 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
444 | # *nix systems |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
445 | 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
|
446 | wname = wfile + marker |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
447 | wrapper = ('''#!/bin/sh\n''' |
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
448 | '''\n''' |
3936
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
449 | '''exec "{0}" "{1}/{2}.py"{3} "$@"\n''' |
93fb2fd523f1
Completed the PyQt4 override installation and startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3935
diff
changeset
|
450 | .format(sys.executable, pydir, wfile, pyqt4opt)) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
451 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
452 | copyToFile(wname, wrapper) |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
453 | os.chmod(wname, 0o755) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
454 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
455 | return wname |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
456 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
457 | |
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
|
458 | 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
|
459 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
460 | Copy Python, translation, documentation, wizards configuration, |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
461 | designer template files and DTDs of a directory tree. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
462 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
463 | @param src name of the source directory |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
464 | @param dst name of the destination directory |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
465 | @param filters list of filter pattern determining the files to be copied |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
466 | @param excludeDirs list of (sub)directories to exclude from copying |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
467 | @keyparam excludePatterns list of filter pattern determining the files to |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
468 | be skipped |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
469 | """ |
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
|
470 | 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
|
471 | 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
|
472 | 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
|
473 | excludePatterns = [] |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
474 | try: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
475 | names = os.listdir(src) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
476 | except OSError: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
477 | # 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
|
478 | return |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
480 | for name in names: |
1115
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
481 | skipIt = False |
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
482 | for excludePattern in excludePatterns: |
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
483 | if fnmatch.fnmatch(name, excludePattern): |
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
484 | skipIt = True |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
485 | break |
1115
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
486 | if not skipIt: |
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
487 | srcname = os.path.join(src, name) |
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
488 | 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
|
489 | 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
|
490 | if fnmatch.fnmatch(srcname, fileFilter): |
1115
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
491 | if not os.path.isdir(dst): |
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
492 | os.makedirs(dst) |
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
493 | 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
|
494 | os.chmod(dstname, 0o644) |
1115
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
495 | break |
3032cc87dee2
Enhanced the install script a little bit.
detlev@die-offenbachs.de
parents:
945
diff
changeset
|
496 | 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
|
497 | if os.path.isdir(srcname) and srcname not in excludeDirs: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
498 | copyTree(srcname, dstname, filters, |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
499 | excludePatterns=excludePatterns) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
500 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
501 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | def createGlobalPluginsDir(): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
503 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
504 | 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
|
505 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
506 | global cfg, distDir |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
507 | |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
508 | pdir = os.path.join(cfg['mdir'], "eric6plugins") |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
509 | fname = os.path.join(pdir, "__init__.py") |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
510 | if not os.path.exists(fname): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
511 | 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
|
512 | os.mkdir(pdir, 0o755) |
2680
110ac646a3a0
Fixes for TabNanny and some code cleanup. Source doku regenerated.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2677
diff
changeset
|
513 | f = open(fname, "w") |
564
b3d966393ba9
Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
473
diff
changeset
|
514 | f.write( |
4830
f609a22f43bd
Fixed a few code style issues detected by the updated pep8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4800
diff
changeset
|
515 | '''# -*- coding: utf-8 -*- |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
516 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
517 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
518 | Package containing the global plugins. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
519 | """ |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
520 | ''' |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
521 | ) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | f.close() |
2160
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
523 | os.chmod(fname, 0o644) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
524 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
525 | |
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
|
526 | 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
|
527 | """ |
e3435c1ce0cf
Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3542
diff
changeset
|
528 | 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
|
529 | and directories. |
e3435c1ce0cf
Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3542
diff
changeset
|
530 | |
e3435c1ce0cf
Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3542
diff
changeset
|
531 | @param dirName name of the directory to prune (string) |
e3435c1ce0cf
Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3542
diff
changeset
|
532 | """ |
e3435c1ce0cf
Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3542
diff
changeset
|
533 | # 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
|
534 | # *.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
|
535 | 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
|
536 | for formName, sourceName in [ |
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
537 | (f.replace('Ui_', "").replace(".py", ".ui"), f) |
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
538 | for f in dirListing if fnmatch.fnmatch(f, "Ui_*.py")]: |
3594
778ae276540f
Fixed an issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3593
diff
changeset
|
539 | 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
|
540 | 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
|
541 | 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
|
542 | os.remove(os.path.join(dirName, sourceName + "c")) |
e3435c1ce0cf
Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3542
diff
changeset
|
543 | |
5055
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4915
diff
changeset
|
544 | # 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
|
545 | 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
|
546 | shutil.rmtree(os.path.join(dirName, "__pycache__")) |
5055
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4915
diff
changeset
|
547 | for name in [f for f in os.listdir(dirName) |
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4915
diff
changeset
|
548 | 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
|
549 | os.remove(os.path.join(dirName, name)) |
3593
e3435c1ce0cf
Extended the install script to clean out the source directory when installing from sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3542
diff
changeset
|
550 | |
6637
54a92e8dca00
install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6636
diff
changeset
|
551 | # step 3: delete *.orig files |
54a92e8dca00
install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6636
diff
changeset
|
552 | for name in [f for f in os.listdir(dirName) |
54a92e8dca00
install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6636
diff
changeset
|
553 | if fnmatch.fnmatch(f, "*.orig")]: |
54a92e8dca00
install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6636
diff
changeset
|
554 | os.remove(os.path.join(dirName, name)) |
54a92e8dca00
install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6636
diff
changeset
|
555 | |
54a92e8dca00
install: extended the source cleanup function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6636
diff
changeset
|
556 | # 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
|
557 | 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
|
558 | 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
|
559 | 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
|
560 | cleanupSource(name) |
3595
a8433c7a0d8c
Fixed another issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3594
diff
changeset
|
561 | if len(os.listdir(name)) == 0: |
a8433c7a0d8c
Fixed another issue in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3594
diff
changeset
|
562 | 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
|
563 | |
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
|
564 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
565 | def cleanUp(): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
566 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
567 | Uninstall the old eric files. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
568 | """ |
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
|
569 | global platBinDir, platBinDirOld, includePythonVariant |
2306
0f020f39977b
Extended the Mac support to be able to install multiple configurations in parallel (e.g. for Qt4 and Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2275
diff
changeset
|
570 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
571 | try: |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
572 | from eric6config import getConfig |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
573 | except ImportError: |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
574 | # eric6 wasn't installed previously |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
575 | return |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
576 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
577 | global pyModDir, progLanguages |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
578 | |
146
afeb742e7148
Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
133
diff
changeset
|
579 | # Remove the menu entry for Linux systems |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
580 | if sys.platform.startswith("linux"): |
6500
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
581 | 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
|
582 | # 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
|
583 | 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
|
584 | cleanUpWindowsLinks() |
146
afeb742e7148
Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
133
diff
changeset
|
585 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
586 | # Remove the wrapper scripts |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
587 | rem_wnames = [ |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
588 | "eric6_api", "eric6_compare", |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
589 | "eric6_configure", "eric6_diff", |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
590 | "eric6_doc", "eric6_qregularexpression", |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
591 | "eric6_qregexp", "eric6_re", |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
592 | "eric6_trpreviewer", "eric6_uipreviewer", |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
593 | "eric6_unittest", "eric6", |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
594 | "eric6_tray", "eric6_editor", |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
595 | "eric6_plugininstall", "eric6_pluginuninstall", |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
596 | "eric6_pluginrepository", "eric6_sqlbrowser", |
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
597 | "eric6_webbrowser", "eric6_iconeditor", |
4806
5c0745cb26ea
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4800
diff
changeset
|
598 | "eric6_snap", "eric6_hexeditor", "eric6_browser", |
5711
50b6867ffcd3
Finished implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5675
diff
changeset
|
599 | "eric6_shell", |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
600 | ] |
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
|
601 | if includePythonVariant: |
137370f7114b
Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3596
diff
changeset
|
602 | marker = PythonMarkers[sys.version_info.major] |
3678
2866383fd342
Adjusted the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3670
diff
changeset
|
603 | rem_wnames = [n + marker for n in rem_wnames] |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
604 | |
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
|
605 | try: |
4456
9a2304647d95
Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4455
diff
changeset
|
606 | dirs = [platBinDir, getConfig('bindir')] |
9a2304647d95
Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4455
diff
changeset
|
607 | if platBinDirOld: |
9a2304647d95
Changed installation destination on Windows to be the Scripts subdirectory of the Python installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4455
diff
changeset
|
608 | dirs.append(platBinDirOld) |
1381
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
609 | 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
|
610 | 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
|
611 | 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
|
612 | 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
|
613 | os.remove(rwname) |
1381
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
614 | |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
615 | # Cleanup our config file(s) |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
616 | for name in ['eric6config.py', 'eric6config.pyc', 'eric6.pth']: |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
617 | 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
|
618 | 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
|
619 | os.remove(e6cfile) |
1381
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
620 | e5cfile = os.path.join(pyModDir, "__pycache__", name) |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
621 | path, ext = os.path.splitext(e5cfile) |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
622 | 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
|
623 | os.remove(f) |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
624 | |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
625 | # Cleanup the install directories |
3003
cb43c34239b1
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
626 | for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir', |
cb43c34239b1
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
627 | 'ericCSSDir', 'ericIconDir', 'ericPixDir', |
cb43c34239b1
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
628 | 'ericTemplatesDir', 'ericCodeTemplatesDir', |
cb43c34239b1
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
629 | 'ericOthersDir', 'ericStylesDir', 'ericDir']: |
1381
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
630 | if os.path.exists(getConfig(name)): |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
631 | shutil.rmtree(getConfig(name), True) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
632 | |
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
|
633 | # Cleanup translations |
1387
1734bc5f4f82
Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1385
diff
changeset
|
634 | for name in glob.glob( |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
635 | os.path.join(getConfig('ericTranslationsDir'), 'eric6_*.qm')): |
1381
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
636 | 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
|
637 | os.remove(name) |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
638 | |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
639 | # Cleanup API files |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
640 | try: |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
641 | apidir = getConfig('apidir') |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
642 | for progLanguage in progLanguages: |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
643 | for name in getConfig('apis'): |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
644 | 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
|
645 | 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
|
646 | os.remove(apiname) |
1387
1734bc5f4f82
Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1385
diff
changeset
|
647 | for apiname in glob.glob( |
1734bc5f4f82
Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1385
diff
changeset
|
648 | os.path.join(apidir, progLanguage.lower(), "*.bas")): |
3758
19866b4e9027
Some more places adapted to eric6 and Qt5/PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3751
diff
changeset
|
649 | if os.path.basename(apiname) != "eric6.bas": |
3697
c947a7eaace4
Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3693
diff
changeset
|
650 | os.remove(apiname) |
1381
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
651 | except AttributeError: |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
652 | pass |
b66bcd609f83
Fixed an issue in the install script trying to install without admin rights.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1346
diff
changeset
|
653 | |
1387
1734bc5f4f82
Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1385
diff
changeset
|
654 | if sys.platform == "darwin": |
1734bc5f4f82
Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1385
diff
changeset
|
655 | # 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
|
656 | cleanUpMacAppBundle() |
2420
c5a0bc75d5b6
Fixed an issue in the install script.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents:
2411
diff
changeset
|
657 | except (IOError, OSError) as msg: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
658 | sys.stderr.write( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
659 | '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
|
660 | exit(7) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
661 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
662 | |
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
|
663 | 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
|
664 | """ |
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
|
665 | 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
|
666 | """ |
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
|
667 | 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
|
668 | for name in ["/usr/share/pixmaps/eric.png", |
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
|
669 | "/usr/share/pixmaps/ericWeb.png"]: |
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
|
670 | 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
|
671 | 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
|
672 | if includePythonVariant: |
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
|
673 | marker = PythonMarkers[sys.version_info.major] |
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
|
674 | else: |
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
|
675 | marker = "" |
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 | for name in [ |
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 | "/usr/share/applications/eric6" + marker + ".desktop", |
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
|
678 | "/usr/share/appdata/eric6" + marker + ".appdata.xml", |
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
|
679 | "/usr/share/metainfo/eric6" + marker + ".appdata.xml", |
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
|
680 | "/usr/share/applications/eric6_webbrowser" + marker + |
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
|
681 | ".desktop", |
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
|
682 | "/usr/share/applications/eric6_browser" + marker + |
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
|
683 | ".desktop", |
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
|
684 | "/usr/share/pixmaps/eric" + marker + ".png", |
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
|
685 | "/usr/share/pixmaps/ericWeb" + marker + ".png", |
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
|
686 | ]: |
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
|
687 | 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
|
688 | 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
|
689 | 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
|
690 | # 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
|
691 | for name in ["~/.local/share/pixmaps/eric.png", |
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
|
692 | "~/.local/share/pixmaps/ericWeb.png"]: |
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
|
693 | 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
|
694 | 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
|
695 | 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
|
696 | if includePythonVariant: |
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
|
697 | marker = PythonMarkers[sys.version_info.major] |
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
|
698 | else: |
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
|
699 | marker = "" |
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
|
700 | for name in [ |
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
|
701 | "~/.local/share/applications/eric6" + marker + ".desktop", |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
702 | "~/.local/share/appdata/eric6" + marker + ".appdata.xml", |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
703 | "~/.local/share/metainfo/eric6" + marker + ".appdata.xml", |
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
|
704 | "~/.local/share/applications/eric6_webbrowser" + marker + |
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
|
705 | ".desktop", |
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
|
706 | "~/.local/share/applications/eric6_browser" + marker + |
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
|
707 | ".desktop", |
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
|
708 | "~/.local/share/pixmaps/eric" + marker + ".png", |
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
|
709 | "~/.local/share/pixmaps/ericWeb" + marker + ".png", |
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
|
710 | ]: |
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
|
711 | 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
|
712 | 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
|
713 | 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
|
714 | |
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
|
715 | |
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
|
716 | 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
|
717 | """ |
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
|
718 | 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
|
719 | """ |
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
|
720 | from eric6config import getConfig |
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
|
721 | 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
|
722 | 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
|
723 | 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
|
724 | except AttributeError: |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
725 | macAppBundlePath = defaultMacAppBundlePath |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
726 | macAppBundleName = defaultMacAppBundleName |
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
|
727 | for bundlePath in [os.path.join(defaultMacAppBundlePath, |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
728 | 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
|
729 | os.path.join(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
|
730 | 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
|
731 | ]: |
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
|
732 | 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
|
733 | 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
|
734 | |
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
|
735 | |
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
|
736 | 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
|
737 | """ |
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
|
738 | 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
|
739 | """ |
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
|
740 | try: |
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
|
741 | from pywintypes import com_error # __IGNORE_WARNING__ |
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
|
742 | except ImportError: |
d8fd663f86ef
install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6509
diff
changeset
|
743 | # 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
|
744 | return |
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
|
745 | |
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
|
746 | regPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" + \ |
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
|
747 | "\\User Shell Folders" |
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
|
748 | |
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
|
749 | # 1. cleanup desktop links |
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
|
750 | regName = "Desktop" |
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
|
751 | desktopEntry = 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
|
752 | if desktopEntry: |
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
|
753 | desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry)) |
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
|
754 | for linkName in windowsDesktopNames(): |
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
|
755 | linkPath = os.path.join(desktopFolder, linkName) |
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
|
756 | if os.path.exists(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
|
757 | try: |
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
|
758 | os.remove(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
|
759 | except EnvironmentError: |
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
|
760 | # maybe restrictions prohibited link removal |
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
|
761 | print("Could not remove '{0}'.".format(linkPath)) |
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
|
762 | |
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
|
763 | # 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
|
764 | 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
|
765 | 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
|
766 | 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
|
767 | programsFolder = os.path.normpath(os.path.expandvars(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
|
768 | eric6EntryPath = os.path.join(programsFolder, windowsProgramsEntry()) |
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
|
769 | if os.path.exists(eric6EntryPath): |
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
|
770 | try: |
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
|
771 | shutil.rmtree(eric6EntryPath) |
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
|
772 | except EnvironmentError: |
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
|
773 | # maybe restrictions prohibited link removal |
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
|
774 | print("Could not remove '{0}'.".format(eric6EntryPath)) |
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
|
775 | |
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
|
776 | |
2177
a59ffbc5fe4c
Fixed an error in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2160
diff
changeset
|
777 | 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
|
778 | """ |
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
779 | Wrapper function around shutil.copy() to ensure the permissions. |
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
780 | |
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
781 | @param src source file name (string) |
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
782 | @param dst destination file name or directory name (string) |
2177
a59ffbc5fe4c
Fixed an error in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2160
diff
changeset
|
783 | @keyparam perm permissions to be set (integer) |
2160
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
784 | """ |
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
785 | 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
|
786 | 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
|
787 | 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
|
788 | 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
|
789 | |
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
790 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
791 | def installEric(): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
792 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
793 | Actually perform the installation steps. |
2383
e999256385bd
Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents:
2312
diff
changeset
|
794 | |
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
|
795 | @return result code (integer) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
796 | """ |
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
|
797 | global distDir, doCleanup, cfg, progLanguages, sourceDir, configName |
3943
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
798 | global includePythonVariant, installApis |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
799 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
800 | # Create the platform specific wrappers. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
801 | wnames = [] |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
802 | for name in ["eric6_api", "eric6_doc"]: |
3613
47e29cc0f29c
Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3612
diff
changeset
|
803 | wnames.append(createPyWrapper(cfg['ericDir'], name, False)) |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
804 | for name in ["eric6_compare", "eric6_configure", "eric6_diff", |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4631
diff
changeset
|
805 | "eric6_editor", "eric6_hexeditor", "eric6_iconeditor", |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4631
diff
changeset
|
806 | "eric6_plugininstall", "eric6_pluginrepository", |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4631
diff
changeset
|
807 | "eric6_pluginuninstall", "eric6_qregexp", |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4631
diff
changeset
|
808 | "eric6_qregularexpression", "eric6_re", "eric6_snap", |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4631
diff
changeset
|
809 | "eric6_sqlbrowser", "eric6_tray", "eric6_trpreviewer", |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4631
diff
changeset
|
810 | "eric6_uipreviewer", "eric6_unittest", "eric6_webbrowser", |
5711
50b6867ffcd3
Finished implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5675
diff
changeset
|
811 | "eric6_browser", "eric6_shell", "eric6"]: |
3613
47e29cc0f29c
Refined the install and cleanup scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3612
diff
changeset
|
812 | wnames.append(createPyWrapper(cfg['ericDir'], name)) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
813 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
814 | # set install prefix, if not None |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
815 | if distDir: |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
816 | for key in list(cfg.keys()): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
817 | cfg[key] = os.path.normpath(distDir + os.sep + cfg[key]) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
818 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
819 | try: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
820 | # Install the files |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
821 | # make the install directories |
3948
6c3720179d6b
Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3943
diff
changeset
|
822 | for key in cfg.keys(): |
6c3720179d6b
Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3943
diff
changeset
|
823 | 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
|
824 | os.makedirs(cfg[key]) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
825 | |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
826 | # copy the eric6 config file |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
827 | if distDir: |
2160
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
828 | shutilCopy(configName, cfg['mdir']) |
622
54c2a58acef4
Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
620
diff
changeset
|
829 | if os.path.exists(configName + 'c'): |
2160
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
830 | shutilCopy(configName + 'c', cfg['mdir']) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
831 | 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
|
832 | shutilCopy(configName, modDir) |
622
54c2a58acef4
Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
620
diff
changeset
|
833 | if os.path.exists(configName + 'c'): |
2160
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
834 | shutilCopy(configName + 'c', modDir) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
835 | |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
836 | # copy the various parts of eric6 |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
837 | copyTree( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
838 | sourceDir, cfg['ericDir'], |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
839 | ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
4033
46084f695e10
Fixed install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
840 | ['{1}{0}Examples'.format(os.sep, sourceDir), |
46084f695e10
Fixed install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
841 | '{1}{0}.ropeproject'.format(os.sep, sourceDir)], |
3670
f0cb7579c0b4
Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3657
diff
changeset
|
842 | excludePatterns=["eric6config.py*"]) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
843 | copyTree( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
844 | sourceDir, cfg['ericDir'], ['*.rb'], |
622
54c2a58acef4
Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
620
diff
changeset
|
845 | ['{1}{0}Examples'.format(os.sep, sourceDir)]) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
846 | copyTree( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
847 | '{1}{0}Plugins'.format(os.sep, sourceDir), |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
848 | '{0}{1}Plugins'.format(cfg['ericDir'], os.sep), |
3724
0848df91249f
Fixed the install script for the new Mercurial templates.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3714
diff
changeset
|
849 | ['*.png', '*.style', '*.tmpl']) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
850 | copyTree( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
851 | '{1}{0}Documentation'.format(os.sep, sourceDir), cfg['ericDocDir'], |
433
988006cb898f
Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
390
diff
changeset
|
852 | ['*.html', '*.qch']) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
853 | copyTree( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
854 | '{1}{0}DTDs'.format(os.sep, sourceDir), cfg['ericDTDDir'], |
622
54c2a58acef4
Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
620
diff
changeset
|
855 | ['*.dtd']) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
856 | copyTree( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
857 | '{1}{0}CSSs'.format(os.sep, sourceDir), cfg['ericCSSDir'], |
622
54c2a58acef4
Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
620
diff
changeset
|
858 | ['*.css']) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
859 | copyTree( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
860 | '{1}{0}Styles'.format(os.sep, sourceDir), cfg['ericStylesDir'], |
622
54c2a58acef4
Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
620
diff
changeset
|
861 | ['*.qss']) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
862 | copyTree( |
5976
549918576245
Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5963
diff
changeset
|
863 | '{1}{0}Styles'.format(os.sep, sourceDir), cfg['ericStylesDir'], |
549918576245
Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5963
diff
changeset
|
864 | ['*.e4h']) |
549918576245
Added a dark style (*.qss and Python lexers) provided by Giuseppe Corbelli.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5963
diff
changeset
|
865 | copyTree( |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
866 | '{1}{0}i18n'.format(os.sep, sourceDir), cfg['ericTranslationsDir'], |
622
54c2a58acef4
Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
620
diff
changeset
|
867 | ['*.qm']) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
868 | copyTree( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
869 | '{1}{0}icons'.format(os.sep, sourceDir), cfg['ericIconDir'], |
2217
e80c74f2a25a
Added some icons to the "Languages" and "End-of-Line Type" context menus of the editor and changed the status labels for programming language and end-of-line type of the main window to show an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2177
diff
changeset
|
870 | ['*.png', 'LICENSE*.*', 'readme.txt']) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
871 | copyTree( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
872 | '{1}{0}pixmaps'.format(os.sep, sourceDir), cfg['ericPixDir'], |
1538
c14a5ecdb6f4
Fixed install script (forgot to install the *.gif icons).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1525
diff
changeset
|
873 | ['*.png', '*.xpm', '*.ico', '*.gif']) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
874 | copyTree( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
875 | '{1}{0}DesignerTemplates'.format(os.sep, sourceDir), |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
876 | cfg['ericTemplatesDir'], |
433
988006cb898f
Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
390
diff
changeset
|
877 | ['*.tmpl']) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
878 | copyTree( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3019
diff
changeset
|
879 | '{1}{0}CodeTemplates'.format(os.sep, sourceDir), |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
880 | cfg['ericCodeTemplatesDir'], |
433
988006cb898f
Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
390
diff
changeset
|
881 | ['*.tmpl']) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
882 | copyTree( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
883 | '{1}{0}Examples'.format(os.sep, sourceDir), cfg['ericExamplesDir'], |
433
988006cb898f
Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
390
diff
changeset
|
884 | ['*.py', '*.pyc', '*.pyo']) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
885 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
886 | # copy the wrappers |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
887 | for wname in wnames: |
2177
a59ffbc5fe4c
Fixed an error in the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2160
diff
changeset
|
888 | 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
|
889 | os.remove(wname) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
890 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
891 | # copy the license file |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
892 | shutilCopy( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
893 | '{1}{0}LICENSE.GPL3'.format(os.sep, sourceDir), cfg['ericDir']) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
894 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
895 | # create the global plugins directory |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
896 | createGlobalPluginsDir() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
897 | |
2420
c5a0bc75d5b6
Fixed an issue in the install script.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents:
2411
diff
changeset
|
898 | except (IOError, OSError) as msg: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
899 | sys.stderr.write( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
900 | 'Error: {0}\nTry install with admin rights.\n'.format(msg)) |
2383
e999256385bd
Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents:
2312
diff
changeset
|
901 | return(7) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
902 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
903 | # copy some text files to the doc area |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
904 | for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
905 | try: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
906 | shutilCopy( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
907 | '{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericDocDir']) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
908 | except EnvironmentError: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
909 | print("Could not install '{2}{0}{1}'.".format( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
910 | os.sep, name, sourceDir)) |
622
54c2a58acef4
Modified install script such, that it allows an installation from source as well. The situation will be determined automatically.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
620
diff
changeset
|
911 | for name in glob.glob(os.path.join(sourceDir, 'README*.*')): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
912 | try: |
2160
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
913 | shutilCopy(name, cfg['ericDocDir']) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
914 | except EnvironmentError: |
4512
23e8b848efb0
Fixed some incorrect string format strings using the new checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4456
diff
changeset
|
915 | print("Could not install '{0}'.".format(name)) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
916 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
917 | # copy some more stuff |
1455
f708ac785a89
Corrected the install script for the QScintilla 2.6 changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1410
diff
changeset
|
918 | for name in ['default.e4k', 'default_Mac.e4k']: |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
919 | try: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
920 | shutilCopy( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
921 | '{2}{0}{1}'.format(os.sep, name, sourceDir), |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
922 | cfg['ericOthersDir']) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
923 | except EnvironmentError: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
924 | print("Could not install '{2}{0}{1}'.".format( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
925 | os.sep, name, sourceDir)) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
926 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
927 | # 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
|
928 | if installApis: |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
929 | for progLanguage in progLanguages: |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
930 | apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
931 | print("Installing {0} API files to '{1}'.".format( |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
932 | progLanguage, apidir)) |
3943
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
933 | if not os.path.exists(apidir): |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
934 | os.makedirs(apidir) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
935 | for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
3943
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
936 | progLanguage, "*.api")): |
40
c2e5472b112c
Changed some code to adjust eric5 to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
21
diff
changeset
|
937 | try: |
2160
1874d4410904
Changed the install script to ensure proper permissions of the installed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2145
diff
changeset
|
938 | shutilCopy(apiName, apidir) |
40
c2e5472b112c
Changed some code to adjust eric5 to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
21
diff
changeset
|
939 | except EnvironmentError: |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
940 | print("Could not install '{0}' (no permission)." |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
941 | .format(apiName)) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2969
diff
changeset
|
942 | for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
3943
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
943 | progLanguage, "*.bas")): |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
944 | try: |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
945 | shutilCopy(apiName, apidir) |
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
|
946 | except EnvironmentError: |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
947 | print("Could not install '{0}' (no permission)." |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
948 | .format(apiName)) |
3943
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
949 | if progLanguage == "Python": |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
950 | # copy Python3 API files to the same destination |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
951 | for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
952 | "Python3", "*.api")): |
3697
c947a7eaace4
Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3693
diff
changeset
|
953 | try: |
c947a7eaace4
Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3693
diff
changeset
|
954 | shutilCopy(apiName, apidir) |
c947a7eaace4
Updated the base classes files and modified the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3693
diff
changeset
|
955 | except EnvironmentError: |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
956 | print("Could not install '{0}' (no permission)." |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
957 | .format(apiName)) |
3943
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
958 | for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
959 | "Python3", "*.bas")): |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
960 | if os.path.exists(os.path.join( |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
961 | apidir, os.path.basename( |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
962 | apiName.replace(".bas", ".api")))): |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
963 | try: |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
964 | shutilCopy(apiName, apidir) |
37d88bed7bb9
Extended install script to mark more files with Python variant markers and added the '--noapis' switch to suppress API files installation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3942
diff
changeset
|
965 | except EnvironmentError: |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
966 | print("Could not install '{0}' (no permission)." |
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6213
diff
changeset
|
967 | .format(apiName)) |
146
afeb742e7148
Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
133
diff
changeset
|
968 | |
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
|
969 | # Create menu entry for Linux systems |
146
afeb742e7148
Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
133
diff
changeset
|
970 | if sys.platform.startswith("linux"): |
6500
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
971 | createLinuxSpecifics() |
3931
ff8e034662d6
Modified the install script to allow parallel installation for Python2 and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3897
diff
changeset
|
972 | |
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
|
973 | # 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
|
974 | 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
|
975 | createWindowsLinks() |
1387
1734bc5f4f82
Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1385
diff
changeset
|
976 | |
1390
f4a7915db1e6
Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1389
diff
changeset
|
977 | # 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
|
978 | elif sys.platform == "darwin": |
1390
f4a7915db1e6
Fixed the Mac part of the install script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1389
diff
changeset
|
979 | createMacAppBundle(cfg['ericDir']) |
2383
e999256385bd
Extended the installation routine by the creation of a desktop file for the eric5 web browser.
"Detlev Offenbach <detlev@die-offenbachs.de>"
parents:
2312
diff
changeset
|
980 | |
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
|
981 | return 0 |
1387
1734bc5f4f82
Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1385
diff
changeset
|
982 | |
1734bc5f4f82
Mac related changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1385
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 | 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
|
985 | """ |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
986 | 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
|
987 | """ |
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
|
988 | global distDir, sourceDir, includePythonVariant |
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
|
989 | |
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
|
990 | if includePythonVariant: |
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
|
991 | marker = PythonMarkers[sys.version_info.major] |
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
|
992 | else: |
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 | marker = "" |
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
|
994 | |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
995 | if distDir: |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
996 | dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
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 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
|
998 | 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
|
999 | shutilCopy( |
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
|
1000 | os.path.join(sourceDir, "icons", "default", "eric.png"), |
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
|
1001 | os.path.join(dst, "eric" + marker + ".png")) |
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 | shutilCopy( |
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 | os.path.join(sourceDir, "icons", "default", "ericWeb48.png"), |
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
|
1004 | os.path.join(dst, "ericWeb" + marker + ".png")) |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1005 | dst = os.path.normpath( |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1006 | os.path.join(distDir, "usr/share/applications")) |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1007 | 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
|
1008 | 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
|
1009 | copyDesktopFile(os.path.join(sourceDir, "eric6.desktop"), |
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
|
1010 | os.path.join(dst, "eric6" + marker + ".desktop"), |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1011 | marker) |
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
|
1012 | copyDesktopFile( |
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
|
1013 | os.path.join(sourceDir, "eric6_webbrowser.desktop"), |
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
|
1014 | os.path.join(dst, "eric6_webbrowser" + marker + ".desktop"), |
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
|
1015 | marker) |
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
|
1016 | copyDesktopFile( |
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
|
1017 | os.path.join(sourceDir, "eric6_browser.desktop"), |
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
|
1018 | os.path.join(dst, "eric6_browser" + marker + ".desktop"), |
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 | marker) |
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 | dst = os.path.normpath( |
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
|
1021 | os.path.join(distDir, "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
|
1022 | 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
|
1023 | 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
|
1024 | copyAppStreamFile( |
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
|
1025 | os.path.join(sourceDir, "eric6.appdata.xml"), |
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
|
1026 | os.path.join(dst, "eric6" + marker + ".appdata.xml"), |
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
|
1027 | marker) |
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
|
1028 | elif 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
|
1029 | shutilCopy(os.path.join( |
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
|
1030 | sourceDir, "icons", "default", "eric.png"), |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1031 | "/usr/share/pixmaps/eric" + marker + ".png") |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1032 | copyDesktopFile( |
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 | os.path.join(sourceDir, "eric6.desktop"), |
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 | "/usr/share/applications/eric6" + marker + ".desktop", |
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 | marker) |
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 | 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
|
1037 | copyAppStreamFile( |
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
|
1038 | os.path.join(sourceDir, "eric6.appdata.xml"), |
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
|
1039 | "/usr/share/metainfo/eric6" + marker + ".appdata.xml", |
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
|
1040 | marker) |
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
|
1041 | 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
|
1042 | copyAppStreamFile( |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1043 | os.path.join(sourceDir, "eric6.appdata.xml"), |
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 | "/usr/share/appdata/eric6" + marker + ".appdata.xml", |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1045 | marker) |
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
|
1046 | shutilCopy(os.path.join( |
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
|
1047 | sourceDir, "icons", "default", "ericWeb48.png"), |
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
|
1048 | "/usr/share/pixmaps/ericWeb" + marker + ".png") |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1049 | copyDesktopFile( |
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
|
1050 | os.path.join(sourceDir, "eric6_webbrowser.desktop"), |
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
|
1051 | "/usr/share/applications/eric6_webbrowser" + marker + |
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
|
1052 | ".desktop", |
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
|
1053 | marker) |
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
|
1054 | copyDesktopFile( |
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
|
1055 | os.path.join(sourceDir, "eric6_browser.desktop"), |
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
|
1056 | "/usr/share/applications/eric6_browser" + marker + |
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
|
1057 | ".desktop", |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1058 | marker) |
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
|
1059 | 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
|
1060 | # 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
|
1061 | localPath = os.path.join(os.path.expanduser("~"), |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1062 | ".local", "share") |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1063 | # create directories first |
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
|
1064 | for directory in [os.path.join(localPath, 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
|
1065 | for name in ("pixmaps", "applications", |
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
|
1066 | "metainfo", "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
|
1067 | 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
|
1068 | 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
|
1069 | # 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
|
1070 | shutilCopy( |
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 | os.path.join(sourceDir, "icons", "default", "eric.png"), |
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 | os.path.join(localPath, "pixmaps", "eric" + marker + ".png")) |
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 | copyDesktopFile( |
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
|
1074 | os.path.join(sourceDir, "eric6.desktop"), |
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
|
1075 | os.path.join(localPath, "applications", |
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
|
1076 | "eric6" + marker + ".desktop"), |
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
|
1077 | marker) |
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
|
1078 | copyAppStreamFile( |
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 | os.path.join(sourceDir, "eric6.appdata.xml"), |
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
|
1080 | os.path.join(localPath, "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
|
1081 | "eric6" + marker + ".appdata.xml"), |
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
|
1082 | marker) |
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
|
1083 | copyAppStreamFile( |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1084 | os.path.join(sourceDir, "eric6.appdata.xml"), |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1085 | os.path.join(localPath, "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
|
1086 | "eric6" + marker + ".appdata.xml"), |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
1087 | marker) |
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
|
1088 | shutilCopy( |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
|