install.py

branch
maintenance
changeset 6646
51eefa621de4
parent 6645
ad476851d7e0
child 6655
0c948fbab480
equal deleted inserted replaced
6603:77189681b787 6646:51eefa621de4
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright (c) 2002 - 2018 Detlev Offenbach <detlev@die-offenbachs.de> 4 # Copyright (c) 2002 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
5 # 5 #
6 # This is the install script for eric6. 6 # This is the install script for eric6.
7 7
8 """ 8 """
9 Installation script for the eric6 IDE and all eric6 related tools. 9 Installation script for the eric6 IDE and all eric6 related tools.
546 shutil.rmtree(os.path.join(dirName, "__pycache__")) 546 shutil.rmtree(os.path.join(dirName, "__pycache__"))
547 for name in [f for f in os.listdir(dirName) 547 for name in [f for f in os.listdir(dirName)
548 if fnmatch.fnmatch(f, "*.pyc")]: 548 if fnmatch.fnmatch(f, "*.pyc")]:
549 os.remove(os.path.join(dirName, name)) 549 os.remove(os.path.join(dirName, name))
550 550
551 # step 3: descent into subdirectories and delete them if empty 551 # step 3: delete *.orig files
552 for name in [f for f in os.listdir(dirName)
553 if fnmatch.fnmatch(f, "*.orig")]:
554 os.remove(os.path.join(dirName, name))
555
556 # step 4: descent into subdirectories and delete them if empty
552 for name in os.listdir(dirName): 557 for name in os.listdir(dirName):
553 name = os.path.join(dirName, name) 558 name = os.path.join(dirName, name)
554 if os.path.isdir(name): 559 if os.path.isdir(name):
555 cleanupSource(name) 560 cleanupSource(name)
556 if len(os.listdir(name)) == 0: 561 if len(os.listdir(name)) == 0:
1461 print("Sorry, {0} is not installed.".format(pyuic)) 1466 print("Sorry, {0} is not installed.".format(pyuic))
1462 print('Error: {0}'.format(msg)) 1467 print('Error: {0}'.format(msg))
1463 exit(1) 1468 exit(1)
1464 print("Found {0}".format(pyuic)) 1469 print("Found {0}".format(pyuic))
1465 1470
1471 if pyqtVariant != "PyQt4":
1472 try:
1473 from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__
1474 except ImportError as msg:
1475 installed = pipInstall(
1476 "PyQtWebEngine",
1477 "PyQtWebEngine could not be detected.\nError: {0}".format(msg)
1478 )
1479
1466 try: 1480 try:
1467 if pyqtVariant == "PyQt4": 1481 if pyqtVariant == "PyQt4":
1468 from PyQt4 import Qsci # __IGNORE_WARNING__ 1482 from PyQt4 import Qsci # __IGNORE_WARNING__
1469 else: 1483 else:
1470 from PyQt5 import Qsci # __IGNORE_WARNING__ 1484 from PyQt5 import Qsci # __IGNORE_WARNING__
1922 elif "--noapis": 1936 elif "--noapis":
1923 installApis = False 1937 installApis = False
1924 1938
1925 infoName = "" 1939 infoName = ""
1926 installFromSource = not os.path.isdir(sourceDir) 1940 installFromSource = not os.path.isdir(sourceDir)
1941
1942 # check dependencies
1943 if depChecks:
1944 doDependancyChecks()
1945
1946 # cleanup source if installing from source
1947 if installFromSource:
1948 print("Cleaning up source ...")
1949 sourceDir = os.path.dirname(__file__) or "."
1950 cleanupSource(sourceDir)
1951 print()
1952
1927 if installFromSource: 1953 if installFromSource:
1928 sourceDir = os.path.dirname(__file__) or "." 1954 sourceDir = os.path.dirname(__file__) or "."
1929 configName = os.path.join(sourceDir, "eric6config.py") 1955 configName = os.path.join(sourceDir, "eric6config.py")
1930 if os.path.exists(os.path.join(sourceDir, ".hg")): 1956 if os.path.exists(os.path.join(sourceDir, ".hg")):
1931 # we are installing from source with repo 1957 # we are installing from source with repo
1932 infoName = os.path.join(sourceDir, "UI", "Info.py") 1958 infoName = os.path.join(sourceDir, "UI", "Info.py")
1933 prepareInfoFile(infoName) 1959 prepareInfoFile(infoName)
1934 1960
1935 if len(cfg) == 0: 1961 if len(cfg) == 0:
1936 createInstallConfig() 1962 createInstallConfig()
1937
1938 if depChecks:
1939 doDependancyChecks()
1940 1963
1941 # get rid of development config file, if it exists 1964 # get rid of development config file, if it exists
1942 try: 1965 try:
1943 if installFromSource: 1966 if installFromSource:
1944 os.rename(configName, configName + ".orig") 1967 os.rename(configName, configName + ".orig")
1946 if os.path.exists(configNameC): 1969 if os.path.exists(configNameC):
1947 os.remove(configNameC) 1970 os.remove(configNameC)
1948 os.remove(configName) 1971 os.remove(configName)
1949 except EnvironmentError: 1972 except EnvironmentError:
1950 pass 1973 pass
1951
1952 # cleanup source if installing from source
1953 if installFromSource:
1954 print("Cleaning up source ...")
1955 cleanupSource(sourceDir)
1956 print()
1957 1974
1958 # cleanup old installation 1975 # cleanup old installation
1959 print("Cleaning up old installation ...") 1976 print("Cleaning up old installation ...")
1960 try: 1977 try:
1961 if doCleanup: 1978 if doCleanup:

eric ide

mercurial