891 for name in ["LICENSE.txt", "THANKS", "changelog.md", "ThirdParty.md"]: |
891 for name in ["LICENSE.txt", "THANKS", "changelog.md", "ThirdParty.md"]: |
892 try: |
892 try: |
893 shutilCopy(os.path.join(sourceDir, "docs", name), cfg["ericDocDir"]) |
893 shutilCopy(os.path.join(sourceDir, "docs", name), cfg["ericDocDir"]) |
894 except OSError: |
894 except OSError: |
895 print( |
895 print( |
896 "Could not install '{0}'.".format(os.path.join(sourceDir, "docs", name)) |
896 "\nCould not install '{0}'.".format(os.path.join(sourceDir, "docs", name)) |
897 ) |
897 ) |
898 for name in glob.glob(os.path.join(sourceDir, "docs", "README*.*")): |
898 for name in glob.glob(os.path.join(sourceDir, "docs", "README*.*")): |
899 try: |
899 try: |
900 shutilCopy(name, cfg["ericDocDir"]) |
900 shutilCopy(name, cfg["ericDocDir"]) |
901 except OSError: |
901 except OSError: |
902 print("Could not install '{0}'.".format(name)) |
902 print("\nCould not install '{0}'.".format(name)) |
903 |
903 |
904 # copy some more stuff |
904 # copy some more stuff |
905 for name in ("default.ekj", "default_Mac.ekj", "default.e4k", "default_Mac.e4k"): |
905 for name in ("default.ekj", "default_Mac.ekj", "default.e4k", "default_Mac.e4k"): |
906 try: |
906 try: |
907 shutilCopy(os.path.join(sourceDir, "others", name), cfg["ericOthersDir"]) |
907 shutilCopy(os.path.join(sourceDir, "others", name), cfg["ericOthersDir"]) |
908 except OSError: |
908 except OSError: |
909 print( |
909 print( |
910 "Could not install '{0}'.".format( |
910 "\nCould not install '{0}'.".format( |
911 os.path.join(sourceDir, "others", name) |
911 os.path.join(sourceDir, "others", name) |
912 ) |
912 ) |
913 ) |
913 ) |
914 |
914 |
915 # install the API file |
915 # install the API file |
916 if installApis: |
916 if installApis: |
917 if os.access(cfg["apidir"], os.W_OK): |
917 if os.access(cfg["apidir"], os.W_OK): |
918 for progLanguage in progLanguages: |
918 for progLanguage in progLanguages: |
919 apidir = os.path.join(cfg["apidir"], progLanguage) |
919 apidir = os.path.join(cfg["apidir"], progLanguage) |
920 print("Installing {0} API files to '{1}'.".format(progLanguage, apidir)) |
920 print( |
|
921 "\nInstalling {0} API files to '{1}'.".format(progLanguage, apidir) |
|
922 ) |
921 if not os.path.exists(apidir): |
923 if not os.path.exists(apidir): |
922 os.makedirs(apidir) |
924 os.makedirs(apidir) |
923 for apiName in glob.glob( |
925 for apiName in glob.glob( |
924 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api") |
926 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api") |
925 ): |
927 ): |
927 for apiName in glob.glob( |
929 for apiName in glob.glob( |
928 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.bas") |
930 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.bas") |
929 ): |
931 ): |
930 shutilCopy(apiName, apidir) |
932 shutilCopy(apiName, apidir) |
931 else: |
933 else: |
932 print("The API directory '{0}' is not writable.".format(cfg["apidir"])) |
934 print("\nThe API directory '{0}' is not writable.".format(cfg["apidir"])) |
933 print("Use the API files provided by the 'API Files' plug-in.") |
935 print("Use the API files provided by the 'API Files' plug-in.") |
934 |
936 |
935 # Create menu entry for Linux systems |
937 # Create menu entry for Linux systems |
936 if sys.platform.startswith("linux"): |
938 if sys.platform.startswith("linux"): |
937 createLinuxSpecifics() |
939 createLinuxSpecifics() |
1699 "cyclonedx-python-lib": ("cyclonedx", ""), |
1704 "cyclonedx-python-lib": ("cyclonedx", ""), |
1700 "cyclonedx-bom": ("cyclonedx_py", ""), |
1705 "cyclonedx-bom": ("cyclonedx_py", ""), |
1701 "trove-classifiers": ("trove_classifiers", ""), |
1706 "trove-classifiers": ("trove_classifiers", ""), |
1702 "black": ("black", ">=22.6.0"), |
1707 "black": ("black", ">=22.6.0"), |
1703 "isort": ("isort", ">=5.10.0"), |
1708 "isort": ("isort", ">=5.10.0"), |
|
1709 "coverage": ("coverage", ">=6.5.0"), |
1704 } |
1710 } |
1705 optionalModulesList = { |
1711 optionalModulesList = { |
1706 # key is pip project name |
1712 # key is pip project name |
1707 # value is tuple of package name, pip install constraint |
1713 # value is tuple of package name, pip install constraint |
1708 "docutils": ("docutils", ""), |
1714 "docutils": ("docutils", ""), |
1715 if withPyqt6Tools: |
1721 if withPyqt6Tools: |
1716 optionalModulesList["qt6-applications"] = ("qt6_applications", "") |
1722 optionalModulesList["qt6-applications"] = ("qt6_applications", "") |
1717 |
1723 |
1718 # check mandatory PyQt6 modules |
1724 # check mandatory PyQt6 modules |
1719 modulesOK = True |
1725 modulesOK = True |
1720 for pyqt6BaseModule in pyqt6BaseModulesList: |
1726 for pyqt6BaseModule in sorted(pyqt6BaseModulesList): |
1721 name = pyqt6BaseModule.split(".")[1] |
1727 name = pyqt6BaseModule.split(".")[1] |
1722 try: |
1728 try: |
1723 importlib.import_module(pyqt6BaseModule) |
1729 importlib.import_module(pyqt6BaseModule) |
1724 print("Found", name) |
1730 print("Found", name) |
1725 except ImportError as err: |
1731 except ImportError as err: |
1729 modulesOK = False |
1735 modulesOK = False |
1730 if not modulesOK: |
1736 if not modulesOK: |
1731 exit(1) |
1737 exit(1) |
1732 |
1738 |
1733 # check required modules |
1739 # check required modules |
|
1740 print("\nRequired Packages") |
|
1741 print("-----------------") |
1734 requiredMissing = False |
1742 requiredMissing = False |
1735 for requiredPackage in requiredModulesList: |
1743 for requiredPackage in sorted(requiredModulesList): |
1736 try: |
1744 try: |
1737 importlib.import_module(requiredModulesList[requiredPackage][0]) |
1745 importlib.import_module(requiredModulesList[requiredPackage][0]) |
1738 print("Found", requiredPackage) |
1746 print("Found", requiredPackage) |
1739 except ImportError as err: |
1747 except ImportError as err: |
1740 if isSudo: |
1748 if isSudo: |
1753 print("Some required packages are missing and could not be installed.") |
1761 print("Some required packages are missing and could not be installed.") |
1754 print("Install them manually with:") |
1762 print("Install them manually with:") |
1755 print(" {0} install-dependencies.py --required".format(sys.executable)) |
1763 print(" {0} install-dependencies.py --required".format(sys.executable)) |
1756 |
1764 |
1757 # check optional modules |
1765 # check optional modules |
|
1766 print("\nOptional Packages") |
|
1767 print("-----------------") |
1758 optionalMissing = False |
1768 optionalMissing = False |
1759 for optPackage in optionalModulesList: |
1769 for optPackage in sorted(optionalModulesList): |
1760 try: |
1770 try: |
1761 importlib.import_module(optionalModulesList[optPackage][0]) |
1771 importlib.import_module(optionalModulesList[optPackage][0]) |
1762 print("Found", optPackage) |
1772 print("Found", optPackage) |
1763 except ImportError as err: |
1773 except ImportError as err: |
1764 if isSudo: |
1774 if isSudo: |
2203 else os.path.join(sourceDir, "eric7") |
2213 else os.path.join(sourceDir, "eric7") |
2204 ) |
2214 ) |
2205 |
2215 |
2206 # cleanup source if installing from source |
2216 # cleanup source if installing from source |
2207 if installFromSource: |
2217 if installFromSource: |
2208 print("Cleaning up source ...") |
2218 print("Cleaning up source ...", end="") |
2209 cleanupSource(sourceDir) |
2219 cleanupSource(sourceDir) |
2210 print() |
2220 print(" Done") |
2211 |
2221 |
2212 configName = os.path.join(eric7SourceDir, "eric7config.py") |
2222 configName = os.path.join(eric7SourceDir, "eric7config.py") |
2213 if os.path.exists(os.path.join(sourceDir, ".hg")): |
2223 if os.path.exists(os.path.join(sourceDir, ".hg")): |
2214 # we are installing from source with repo |
2224 # we are installing from source with repo |
2215 infoName = os.path.join(eric7SourceDir, "UI", "Info.py") |
2225 infoName = os.path.join(eric7SourceDir, "UI", "Info.py") |
2226 if os.path.exists(configNameC): |
2236 if os.path.exists(configNameC): |
2227 os.remove(configNameC) |
2237 os.remove(configNameC) |
2228 os.remove(configName) |
2238 os.remove(configName) |
2229 |
2239 |
2230 # cleanup old installation |
2240 # cleanup old installation |
2231 print("Cleaning up old installation ...") |
2241 print("Cleaning up old installation ...", end="") |
2232 try: |
2242 try: |
2233 if doCleanup: |
2243 if doCleanup: |
2234 if distDir: |
2244 if distDir: |
2235 shutil.rmtree(distDir, True) |
2245 shutil.rmtree(distDir, True) |
2236 else: |
2246 else: |
2237 cleanUp() |
2247 cleanUp() |
2238 except OSError as msg: |
2248 except OSError as msg: |
2239 sys.stderr.write("Error: {0}\nTry install as root.\n".format(msg)) |
2249 sys.stderr.write("\nError: {0}\nTry install as root.\n".format(msg)) |
2240 exit(7) |
2250 exit(7) |
|
2251 print(" Done") |
2241 |
2252 |
2242 # Create a config file and delete the default one |
2253 # Create a config file and delete the default one |
2243 print("\nCreating configuration file ...") |
2254 print("Creating configuration file ...", end="") |
2244 createConfig() |
2255 createConfig() |
2245 |
2256 print(" Done") |
|
2257 |
|
2258 # Create an install info file |
|
2259 print("Creating an install info file ...", end="") |
2246 createInstallInfo() |
2260 createInstallInfo() |
|
2261 print(" Done") |
2247 |
2262 |
2248 # Compile .ui files |
2263 # Compile .ui files |
2249 print("\nCompiling user interface files ...") |
2264 print("Compiling user interface files ...", end="") |
2250 # step 1: remove old Ui_*.py files |
2265 # step 1: remove old Ui_*.py files |
2251 for root, _, files in os.walk(sourceDir): |
2266 for root, _, files in os.walk(sourceDir): |
2252 for file in [f for f in files if fnmatch.fnmatch(f, "Ui_*.py")]: |
2267 for file in [f for f in files if fnmatch.fnmatch(f, "Ui_*.py")]: |
2253 os.remove(os.path.join(root, file)) |
2268 os.remove(os.path.join(root, file)) |
2254 # step 2: compile the forms |
2269 # step 2: compile the forms |
2255 compileUiFiles() |
2270 compileUiFiles() |
|
2271 print(" Done") |
2256 |
2272 |
2257 if doCompile: |
2273 if doCompile: |
2258 print("\nCompiling source files ...") |
2274 print("Compiling source files ...", end="") |
2259 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]") |
2275 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]") |
2260 sys.stdout = io.StringIO() |
2276 sys.stdout = io.StringIO() |
2261 if distDir: |
2277 if distDir: |
2262 compileall.compile_dir( |
2278 compileall.compile_dir( |
2263 eric7SourceDir, |
2279 eric7SourceDir, |
2275 rx=skipRe, |
2291 rx=skipRe, |
2276 quiet=True, |
2292 quiet=True, |
2277 ) |
2293 ) |
2278 py_compile.compile(configName, dfile=os.path.join(modDir, "eric7config.py")) |
2294 py_compile.compile(configName, dfile=os.path.join(modDir, "eric7config.py")) |
2279 sys.stdout = sys.__stdout__ |
2295 sys.stdout = sys.__stdout__ |
2280 print("\nInstalling eric ...") |
2296 print(" Done") |
|
2297 |
|
2298 print("Installing eric ...", end="") |
2281 res = installEric() |
2299 res = installEric() |
|
2300 print(" Done") |
2282 |
2301 |
2283 if createInstallInfoFile: |
2302 if createInstallInfoFile: |
2284 with open( |
2303 with open( |
2285 os.path.join(cfg["ericDir"], installInfoName), "w" |
2304 os.path.join(cfg["ericDir"], installInfoName), "w" |
2286 ) as installInfoFile: |
2305 ) as installInfoFile: |