140 print(" -a dir where the API files will be installed") |
141 print(" -a dir where the API files will be installed") |
141 if apisDir: |
142 if apisDir: |
142 print(" (default: {0})".format(apisDir)) |
143 print(" (default: {0})".format(apisDir)) |
143 else: |
144 else: |
144 print(" (no default value)") |
145 print(" (no default value)") |
|
146 print(" --noapis don't install API files") |
145 print(" -b dir where the binaries will be installed") |
147 print(" -b dir where the binaries will be installed") |
146 print(" (default: {0})".format(platBinDir)) |
148 print(" (default: {0})".format(platBinDir)) |
147 print(" -d dir where eric6 python files will be installed") |
149 print(" -d dir where eric6 python files will be installed") |
148 print(" (default: {0})".format(modDir)) |
150 print(" (default: {0})".format(modDir)) |
149 print(" -f file configuration file naming the various installation" |
151 print(" -f file configuration file naming the various installation" |
598 Actually perform the installation steps. |
600 Actually perform the installation steps. |
599 |
601 |
600 @return result code (integer) |
602 @return result code (integer) |
601 """ |
603 """ |
602 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName |
604 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName |
603 global includePythonVariant |
605 global includePythonVariant, installApis |
604 |
606 |
605 # Create the platform specific wrappers. |
607 # Create the platform specific wrappers. |
606 wnames = [] |
608 wnames = [] |
607 for name in ["eric6_api", "eric6_doc"]: |
609 for name in ["eric6_api", "eric6_doc"]: |
608 wnames.append(createPyWrapper(cfg['ericDir'], name, False)) |
610 wnames.append(createPyWrapper(cfg['ericDir'], name, False)) |
723 except EnvironmentError: |
725 except EnvironmentError: |
724 print("Could not install '{2}{0}{1}'.".format( |
726 print("Could not install '{2}{0}{1}'.".format( |
725 os.sep, name, sourceDir)) |
727 os.sep, name, sourceDir)) |
726 |
728 |
727 # install the API file |
729 # install the API file |
728 for progLanguage in progLanguages: |
730 if installApis: |
729 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
731 for progLanguage in progLanguages: |
730 if not os.path.exists(apidir): |
732 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
731 os.makedirs(apidir) |
733 if not os.path.exists(apidir): |
732 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
734 os.makedirs(apidir) |
733 progLanguage, "*.api")): |
|
734 try: |
|
735 shutilCopy(apiName, apidir) |
|
736 except EnvironmentError: |
|
737 print("Could not install '{0}'.".format(apiName)) |
|
738 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
|
739 progLanguage, "*.bas")): |
|
740 try: |
|
741 shutilCopy(apiName, apidir) |
|
742 except EnvironmentError: |
|
743 print("Could not install '{0}'.".format(apiName)) |
|
744 if progLanguage == "Python": |
|
745 # copy Python3 API files to the same destination |
|
746 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
735 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
747 "Python3", "*.api")): |
736 progLanguage, "*.api")): |
748 try: |
737 try: |
749 shutilCopy(apiName, apidir) |
738 shutilCopy(apiName, apidir) |
750 except EnvironmentError: |
739 except EnvironmentError: |
751 print("Could not install '{0}'.".format(apiName)) |
740 print("Could not install '{0}'.".format(apiName)) |
752 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
741 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
753 "Python3", "*.bas")): |
742 progLanguage, "*.bas")): |
754 if os.path.exists(os.path.join( |
743 try: |
755 apidir, os.path.basename( |
744 shutilCopy(apiName, apidir) |
756 apiName.replace(".bas", ".api")))): |
745 except EnvironmentError: |
|
746 print("Could not install '{0}'.".format(apiName)) |
|
747 if progLanguage == "Python": |
|
748 # copy Python3 API files to the same destination |
|
749 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
|
750 "Python3", "*.api")): |
757 try: |
751 try: |
758 shutilCopy(apiName, apidir) |
752 shutilCopy(apiName, apidir) |
759 except EnvironmentError: |
753 except EnvironmentError: |
760 print("Could not install '{0}'.".format(apiName)) |
754 print("Could not install '{0}'.".format(apiName)) |
|
755 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
|
756 "Python3", "*.bas")): |
|
757 if os.path.exists(os.path.join( |
|
758 apidir, os.path.basename( |
|
759 apiName.replace(".bas", ".api")))): |
|
760 try: |
|
761 shutilCopy(apiName, apidir) |
|
762 except EnvironmentError: |
|
763 print("Could not install '{0}'.".format(apiName)) |
761 |
764 |
762 # create menu entry for Linux systems |
765 # create menu entry for Linux systems |
763 if sys.platform.startswith("linux"): |
766 if sys.platform.startswith("linux"): |
764 if includePythonVariant: |
767 if includePythonVariant: |
765 marker = PythonMarkers[sys.version_info.major] |
768 marker = PythonMarkers[sys.version_info.major] |
770 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
773 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
771 if not os.path.exists(dst): |
774 if not os.path.exists(dst): |
772 os.makedirs(dst) |
775 os.makedirs(dst) |
773 shutilCopy( |
776 shutilCopy( |
774 os.path.join(sourceDir, "icons", "default", "eric.png"), |
777 os.path.join(sourceDir, "icons", "default", "eric.png"), |
775 os.path.join(dst, "eric.png")) |
778 os.path.join(dst, "eric" + marker + ".png")) |
776 shutilCopy( |
779 shutilCopy( |
777 os.path.join(sourceDir, "icons", "default", "ericWeb48.png"), |
780 os.path.join(sourceDir, "icons", "default", "ericWeb48.png"), |
778 os.path.join(dst, "ericWeb.png")) |
781 os.path.join(dst, "ericWeb" + marker + ".png")) |
779 dst = os.path.normpath( |
782 dst = os.path.normpath( |
780 os.path.join(distDir, "usr/share/applications")) |
783 os.path.join(distDir, "usr/share/applications")) |
781 if not os.path.exists(dst): |
784 if not os.path.exists(dst): |
782 os.makedirs(dst) |
785 os.makedirs(dst) |
783 copyDesktopFile(os.path.join(sourceDir, "eric6.desktop"), |
786 copyDesktopFile(os.path.join(sourceDir, "eric6.desktop"), |
796 os.path.join(dst, "eric6" + marker + ".appdata.xml"), |
799 os.path.join(dst, "eric6" + marker + ".appdata.xml"), |
797 marker) |
800 marker) |
798 elif os.getuid() == 0: |
801 elif os.getuid() == 0: |
799 shutilCopy(os.path.join( |
802 shutilCopy(os.path.join( |
800 sourceDir, "icons", "default", "eric.png"), |
803 sourceDir, "icons", "default", "eric.png"), |
801 "/usr/share/pixmaps/eric.png") |
804 "/usr/share/pixmaps/eric" + marker + ".png") |
802 copyDesktopFile( |
805 copyDesktopFile( |
803 os.path.join(sourceDir, "eric6.desktop"), |
806 os.path.join(sourceDir, "eric6.desktop"), |
804 "/usr/share/applications/eric6" + marker + ".desktop", |
807 "/usr/share/applications/eric6" + marker + ".desktop", |
805 marker) |
808 marker) |
806 if os.path.exists("/usr/share/appdata"): |
809 if os.path.exists("/usr/share/appdata"): |
808 os.path.join(sourceDir, "eric6.appdata.xml"), |
811 os.path.join(sourceDir, "eric6.appdata.xml"), |
809 "/usr/share/appdata/eric6" + marker + ".appdata.xml", |
812 "/usr/share/appdata/eric6" + marker + ".appdata.xml", |
810 marker) |
813 marker) |
811 shutilCopy(os.path.join( |
814 shutilCopy(os.path.join( |
812 sourceDir, "icons", "default", "ericWeb48.png"), |
815 sourceDir, "icons", "default", "ericWeb48.png"), |
813 "/usr/share/pixmaps/ericWeb.png") |
816 "/usr/share/pixmaps/ericWeb" + marker + ".png") |
814 copyDesktopFile( |
817 copyDesktopFile( |
815 os.path.join(sourceDir, "eric6_webbrowser.desktop"), |
818 os.path.join(sourceDir, "eric6_webbrowser.desktop"), |
816 "/usr/share/applications/eric6_webbrowser" + marker + |
819 "/usr/share/applications/eric6_webbrowser" + marker + |
817 ".desktop", |
820 ".desktop", |
818 marker) |
821 marker) |
1302 |
1305 |
1303 # Parse the command line. |
1306 # Parse the command line. |
1304 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1307 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1305 global sourceDir, configName, includePythonVariant |
1308 global sourceDir, configName, includePythonVariant |
1306 global macAppBundlePath, macAppBundleName, macPythonExe |
1309 global macAppBundlePath, macAppBundleName, macPythonExe |
1307 global pyqtVariant, pyqtOverride |
1310 global pyqtVariant, pyqtOverride, installApis |
1308 |
1311 |
1309 if sys.version_info < (2, 7, 0) or sys.version_info > (3, 9, 9): |
1312 if sys.version_info < (2, 7, 0) or sys.version_info > (3, 9, 9): |
1310 print('Sorry, eric6 requires at least Python 2.7 or ' |
1313 print('Sorry, eric6 requires at least Python 2.7 or ' |
1311 'Python 3 for running.') |
1314 'Python 3 for running.') |
1312 exit(5) |
1315 exit(5) |
1320 initGlobals() |
1323 initGlobals() |
1321 |
1324 |
1322 try: |
1325 try: |
1323 if sys.platform.startswith("win"): |
1326 if sys.platform.startswith("win"): |
1324 optlist, args = getopt.getopt( |
1327 optlist, args = getopt.getopt( |
1325 argv[1:], "chxyza:b:d:f:", ["help", "pyqt="]) |
1328 argv[1:], "chxyza:b:d:f:", ["help", "pyqt=", "noapis"]) |
1326 elif sys.platform == "darwin": |
1329 elif sys.platform == "darwin": |
1327 optlist, args = getopt.getopt( |
1330 optlist, args = getopt.getopt( |
1328 argv[1:], "chxyza:b:d:f:i:m:n:p:", ["help", "pyqt="]) |
1331 argv[1:], "chxyza:b:d:f:i:m:n:p:", ["help", "pyqt=", "noapis"]) |
1329 else: |
1332 else: |
1330 optlist, args = getopt.getopt( |
1333 optlist, args = getopt.getopt( |
1331 argv[1:], "chxyza:b:d:f:i:", ["help", "pyqt="]) |
1334 argv[1:], "chxyza:b:d:f:i:", ["help", "pyqt=", "noapis"]) |
1332 except getopt.GetoptError as err: |
1335 except getopt.GetoptError as err: |
1333 print(err) |
1336 print(err) |
1334 usage() |
1337 usage() |
1335 |
1338 |
1336 global platBinDir |
1339 global platBinDir |