install.py

changeset 6663
fe9da2b5d148
parent 6660
fd767acf3e98
child 6664
50c9c1c9cf30
equal deleted inserted replaced
6662:0002926e71d3 6663:fe9da2b5d148
45 platBinDirOld = None 45 platBinDirOld = None
46 distDir = None 46 distDir = None
47 apisDir = None 47 apisDir = None
48 installApis = True 48 installApis = True
49 doCleanup = True 49 doCleanup = True
50 doCleanDesktopLinks = False
51 forceCleanDesktopLinks = False
50 doCompile = True 52 doCompile = True
51 includePythonVariant = False 53 includePythonVariant = False
52 cfg = {} 54 cfg = {}
53 progLanguages = ["Python", "Ruby", "QSS"] 55 progLanguages = ["Python", "Ruby", "QSS"]
54 sourceDir = "eric" 56 sourceDir = "eric"
139 141
140 print() 142 print()
141 print("Usage:") 143 print("Usage:")
142 if sys.platform == "darwin": 144 if sys.platform == "darwin":
143 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" 145 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
144 " [-m name] [-p python] [--pyqt=version]".format(progName)) 146 " [-m name] [-n path] [-p python] [--no-apis] [--pyqt=version]"
147 .format(progName))
145 elif sys.platform.startswith(("win", "cygwin")): 148 elif sys.platform.startswith(("win", "cygwin")):
146 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file]" 149 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file]"
147 " [--pyqt=version]" 150 " [--clean-desktop] [--no-apis] [--pyqt=version]"
148 .format(progName)) 151 .format(progName))
149 else: 152 else:
150 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" 153 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
151 " [--pyqt=version]" 154 " [--no-apis] [--pyqt=version]"
152 .format(progName)) 155 .format(progName))
153 print("where:") 156 print("where:")
154 print(" -h, --help display this help message") 157 print(" -h, --help display this help message")
155 print(" -a dir where the API files will be installed") 158 print(" -a dir where the API files will be installed")
156 if apisDir: 159 if apisDir:
157 print(" (default: {0})".format(apisDir)) 160 print(" (default: {0})".format(apisDir))
158 else: 161 else:
159 print(" (no default value)") 162 print(" (no default value)")
160 print(" --noapis don't install API files") 163 print(" --no-apis don't install API files")
161 print(" -b dir where the binaries will be installed") 164 print(" -b dir where the binaries will be installed")
162 print(" (default: {0})".format(platBinDir)) 165 print(" (default: {0})".format(platBinDir))
163 print(" -d dir where eric6 python files will be installed") 166 print(" -d dir where eric6 python files will be installed")
164 print(" (default: {0})".format(modDir)) 167 print(" (default: {0})".format(modDir))
165 print(" -f file configuration file naming the various installation" 168 print(" -f file configuration file naming the various installation"
174 print(" be created in") 177 print(" be created in")
175 print(" (default: {0})".format(macAppBundlePath)) 178 print(" (default: {0})".format(macAppBundlePath))
176 print(" -p python path of the python executable") 179 print(" -p python path of the python executable")
177 print(" (default: {0})".format(macPythonExe)) 180 print(" (default: {0})".format(macPythonExe))
178 print(" -c don't cleanup old installation first") 181 print(" -c don't cleanup old installation first")
182 if sys.platform.startswith(("win", "cygwin")):
183 (" --clean-desktop delete desktop links before installation")
179 print(" -x don't perform dependency checks (use on your own" 184 print(" -x don't perform dependency checks (use on your own"
180 " risk)") 185 " risk)")
181 print(" -y add the Python variant to the executable names") 186 print(" -y add the Python variant to the executable names")
182 print(" -z don't compile the installed python files") 187 print(" -z don't compile the installed python files")
183 print(" --pyqt=version version of PyQt to be used (one of 4 or 5)") 188 print(" --pyqt=version version of PyQt to be used (one of 4 or 5)")
735 740
736 def cleanUpWindowsLinks(): 741 def cleanUpWindowsLinks():
737 """ 742 """
738 Clean up the Desktop and Start Menu entries for Windows. 743 Clean up the Desktop and Start Menu entries for Windows.
739 """ 744 """
745 global doCleanDesktopLinks, forceCleanDesktopLinks
746
740 try: 747 try:
741 from pywintypes import com_error # __IGNORE_WARNING__ 748 from pywintypes import com_error # __IGNORE_WARNING__
742 except ImportError: 749 except ImportError:
743 # links were not created by install.py 750 # links were not created by install.py
744 return 751 return
745 752
746 regPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" + \ 753 regPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" + \
747 "\\User Shell Folders" 754 "\\User Shell Folders"
748 755
749 # 1. cleanup desktop links 756 if doCleanDesktopLinks or forceCleanDesktopLinks:
750 regName = "Desktop" 757 # 1. cleanup desktop links
751 desktopEntry = getWinregEntry(regName, regPath) 758 regName = "Desktop"
752 if desktopEntry: 759 desktopEntry = getWinregEntry(regName, regPath)
753 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry)) 760 if desktopEntry:
754 for linkName in windowsDesktopNames(): 761 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry))
755 linkPath = os.path.join(desktopFolder, linkName) 762 for linkName in windowsDesktopNames():
756 if os.path.exists(linkPath): 763 linkPath = os.path.join(desktopFolder, linkName)
757 try: 764 if os.path.exists(linkPath):
758 os.remove(linkPath) 765 try:
759 except EnvironmentError: 766 os.remove(linkPath)
760 # maybe restrictions prohibited link removal 767 except EnvironmentError:
761 print("Could not remove '{0}'.".format(linkPath)) 768 # maybe restrictions prohibited link removal
769 print("Could not remove '{0}'.".format(linkPath))
762 770
763 # 2. cleanup start menu entry 771 # 2. cleanup start menu entry
764 regName = "Programs" 772 regName = "Programs"
765 programsEntry = getWinregEntry(regName, regPath) 773 programsEntry = getWinregEntry(regName, regPath)
766 if programsEntry: 774 if programsEntry:
1862 1870
1863 # Parse the command line. 1871 # Parse the command line.
1864 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir 1872 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir
1865 global sourceDir, configName, includePythonVariant 1873 global sourceDir, configName, includePythonVariant
1866 global macAppBundlePath, macAppBundleName, macPythonExe 1874 global macAppBundlePath, macAppBundleName, macPythonExe
1867 global pyqtVariant, pyqtOverride, installApis 1875 global pyqtVariant, pyqtOverride, installApis, doCleanDesktopLinks
1868 1876
1869 if sys.version_info < (2, 7, 0) or sys.version_info > (3, 9, 9): 1877 if sys.version_info < (2, 7, 0) or sys.version_info > (3, 9, 9):
1870 print('Sorry, eric6 requires at least Python 2.7 or ' 1878 print('Sorry, eric6 requires at least Python 2.7 or '
1871 'Python 3 for running.') 1879 'Python 3 for running.')
1872 exit(5) 1880 exit(5)
1935 if arg not in ["4", "5"]: 1943 if arg not in ["4", "5"]:
1936 print("Invalid PyQt version given; should be 4 or 5. Aborting") 1944 print("Invalid PyQt version given; should be 4 or 5. Aborting")
1937 exit(6) 1945 exit(6)
1938 pyqtVariant = "PyQt{0}".format(arg) 1946 pyqtVariant = "PyQt{0}".format(arg)
1939 pyqtOverride = True 1947 pyqtOverride = True
1940 elif "--noapis": 1948 elif opt == "--no-apis":
1941 installApis = False 1949 installApis = False
1950 elif opt == "--clean-desktop":
1951 doCleanDesktopLinks = True
1942 1952
1943 infoName = "" 1953 infoName = ""
1944 installFromSource = not os.path.isdir(sourceDir) 1954 installFromSource = not os.path.isdir(sourceDir)
1945 1955
1946 # check dependencies 1956 # check dependencies

eric ide

mercurial