567 Actually perform the installation steps. |
569 Actually perform the installation steps. |
568 |
570 |
569 @return result code (integer) |
571 @return result code (integer) |
570 """ |
572 """ |
571 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName |
573 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName |
572 global includePythonVariant |
574 global includePythonVariant, installApis |
573 |
575 |
574 # Create the platform specific wrappers. |
576 # Create the platform specific wrappers. |
575 wnames = [] |
577 wnames = [] |
576 for name in ["eric5_api", "eric5_doc"]: |
578 for name in ["eric5_api", "eric5_doc"]: |
577 wnames.append(createPyWrapper(cfg['ericDir'], name, False)) |
579 wnames.append(createPyWrapper(cfg['ericDir'], name, False)) |
692 except EnvironmentError: |
694 except EnvironmentError: |
693 print("Could not install '{2}{0}{1}'.".format( |
695 print("Could not install '{2}{0}{1}'.".format( |
694 os.sep, name, sourceDir)) |
696 os.sep, name, sourceDir)) |
695 |
697 |
696 # install the API file |
698 # install the API file |
697 from PyQt4.QtCore import qVersion |
699 if installApis: |
698 for progLanguage in progLanguages: |
700 for progLanguage in progLanguages: |
699 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
701 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
700 if not os.path.exists(apidir): |
702 if not os.path.exists(apidir): |
701 os.makedirs(apidir) |
703 os.makedirs(apidir) |
702 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
|
703 progLanguage, "*.api")): |
|
704 try: |
|
705 shutilCopy(apiName, apidir) |
|
706 except EnvironmentError: |
|
707 print("Could not install '{0}'.".format(apiName)) |
|
708 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
|
709 progLanguage, "*.bas")): |
|
710 try: |
|
711 shutilCopy(apiName, apidir) |
|
712 except EnvironmentError: |
|
713 print("Could not install '{0}'.".format(apiName)) |
|
714 if progLanguage == "Python": |
|
715 # copy Python3 API files to the same destination |
|
716 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
704 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
717 "Python3", "*.api")): |
705 progLanguage, "*.api")): |
718 try: |
706 try: |
719 shutilCopy(apiName, apidir) |
707 shutilCopy(apiName, apidir) |
720 except EnvironmentError: |
708 except EnvironmentError: |
721 print("Could not install '{0}'.".format(apiName)) |
709 print("Could not install '{0}'.".format(apiName)) |
722 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
710 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
723 "Python3", "*.bas")): |
711 progLanguage, "*.bas")): |
724 try: |
712 try: |
725 if os.path.basename(apiName).startswith("PyQt4"): |
713 shutilCopy(apiName, apidir) |
726 # only install the PyQt4 file matching the Qt version |
|
727 if os.path.splitext(apiName)[0].endswith( |
|
728 qVersion().split(".")[0]): |
|
729 shutilCopy(apiName, |
|
730 os.path.join(apidir, "PyQt4.bas")) |
|
731 continue |
|
732 if os.path.exists(os.path.join( |
|
733 apidir, os.path.basename( |
|
734 apiName.replace(".bas", ".api")))): |
|
735 shutilCopy(apiName, apidir) |
|
736 except EnvironmentError: |
714 except EnvironmentError: |
737 print("Could not install '{0}'.".format(apiName)) |
715 print("Could not install '{0}'.".format(apiName)) |
|
716 if progLanguage == "Python": |
|
717 # copy Python3 API files to the same destination |
|
718 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
|
719 "Python3", "*.api")): |
|
720 try: |
|
721 shutilCopy(apiName, apidir) |
|
722 except EnvironmentError: |
|
723 print("Could not install '{0}'.".format(apiName)) |
|
724 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
|
725 "Python3", "*.bas")): |
|
726 try: |
|
727 if os.path.basename(apiName).startswith("PyQt4"): |
|
728 # only install the PyQt4 file matching the |
|
729 # Qt version |
|
730 from PyQt4.QtCore import qVersion |
|
731 if os.path.splitext(apiName)[0].endswith( |
|
732 qVersion().split(".")[0]): |
|
733 shutilCopy(apiName, |
|
734 os.path.join(apidir, "PyQt4.bas")) |
|
735 continue |
|
736 if os.path.exists(os.path.join( |
|
737 apidir, os.path.basename( |
|
738 apiName.replace(".bas", ".api")))): |
|
739 shutilCopy(apiName, apidir) |
|
740 except EnvironmentError: |
|
741 print("Could not install '{0}'.".format(apiName)) |
738 |
742 |
739 # create menu entry for Linux systems |
743 # create menu entry for Linux systems |
740 if sys.platform.startswith("linux"): |
744 if sys.platform.startswith("linux"): |
741 if includePythonVariant: |
745 if includePythonVariant: |
742 marker = PythonMarkers[sys.version_info.major] |
746 marker = PythonMarkers[sys.version_info.major] |
747 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
751 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
748 if not os.path.exists(dst): |
752 if not os.path.exists(dst): |
749 os.makedirs(dst) |
753 os.makedirs(dst) |
750 shutilCopy( |
754 shutilCopy( |
751 os.path.join(sourceDir, "icons", "default", "eric.png"), |
755 os.path.join(sourceDir, "icons", "default", "eric.png"), |
752 os.path.join(dst, "eric.png")) |
756 os.path.join(dst, "eric" + marker + ".png")) |
753 shutilCopy( |
757 shutilCopy( |
754 os.path.join(sourceDir, "icons", "default", "ericWeb48.png"), |
758 os.path.join(sourceDir, "icons", "default", "ericWeb48.png"), |
755 os.path.join(dst, "ericWeb.png")) |
759 os.path.join(dst, "ericWeb" + marker + ".png")) |
756 dst = os.path.normpath( |
760 dst = os.path.normpath( |
757 os.path.join(distDir, "usr/share/applications")) |
761 os.path.join(distDir, "usr/share/applications")) |
758 if not os.path.exists(dst): |
762 if not os.path.exists(dst): |
759 os.makedirs(dst) |
763 os.makedirs(dst) |
760 copyDesktopFile(os.path.join(sourceDir, "eric5.desktop"), |
764 copyDesktopFile(os.path.join(sourceDir, "eric5.desktop"), |
773 os.path.join(dst, "eric5" + marker + ".appdata.xml"), |
777 os.path.join(dst, "eric5" + marker + ".appdata.xml"), |
774 marker) |
778 marker) |
775 elif os.getuid() == 0: |
779 elif os.getuid() == 0: |
776 shutilCopy(os.path.join( |
780 shutilCopy(os.path.join( |
777 sourceDir, "icons", "default", "eric.png"), |
781 sourceDir, "icons", "default", "eric.png"), |
778 "/usr/share/pixmaps/eric.png") |
782 "/usr/share/pixmaps/eric" + marker + ".png") |
779 copyDesktopFile( |
783 copyDesktopFile( |
780 os.path.join(sourceDir, "eric5.desktop"), |
784 os.path.join(sourceDir, "eric5.desktop"), |
781 "/usr/share/applications/eric5" + marker + ".desktop", |
785 "/usr/share/applications/eric5" + marker + ".desktop", |
782 marker) |
786 marker) |
783 if os.path.exists("/usr/share/appdata"): |
787 if os.path.exists("/usr/share/appdata"): |
785 os.path.join(sourceDir, "eric5.appdata.xml"), |
789 os.path.join(sourceDir, "eric5.appdata.xml"), |
786 "/usr/share/appdata/eric5" + marker + ".appdata.xml", |
790 "/usr/share/appdata/eric5" + marker + ".appdata.xml", |
787 marker) |
791 marker) |
788 shutilCopy(os.path.join( |
792 shutilCopy(os.path.join( |
789 sourceDir, "icons", "default", "ericWeb48.png"), |
793 sourceDir, "icons", "default", "ericWeb48.png"), |
790 "/usr/share/pixmaps/ericWeb.png") |
794 "/usr/share/pixmaps/ericWeb" + marker + ".png") |
791 copyDesktopFile( |
795 copyDesktopFile( |
792 os.path.join(sourceDir, "eric5_webbrowser.desktop"), |
796 os.path.join(sourceDir, "eric5_webbrowser.desktop"), |
793 "/usr/share/applications/eric5_webbrowser" + marker + |
797 "/usr/share/applications/eric5_webbrowser" + marker + |
794 ".desktop", |
798 ".desktop", |
795 marker) |
799 marker) |
1241 |
1245 |
1242 # Parse the command line. |
1246 # Parse the command line. |
1243 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1247 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1244 global sourceDir, configName, includePythonVariant |
1248 global sourceDir, configName, includePythonVariant |
1245 global macAppBundlePath, macAppBundleName, macPythonExe |
1249 global macAppBundlePath, macAppBundleName, macPythonExe |
|
1250 global installApis |
|
1251 |
1246 |
1252 |
1247 if sys.version_info < (2, 6, 0) or sys.version_info > (3, 9, 9): |
1253 if sys.version_info < (2, 6, 0) or sys.version_info > (3, 9, 9): |
1248 print('Sorry, eric5 requires at least Python 2.6 or ' |
1254 print('Sorry, eric5 requires at least Python 2.6 or ' |
1249 'Python 3 for running.') |
1255 'Python 3 for running.') |
1250 exit(5) |
1256 exit(5) |
1256 |
1262 |
1257 initGlobals() |
1263 initGlobals() |
1258 |
1264 |
1259 try: |
1265 try: |
1260 if sys.platform.startswith("win"): |
1266 if sys.platform.startswith("win"): |
1261 optlist, args = getopt.getopt(argv[1:], "chxyza:b:d:f:") |
1267 optlist, args = getopt.getopt( |
|
1268 argv[1:], "chxyza:b:d:f:", ["help", "noapis"]) |
1262 elif sys.platform == "darwin": |
1269 elif sys.platform == "darwin": |
1263 optlist, args = getopt.getopt(argv[1:], "chxyza:b:d:f:i:m:n:p:") |
1270 optlist, args = getopt.getopt( |
|
1271 argv[1:], "chxyza:b:d:f:i:m:n:p:", ["help", "noapis"]) |
1264 else: |
1272 else: |
1265 optlist, args = getopt.getopt(argv[1:], "chxyza:b:d:f:i:") |
1273 optlist, args = getopt.getopt( |
|
1274 argv[1:], "chxyza:b:d:f:i:", ["help", "noapis"]) |
1266 except getopt.GetoptError: |
1275 except getopt.GetoptError: |
1267 usage() |
1276 usage() |
1268 |
1277 |
1269 global platBinDir |
1278 global platBinDir |
1270 |
1279 |