scripts/install.py

changeset 7960
e8fc383322f7
parent 7923
91e843545d9a
child 8043
0acf98cd089a
child 8047
b5594178c7fa
equal deleted inserted replaced
7959:44e15eda6506 7960:e8fc383322f7
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright (c) 2002 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> 4 # Copyright (c) 2002 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
5 # 5 #
6 # This is the install script for eric6. 6 # This is the install script for eric.
7 7
8 """ 8 """
9 Installation script for the eric6 IDE and all eric6 related tools. 9 Installation script for the eric IDE and all eric related tools.
10 """ 10 """
11 11
12 import sys 12 import sys
13 import os 13 import os
14 import re 14 import re
141 else: 141 else:
142 print(" (no default value)") 142 print(" (no default value)")
143 print(" --no-apis don't install API files") 143 print(" --no-apis don't install API files")
144 print(" -b dir where the binaries will be installed") 144 print(" -b dir where the binaries will be installed")
145 print(" (default: {0})".format(platBinDir)) 145 print(" (default: {0})".format(platBinDir))
146 print(" -d dir where eric6 python files will be installed") 146 print(" -d dir where eric python files will be installed")
147 print(" (default: {0})".format(modDir)) 147 print(" (default: {0})".format(modDir))
148 print(" -f file configuration file naming the various installation" 148 print(" -f file configuration file naming the various installation"
149 " paths") 149 " paths")
150 if not sys.platform.startswith(("win", "cygwin")): 150 if not sys.platform.startswith(("win", "cygwin")):
151 print(" -i dir temporary install prefix") 151 print(" -i dir temporary install prefix")
177 print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir'," 177 print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir',"
178 " 'ericExamplesDir',") 178 " 'ericExamplesDir',")
179 print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',") 179 print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',")
180 print("'ericOthersDir','bindir', 'mdir' and 'apidir.") 180 print("'ericOthersDir','bindir', 'mdir' and 'apidir.")
181 print("These define the directories for the installation of the various" 181 print("These define the directories for the installation of the various"
182 " parts of eric6.") 182 " parts of eric.")
183 183
184 exit(rcode) 184 exit(rcode)
185 185
186 186
187 def initGlobals(): 187 def initGlobals():
491 global platBinDir, platBinDirOld 491 global platBinDir, platBinDirOld
492 492
493 try: 493 try:
494 from eric6config import getConfig 494 from eric6config import getConfig
495 except ImportError: 495 except ImportError:
496 # eric6 wasn't installed previously 496 # eric wasn't installed previously
497 return 497 return
498 except SyntaxError: 498 except SyntaxError:
499 # an incomplete or old config file was found 499 # an incomplete or old config file was found
500 return 500 return
501 501
742 # make the install directories 742 # make the install directories
743 for key in cfg.keys(): 743 for key in cfg.keys():
744 if cfg[key] and not os.path.isdir(cfg[key]): 744 if cfg[key] and not os.path.isdir(cfg[key]):
745 os.makedirs(cfg[key]) 745 os.makedirs(cfg[key])
746 746
747 # copy the eric6 config file 747 # copy the eric config file
748 if distDir: 748 if distDir:
749 shutilCopy(configName, cfg['mdir']) 749 shutilCopy(configName, cfg['mdir'])
750 if os.path.exists(configName + 'c'): 750 if os.path.exists(configName + 'c'):
751 shutilCopy(configName + 'c', cfg['mdir']) 751 shutilCopy(configName + 'c', cfg['mdir'])
752 else: 752 else:
753 shutilCopy(configName, modDir) 753 shutilCopy(configName, modDir)
754 if os.path.exists(configName + 'c'): 754 if os.path.exists(configName + 'c'):
755 shutilCopy(configName + 'c', modDir) 755 shutilCopy(configName + 'c', modDir)
756 756
757 # copy the various parts of eric6 757 # copy the various parts of eric
758 copyTree( 758 copyTree(
759 eric6SourceDir, cfg['ericDir'], 759 eric6SourceDir, cfg['ericDir'],
760 ['*.py', '*.pyc', '*.pyo', '*.pyw'], 760 ['*.py', '*.pyc', '*.pyo', '*.pyw'],
761 [os.path.join(sourceDir, "Examples"), 761 [os.path.join(sourceDir, "Examples"),
762 os.path.join(sourceDir, ".ropeproject")], 762 os.path.join(sourceDir, ".ropeproject")],
1255 else: 1255 else:
1256 macConfig = "" 1256 macConfig = ""
1257 config = ( 1257 config = (
1258 """# -*- coding: utf-8 -*-\n""" 1258 """# -*- coding: utf-8 -*-\n"""
1259 """#\n""" 1259 """#\n"""
1260 """# This module contains the configuration of the individual eric6""" 1260 """# This module contains the configuration of the individual eric"""
1261 """ installation\n""" 1261 """ installation\n"""
1262 """#\n""" 1262 """#\n"""
1263 """\n""" 1263 """\n"""
1264 """_pkg_config = {{\n""" 1264 """_pkg_config = {{\n"""
1265 """ 'ericDir': r'{0}',\n""" 1265 """ 'ericDir': r'{0}',\n"""
1312 copyToFile(configName, config) 1312 copyToFile(configName, config)
1313 1313
1314 1314
1315 def createInstallInfo(): 1315 def createInstallInfo():
1316 """ 1316 """
1317 Record information about the way eric6 was installed. 1317 Record information about the way eric was installed.
1318 """ 1318 """
1319 global createInstallInfoFile, installInfo, installCwd, cfg 1319 global createInstallInfoFile, installInfo, installCwd, cfg
1320 1320
1321 if createInstallInfoFile: 1321 if createInstallInfoFile:
1322 installDateTime = datetime.datetime.now(tz=None) 1322 installDateTime = datetime.datetime.now(tz=None)
1630 exit(3) 1630 exit(3)
1631 # check for blacklisted versions 1631 # check for blacklisted versions
1632 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]: 1632 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]:
1633 if vers == sipVersion: 1633 if vers == sipVersion:
1634 print( 1634 print(
1635 'Sorry, sip version {0} is not compatible with eric6.' 1635 'Sorry, sip version {0} is not compatible with eric.'
1636 .format(vers)) 1636 .format(vers))
1637 print('Please install another version.') 1637 print('Please install another version.')
1638 exit(3) 1638 exit(3)
1639 except (ImportError, AttributeError): 1639 except (ImportError, AttributeError):
1640 pass 1640 pass
1656 ' a recent snapshot release.') 1656 ' a recent snapshot release.')
1657 exit(4) 1657 exit(4)
1658 # check for blacklisted versions 1658 # check for blacklisted versions
1659 for vers in BlackLists["PyQt5"] + PlatformBlackLists["PyQt5"]: 1659 for vers in BlackLists["PyQt5"] + PlatformBlackLists["PyQt5"]:
1660 if vers == pyqtVersion: 1660 if vers == pyqtVersion:
1661 print('Sorry, PyQt version {0} is not compatible with eric6.' 1661 print('Sorry, PyQt version {0} is not compatible with eric.'
1662 .format(vers)) 1662 .format(vers))
1663 print('Please install another version.') 1663 print('Please install another version.')
1664 exit(4) 1664 exit(4)
1665 1665
1666 # check version of QScintilla 1666 # check version of QScintilla
1689 PlatformBlackLists["QScintilla2"] 1689 PlatformBlackLists["QScintilla2"]
1690 ): 1690 ):
1691 if vers == scintillaVersion: 1691 if vers == scintillaVersion:
1692 print( 1692 print(
1693 'Sorry, QScintilla2 version {0} is not compatible with' 1693 'Sorry, QScintilla2 version {0} is not compatible with'
1694 ' eric6.'.format(vers)) 1694 ' eric.'.format(vers))
1695 print('Please install another version.') 1695 print('Please install another version.')
1696 exit(5) 1696 exit(5)
1697 1697
1698 # print version info for additional modules 1698 # print version info for additional modules
1699 try: 1699 try:
1878 global installApis, doCleanDesktopLinks, yes2All 1878 global installApis, doCleanDesktopLinks, yes2All
1879 global createInstallInfoFile, installCwd 1879 global createInstallInfoFile, installCwd
1880 global ignorePyqt5Tools 1880 global ignorePyqt5Tools
1881 1881
1882 if sys.version_info < (3, 6, 0) or sys.version_info > (3, 99, 99): 1882 if sys.version_info < (3, 6, 0) or sys.version_info > (3, 99, 99):
1883 print('Sorry, eric6 requires at least Python 3.6 for running.') 1883 print('Sorry, eric requires at least Python 3.6 for running.')
1884 exit(5) 1884 exit(5)
1885 1885
1886 progName = os.path.basename(argv[0]) 1886 progName = os.path.basename(argv[0])
1887 1887
1888 installCwd = os.getcwd() 1888 installCwd = os.getcwd()
2042 rx=skipRe, 2042 rx=skipRe,
2043 quiet=True) 2043 quiet=True)
2044 py_compile.compile(configName, 2044 py_compile.compile(configName,
2045 dfile=os.path.join(modDir, "eric6config.py")) 2045 dfile=os.path.join(modDir, "eric6config.py"))
2046 sys.stdout = sys.__stdout__ 2046 sys.stdout = sys.__stdout__
2047 print("\nInstalling eric6 ...") 2047 print("\nInstalling eric ...")
2048 res = installEric() 2048 res = installEric()
2049 2049
2050 if createInstallInfoFile: 2050 if createInstallInfoFile:
2051 with open(os.path.join(cfg["ericDir"], 2051 with open(os.path.join(cfg["ericDir"],
2052 installInfoName), "w") as installInfoFile: 2052 installInfoName), "w") as installInfoFile:

eric ide

mercurial