43 yes2All = False |
43 yes2All = False |
44 ignorePyqt5Tools = False |
44 ignorePyqt5Tools = False |
45 cfg = {} |
45 cfg = {} |
46 progLanguages = ["Python", "Ruby", "QSS"] |
46 progLanguages = ["Python", "Ruby", "QSS"] |
47 sourceDir = "eric" |
47 sourceDir = "eric" |
48 eric6SourceDir = os.path.join(sourceDir, "eric6") |
48 eric7SourceDir = os.path.join(sourceDir, "eric7") |
49 configName = 'eric6config.py' |
49 configName = 'eric7config.py' |
50 defaultMacAppBundleName = "eric6.app" |
50 defaultMacAppBundleName = "eric7.app" |
51 defaultMacAppBundlePath = "/Applications" |
51 defaultMacAppBundlePath = "/Applications" |
52 defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( |
52 defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( |
53 sys.exec_prefix) |
53 sys.exec_prefix) |
54 if not os.path.exists(defaultMacPythonExe): |
54 if not os.path.exists(defaultMacPythonExe): |
55 defaultMacPythonExe = "" |
55 defaultMacPythonExe = "" |
56 macAppBundleName = defaultMacAppBundleName |
56 macAppBundleName = defaultMacAppBundleName |
57 macAppBundlePath = defaultMacAppBundlePath |
57 macAppBundlePath = defaultMacAppBundlePath |
58 macPythonExe = defaultMacPythonExe |
58 macPythonExe = defaultMacPythonExe |
59 |
59 |
60 createInstallInfoFile = True |
60 createInstallInfoFile = True |
61 installInfoName = "eric6install.json" |
61 installInfoName = "eric7install.json" |
62 installInfo = {} |
62 installInfo = {} |
63 installCwd = "" |
63 installCwd = "" |
64 |
64 |
65 # Define blacklisted versions of the prerequisites |
65 # Define blacklisted versions of the prerequisites |
66 BlackLists = { |
66 BlackLists = { |
504 elif sys.platform.startswith(("win", "cygwin")): |
504 elif sys.platform.startswith(("win", "cygwin")): |
505 cleanUpWindowsLinks() |
505 cleanUpWindowsLinks() |
506 |
506 |
507 # Remove the wrapper scripts |
507 # Remove the wrapper scripts |
508 rem_wnames = [ |
508 rem_wnames = [ |
509 "eric6_api", "eric6_compare", |
509 "eric7_api", "eric7_compare", |
510 "eric6_configure", "eric6_diff", |
510 "eric7_configure", "eric7_diff", |
511 "eric6_doc", "eric6_qregularexpression", |
511 "eric7_doc", "eric7_qregularexpression", |
512 "eric6_qregexp", "eric6_re", |
512 "eric7_qregexp", "eric7_re", |
513 "eric6_trpreviewer", "eric6_uipreviewer", |
513 "eric7_trpreviewer", "eric7_uipreviewer", |
514 "eric6_unittest", "eric6", |
514 "eric7_unittest", "eric7", |
515 "eric6_tray", "eric6_editor", |
515 "eric7_tray", "eric7_editor", |
516 "eric6_plugininstall", "eric6_pluginuninstall", |
516 "eric7_plugininstall", "eric7_pluginuninstall", |
517 "eric6_pluginrepository", "eric6_sqlbrowser", |
517 "eric7_pluginrepository", "eric7_sqlbrowser", |
518 "eric6_iconeditor", "eric6_snap", "eric6_hexeditor", |
518 "eric7_iconeditor", "eric7_snap", "eric7_hexeditor", |
519 "eric6_browser", "eric6_shell", |
519 "eric7_browser", "eric7_shell", |
520 # from Python2 era |
520 # from Python2 era |
521 "eric6_webbrowser", |
521 "eric7_webbrowser", |
522 ] |
522 ] |
523 |
523 |
524 try: |
524 try: |
525 dirs = [platBinDir, getConfig('bindir')] |
525 dirs = [platBinDir, getConfig('bindir')] |
526 if platBinDirOld: |
526 if platBinDirOld: |
581 """ |
581 """ |
582 Clean up Linux specific files. |
582 Clean up Linux specific files. |
583 """ |
583 """ |
584 if os.getuid() == 0: |
584 if os.getuid() == 0: |
585 for name in [ |
585 for name in [ |
586 "/usr/share/applications/eric6.desktop", |
586 "/usr/share/applications/eric7.desktop", |
587 "/usr/share/appdata/eric6.appdata.xml", |
587 "/usr/share/appdata/eric7.appdata.xml", |
588 "/usr/share/metainfo/eric6.appdata.xml", |
588 "/usr/share/metainfo/eric7.appdata.xml", |
589 "/usr/share/applications/eric6_browser.desktop", |
589 "/usr/share/applications/eric7_browser.desktop", |
590 "/usr/share/pixmaps/eric.png", |
590 "/usr/share/pixmaps/eric.png", |
591 "/usr/share/pixmaps/ericWeb.png", |
591 "/usr/share/pixmaps/ericWeb.png", |
592 "/usr/share/icons/eric.png", |
592 "/usr/share/icons/eric.png", |
593 "/usr/share/icons/ericWeb.png", |
593 "/usr/share/icons/ericWeb.png", |
594 # from Python2 era |
594 # from Python2 era |
595 "/usr/share/applications/eric6_webbrowser.desktop", |
595 "/usr/share/applications/eric7_webbrowser.desktop", |
596 ]: |
596 ]: |
597 if os.path.exists(name): |
597 if os.path.exists(name): |
598 os.remove(name) |
598 os.remove(name) |
599 elif os.getuid() >= 1000: |
599 elif os.getuid() >= 1000: |
600 # it is assumed that user ids start at 1000 |
600 # it is assumed that user ids start at 1000 |
601 for name in [ |
601 for name in [ |
602 "~/.local/share/applications/eric6.desktop", |
602 "~/.local/share/applications/eric7.desktop", |
603 "~/.local/share/appdata/eric6.appdata.xml", |
603 "~/.local/share/appdata/eric7.appdata.xml", |
604 "~/.local/share/metainfo/eric6.appdata.xml", |
604 "~/.local/share/metainfo/eric7.appdata.xml", |
605 "~/.local/share/applications/eric6_browser.desktop", |
605 "~/.local/share/applications/eric7_browser.desktop", |
606 "~/.local/share/pixmaps/eric.png", |
606 "~/.local/share/pixmaps/eric.png", |
607 "~/.local/share/pixmaps/ericWeb.png", |
607 "~/.local/share/pixmaps/ericWeb.png", |
608 "~/.local/share/icons/eric.png", |
608 "~/.local/share/icons/eric.png", |
609 "~/.local/share/icons/ericWeb.png", |
609 "~/.local/share/icons/ericWeb.png", |
610 # from Python2 era |
610 # from Python2 era |
611 "/usr/share/applications/eric6_webbrowser.desktop", |
611 "/usr/share/applications/eric7_webbrowser.desktop", |
612 ]: |
612 ]: |
613 path = os.path.expanduser(name) |
613 path = os.path.expanduser(name) |
614 if os.path.exists(path): |
614 if os.path.exists(path): |
615 os.remove(path) |
615 os.remove(path) |
616 |
616 |
617 |
617 |
618 def cleanUpMacAppBundle(): |
618 def cleanUpMacAppBundle(): |
619 """ |
619 """ |
620 Uninstall the macOS application bundle. |
620 Uninstall the macOS application bundle. |
621 """ |
621 """ |
622 from eric6config import getConfig |
622 from eric7config import getConfig |
623 try: |
623 try: |
624 macAppBundlePath = getConfig("macAppBundlePath") |
624 macAppBundlePath = getConfig("macAppBundlePath") |
625 macAppBundleName = getConfig("macAppBundleName") |
625 macAppBundleName = getConfig("macAppBundleName") |
626 except AttributeError: |
626 except AttributeError: |
627 macAppBundlePath = defaultMacAppBundlePath |
627 macAppBundlePath = defaultMacAppBundlePath |
707 # Create the platform specific wrappers. |
707 # Create the platform specific wrappers. |
708 scriptsDir = "install_scripts" |
708 scriptsDir = "install_scripts" |
709 if not os.path.isdir(scriptsDir): |
709 if not os.path.isdir(scriptsDir): |
710 os.mkdir(scriptsDir) |
710 os.mkdir(scriptsDir) |
711 wnames = [] |
711 wnames = [] |
712 for name in ["eric6_api", "eric6_doc"]: |
712 for name in ["eric7_api", "eric7_doc"]: |
713 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir, False)) |
713 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir, False)) |
714 for name in ["eric6_compare", "eric6_configure", "eric6_diff", |
714 for name in ["eric7_compare", "eric7_configure", "eric7_diff", |
715 "eric6_editor", "eric6_hexeditor", "eric6_iconeditor", |
715 "eric7_editor", "eric7_hexeditor", "eric7_iconeditor", |
716 "eric6_plugininstall", "eric6_pluginrepository", |
716 "eric7_plugininstall", "eric7_pluginrepository", |
717 "eric6_pluginuninstall", "eric6_qregularexpression", |
717 "eric7_pluginuninstall", "eric7_qregularexpression", |
718 "eric6_re", "eric6_snap", "eric6_sqlbrowser", "eric6_tray", |
718 "eric7_re", "eric7_snap", "eric7_sqlbrowser", "eric7_tray", |
719 "eric6_trpreviewer", "eric6_uipreviewer", "eric6_unittest", |
719 "eric7_trpreviewer", "eric7_uipreviewer", "eric7_unittest", |
720 "eric6_browser", "eric6_shell", "eric6"]: |
720 "eric7_browser", "eric7_shell", "eric7"]: |
721 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir)) |
721 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir)) |
722 |
722 |
723 # set install prefix, if not None |
723 # set install prefix, if not None |
724 if distDir: |
724 if distDir: |
725 for key in list(cfg.keys()): |
725 for key in list(cfg.keys()): |
743 if os.path.exists(configName + 'c'): |
743 if os.path.exists(configName + 'c'): |
744 shutilCopy(configName + 'c', modDir) |
744 shutilCopy(configName + 'c', modDir) |
745 |
745 |
746 # copy the various parts of eric |
746 # copy the various parts of eric |
747 copyTree( |
747 copyTree( |
748 eric6SourceDir, cfg['ericDir'], |
748 eric7SourceDir, cfg['ericDir'], |
749 ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
749 ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
750 [os.path.join(sourceDir, "Examples"), |
750 [os.path.join(sourceDir, "Examples"), |
751 os.path.join(sourceDir, ".ropeproject")], |
751 os.path.join(sourceDir, ".ropeproject")], |
752 excludePatterns=["eric6config.py*"]) |
752 excludePatterns=["eric7config.py*"]) |
753 copyTree( |
753 copyTree( |
754 os.path.join(eric6SourceDir, "Plugins"), |
754 os.path.join(eric7SourceDir, "Plugins"), |
755 os.path.join(cfg['ericDir'], "Plugins"), |
755 os.path.join(cfg['ericDir'], "Plugins"), |
756 ['*.svgz', '*.svg', '*.png', '*.style', '*.tmpl', '*.txt']) |
756 ['*.svgz', '*.svg', '*.png', '*.style', '*.tmpl', '*.txt']) |
757 copyTree( |
757 copyTree( |
758 os.path.join(eric6SourceDir, "Documentation"), |
758 os.path.join(eric7SourceDir, "Documentation"), |
759 cfg['ericDocDir'], |
759 cfg['ericDocDir'], |
760 ['*.html', '*.qch']) |
760 ['*.html', '*.qch']) |
761 copyTree( |
761 copyTree( |
762 os.path.join(eric6SourceDir, "CSSs"), |
762 os.path.join(eric7SourceDir, "CSSs"), |
763 cfg['ericCSSDir'], |
763 cfg['ericCSSDir'], |
764 ['*.css']) |
764 ['*.css']) |
765 copyTree( |
765 copyTree( |
766 os.path.join(eric6SourceDir, "Styles"), |
766 os.path.join(eric7SourceDir, "Styles"), |
767 cfg['ericStylesDir'], |
767 cfg['ericStylesDir'], |
768 ['*.qss', '*.e4h', '*.e6h', '*.ehj']) |
768 ['*.qss', '*.e4h', '*.e6h', '*.ehj']) |
769 copyTree( |
769 copyTree( |
770 os.path.join(eric6SourceDir, "i18n"), |
770 os.path.join(eric7SourceDir, "i18n"), |
771 cfg['ericTranslationsDir'], |
771 cfg['ericTranslationsDir'], |
772 ['*.qm']) |
772 ['*.qm']) |
773 copyTree( |
773 copyTree( |
774 os.path.join(eric6SourceDir, "icons"), |
774 os.path.join(eric7SourceDir, "icons"), |
775 cfg['ericIconDir'], |
775 cfg['ericIconDir'], |
776 ['*.svgz', '*.svg', '*.png', 'LICENSE*.*', 'readme.txt']) |
776 ['*.svgz', '*.svg', '*.png', 'LICENSE*.*', 'readme.txt']) |
777 copyTree( |
777 copyTree( |
778 os.path.join(eric6SourceDir, "pixmaps"), |
778 os.path.join(eric7SourceDir, "pixmaps"), |
779 cfg['ericPixDir'], |
779 cfg['ericPixDir'], |
780 ['*.svgz', '*.svg', '*.png', '*.xpm', '*.ico', '*.gif']) |
780 ['*.svgz', '*.svg', '*.png', '*.xpm', '*.ico', '*.gif']) |
781 copyTree( |
781 copyTree( |
782 os.path.join(eric6SourceDir, "DesignerTemplates"), |
782 os.path.join(eric7SourceDir, "DesignerTemplates"), |
783 cfg['ericTemplatesDir'], |
783 cfg['ericTemplatesDir'], |
784 ['*.tmpl']) |
784 ['*.tmpl']) |
785 copyTree( |
785 copyTree( |
786 os.path.join(eric6SourceDir, "CodeTemplates"), |
786 os.path.join(eric7SourceDir, "CodeTemplates"), |
787 cfg['ericCodeTemplatesDir'], |
787 cfg['ericCodeTemplatesDir'], |
788 ['*.tmpl']) |
788 ['*.tmpl']) |
789 |
789 |
790 # copy some data files needed at various places |
790 # copy some data files needed at various places |
791 copyTree( |
791 copyTree( |
792 os.path.join(eric6SourceDir, "E5Network", "data"), |
792 os.path.join(eric7SourceDir, "E5Network", "data"), |
793 os.path.join(cfg['ericDir'], "E5Network", "data"), |
793 os.path.join(cfg['ericDir'], "E5Network", "data"), |
794 ['*.dat', '*.txt']) |
794 ['*.dat', '*.txt']) |
795 copyTree( |
795 copyTree( |
796 os.path.join(eric6SourceDir, "IconEditor", "cursors"), |
796 os.path.join(eric7SourceDir, "IconEditor", "cursors"), |
797 os.path.join(cfg['ericDir'], "IconEditor", "cursors"), |
797 os.path.join(cfg['ericDir'], "IconEditor", "cursors"), |
798 ['*.xpm']) |
798 ['*.xpm']) |
799 copyTree( |
799 copyTree( |
800 os.path.join(eric6SourceDir, "UI", "data"), |
800 os.path.join(eric7SourceDir, "UI", "data"), |
801 os.path.join(cfg['ericDir'], "UI", "data"), |
801 os.path.join(cfg['ericDir'], "UI", "data"), |
802 ['*.css']) |
802 ['*.css']) |
803 copyTree( |
803 copyTree( |
804 os.path.join(eric6SourceDir, "WebBrowser"), |
804 os.path.join(eric7SourceDir, "WebBrowser"), |
805 os.path.join(cfg['ericDir'], "WebBrowser"), |
805 os.path.join(cfg['ericDir'], "WebBrowser"), |
806 ['*.xbel', '*.xml', '*.html', '*.png', '*.gif', '*.js']) |
806 ['*.xbel', '*.xml', '*.html', '*.png', '*.gif', '*.js']) |
807 |
807 |
808 # copy the wrappers |
808 # copy the wrappers |
809 for wname in wnames: |
809 for wname in wnames: |
853 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
853 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
854 print("Installing {0} API files to '{1}'.".format( |
854 print("Installing {0} API files to '{1}'.".format( |
855 progLanguage, apidir)) |
855 progLanguage, apidir)) |
856 if not os.path.exists(apidir): |
856 if not os.path.exists(apidir): |
857 os.makedirs(apidir) |
857 os.makedirs(apidir) |
858 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
858 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
859 progLanguage, "*.api")): |
859 progLanguage, "*.api")): |
860 try: |
860 try: |
861 shutilCopy(apiName, apidir) |
861 shutilCopy(apiName, apidir) |
862 except OSError: |
862 except OSError: |
863 print("Could not install '{0}' (no permission)." |
863 print("Could not install '{0}' (no permission)." |
864 .format(apiName)) |
864 .format(apiName)) |
865 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
865 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
866 progLanguage, "*.bas")): |
866 progLanguage, "*.bas")): |
867 try: |
867 try: |
868 shutilCopy(apiName, apidir) |
868 shutilCopy(apiName, apidir) |
869 except OSError: |
869 except OSError: |
870 print("Could not install '{0}' (no permission)." |
870 print("Could not install '{0}' (no permission)." |
871 .format(apiName)) |
871 .format(apiName)) |
872 if progLanguage == "Python": |
872 if progLanguage == "Python": |
873 # copy Python3 API files to the same destination |
873 # copy Python3 API files to the same destination |
874 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
874 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
875 "Python3", "*.api")): |
875 "Python3", "*.api")): |
876 try: |
876 try: |
877 shutilCopy(apiName, apidir) |
877 shutilCopy(apiName, apidir) |
878 except OSError: |
878 except OSError: |
879 print("Could not install '{0}' (no permission)." |
879 print("Could not install '{0}' (no permission)." |
880 .format(apiName)) |
880 .format(apiName)) |
881 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
881 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
882 "Python3", "*.bas")): |
882 "Python3", "*.bas")): |
883 if os.path.exists(os.path.join( |
883 if os.path.exists(os.path.join( |
884 apidir, os.path.basename( |
884 apidir, os.path.basename( |
885 apiName.replace(".bas", ".api")))): |
885 apiName.replace(".bas", ".api")))): |
886 try: |
886 try: |
888 except OSError: |
888 except OSError: |
889 print("Could not install '{0}' (no permission)." |
889 print("Could not install '{0}' (no permission)." |
890 .format(apiName)) |
890 .format(apiName)) |
891 |
891 |
892 # copy MicroPython API files to the same destination |
892 # copy MicroPython API files to the same destination |
893 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
893 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
894 "MicroPython", "*.api")): |
894 "MicroPython", "*.api")): |
895 try: |
895 try: |
896 shutilCopy(apiName, apidir) |
896 shutilCopy(apiName, apidir) |
897 except OSError: |
897 except OSError: |
898 print("Could not install '{0}' (no permission)." |
898 print("Could not install '{0}' (no permission)." |
899 .format(apiName)) |
899 .format(apiName)) |
900 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
900 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
901 "MicroPython", "*.bas")): |
901 "MicroPython", "*.bas")): |
902 if os.path.exists(os.path.join( |
902 if os.path.exists(os.path.join( |
903 apidir, os.path.basename( |
903 apidir, os.path.basename( |
904 apiName.replace(".bas", ".api")))): |
904 apiName.replace(".bas", ".api")))): |
905 try: |
905 try: |
932 if distDir: |
932 if distDir: |
933 dst = os.path.normpath(os.path.join(distDir, "usr/share/icons")) |
933 dst = os.path.normpath(os.path.join(distDir, "usr/share/icons")) |
934 if not os.path.exists(dst): |
934 if not os.path.exists(dst): |
935 os.makedirs(dst) |
935 os.makedirs(dst) |
936 shutilCopy( |
936 shutilCopy( |
937 os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"), |
937 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), |
938 os.path.join(dst, "eric.png")) |
938 os.path.join(dst, "eric.png")) |
939 shutilCopy( |
939 shutilCopy( |
940 os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"), |
940 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
941 os.path.join(dst, "ericWeb.png")) |
941 os.path.join(dst, "ericWeb.png")) |
942 dst = os.path.normpath( |
942 dst = os.path.normpath( |
943 os.path.join(distDir, "usr/share/applications")) |
943 os.path.join(distDir, "usr/share/applications")) |
944 if not os.path.exists(dst): |
944 if not os.path.exists(dst): |
945 os.makedirs(dst) |
945 os.makedirs(dst) |
946 copyDesktopFile(os.path.join(sourceDir, "linux", "eric6.desktop.in"), |
946 copyDesktopFile(os.path.join(sourceDir, "linux", "eric7.desktop.in"), |
947 os.path.join(dst, "eric6.desktop")) |
947 os.path.join(dst, "eric7.desktop")) |
948 copyDesktopFile( |
948 copyDesktopFile( |
949 os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"), |
949 os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), |
950 os.path.join(dst, "eric6_browser.desktop")) |
950 os.path.join(dst, "eric7_browser.desktop")) |
951 dst = os.path.normpath( |
951 dst = os.path.normpath( |
952 os.path.join(distDir, "usr/share/metainfo")) |
952 os.path.join(distDir, "usr/share/metainfo")) |
953 if not os.path.exists(dst): |
953 if not os.path.exists(dst): |
954 os.makedirs(dst) |
954 os.makedirs(dst) |
955 copyAppStreamFile( |
955 copyAppStreamFile( |
956 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
956 os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"), |
957 os.path.join(dst, "eric6.appdata.xml")) |
957 os.path.join(dst, "eric7.appdata.xml")) |
958 elif os.getuid() == 0: |
958 elif os.getuid() == 0: |
959 shutilCopy( |
959 shutilCopy( |
960 os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"), |
960 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), |
961 "/usr/share/icons/eric.png") |
961 "/usr/share/icons/eric.png") |
962 copyDesktopFile( |
962 copyDesktopFile( |
963 os.path.join(sourceDir, "linux", "eric6.desktop.in"), |
963 os.path.join(sourceDir, "linux", "eric7.desktop.in"), |
964 "/usr/share/applications/eric6.desktop") |
964 "/usr/share/applications/eric7.desktop") |
965 if os.path.exists("/usr/share/metainfo"): |
965 if os.path.exists("/usr/share/metainfo"): |
966 copyAppStreamFile( |
966 copyAppStreamFile( |
967 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
967 os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"), |
968 "/usr/share/metainfo/eric6.appdata.xml") |
968 "/usr/share/metainfo/eric7.appdata.xml") |
969 elif os.path.exists("/usr/share/appdata"): |
969 elif os.path.exists("/usr/share/appdata"): |
970 copyAppStreamFile( |
970 copyAppStreamFile( |
971 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
971 os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"), |
972 "/usr/share/appdata/eric6.appdata.xml") |
972 "/usr/share/appdata/eric7.appdata.xml") |
973 shutilCopy( |
973 shutilCopy( |
974 os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"), |
974 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
975 "/usr/share/icons/ericWeb.png") |
975 "/usr/share/icons/ericWeb.png") |
976 copyDesktopFile( |
976 copyDesktopFile( |
977 os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"), |
977 os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), |
978 "/usr/share/applications/eric6_browser.desktop") |
978 "/usr/share/applications/eric7_browser.desktop") |
979 elif os.getuid() >= 1000: |
979 elif os.getuid() >= 1000: |
980 # it is assumed, that user ids start at 1000 |
980 # it is assumed, that user ids start at 1000 |
981 localPath = os.path.join(os.path.expanduser("~"), |
981 localPath = os.path.join(os.path.expanduser("~"), |
982 ".local", "share") |
982 ".local", "share") |
983 # create directories first |
983 # create directories first |
986 "metainfo", "appdata")]: |
986 "metainfo", "appdata")]: |
987 if not os.path.isdir(directory): |
987 if not os.path.isdir(directory): |
988 os.makedirs(directory) |
988 os.makedirs(directory) |
989 # now copy the files |
989 # now copy the files |
990 shutilCopy( |
990 shutilCopy( |
991 os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"), |
991 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), |
992 os.path.join(localPath, "icons", "eric.png")) |
992 os.path.join(localPath, "icons", "eric.png")) |
993 copyDesktopFile( |
993 copyDesktopFile( |
994 os.path.join(sourceDir, "linux", "eric6.desktop.in"), |
994 os.path.join(sourceDir, "linux", "eric7.desktop.in"), |
995 os.path.join(localPath, "applications", "eric6.desktop")) |
995 os.path.join(localPath, "applications", "eric7.desktop")) |
996 copyAppStreamFile( |
996 copyAppStreamFile( |
997 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
997 os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"), |
998 os.path.join(localPath, "metainfo", "eric6.appdata.xml")) |
998 os.path.join(localPath, "metainfo", "eric7.appdata.xml")) |
999 copyAppStreamFile( |
999 copyAppStreamFile( |
1000 os.path.join(sourceDir, "linux", "eric6.appdata.xml.in"), |
1000 os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"), |
1001 os.path.join(localPath, "appdata", "eric6.appdata.xml")) |
1001 os.path.join(localPath, "appdata", "eric7.appdata.xml")) |
1002 shutilCopy( |
1002 shutilCopy( |
1003 os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1003 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1004 os.path.join(localPath, "icons", "ericWeb.png")) |
1004 os.path.join(localPath, "icons", "ericWeb.png")) |
1005 copyDesktopFile( |
1005 copyDesktopFile( |
1006 os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"), |
1006 os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), |
1007 os.path.join(localPath, "applications", "eric6_browser.desktop")) |
1007 os.path.join(localPath, "applications", "eric7_browser.desktop")) |
1008 |
1008 |
1009 |
1009 |
1010 def createWindowsLinks(): |
1010 def createWindowsLinks(): |
1011 """ |
1011 """ |
1012 Create Desktop and Start Menu links. |
1012 Create Desktop and Start Menu links. |
1053 # 2. create start menu entry and shortcuts |
1053 # 2. create start menu entry and shortcuts |
1054 regName = "Programs" |
1054 regName = "Programs" |
1055 programsEntry = getWinregEntry(regName, regPath) |
1055 programsEntry = getWinregEntry(regName, regPath) |
1056 if programsEntry: |
1056 if programsEntry: |
1057 programsFolder = os.path.normpath(os.path.expandvars(programsEntry)) |
1057 programsFolder = os.path.normpath(os.path.expandvars(programsEntry)) |
1058 eric6EntryPath = os.path.join(programsFolder, windowsProgramsEntry()) |
1058 eric7EntryPath = os.path.join(programsFolder, windowsProgramsEntry()) |
1059 if not os.path.exists(eric6EntryPath): |
1059 if not os.path.exists(eric7EntryPath): |
1060 try: |
1060 try: |
1061 os.makedirs(eric6EntryPath) |
1061 os.makedirs(eric7EntryPath) |
1062 except OSError: |
1062 except OSError: |
1063 # maybe restrictions prohibited link creation |
1063 # maybe restrictions prohibited link creation |
1064 return |
1064 return |
1065 |
1065 |
1066 for linkName, targetPath, iconPath in windowsDesktopEntries(): |
1066 for linkName, targetPath, iconPath in windowsDesktopEntries(): |
1067 linkPath = os.path.join(eric6EntryPath, linkName) |
1067 linkPath = os.path.join(eric7EntryPath, linkName) |
1068 createWindowsShortcut(linkPath, targetPath, iconPath) |
1068 createWindowsShortcut(linkPath, targetPath, iconPath) |
1069 |
1069 |
1070 |
1070 |
1071 def createMacAppBundle(pydir): |
1071 def createMacAppBundle(pydir): |
1072 """ |
1072 """ |
1124 wrapper = ('''#!/bin/sh\n''' |
1124 wrapper = ('''#!/bin/sh\n''' |
1125 '''\n''' |
1125 '''\n''' |
1126 '''{0}''' |
1126 '''{0}''' |
1127 '''{1}''' |
1127 '''{1}''' |
1128 '''exec "{2}" "{3}/{4}.py" "$@"\n''' |
1128 '''exec "{2}" "{3}/{4}.py" "$@"\n''' |
1129 .format(pathLine, dyldLine, starter, pydir, "eric6")) |
1129 .format(pathLine, dyldLine, starter, pydir, "eric7")) |
1130 copyToFile(wname, wrapper) |
1130 copyToFile(wname, wrapper) |
1131 os.chmod(wname, 0o755) # secok |
1131 os.chmod(wname, 0o755) # secok |
1132 |
1132 |
1133 shutilCopy(os.path.join(eric6SourceDir, "pixmaps", "eric_2.icns"), |
1133 shutilCopy(os.path.join(eric7SourceDir, "pixmaps", "eric_2.icns"), |
1134 os.path.join(directories["icns"], "eric.icns")) |
1134 os.path.join(directories["icns"], "eric.icns")) |
1135 |
1135 |
1136 if os.path.exists(os.path.join("eric", "eric6", "UI", "Info.py")): |
1136 if os.path.exists(os.path.join("eric", "eric7", "UI", "Info.py")): |
1137 # Installing from archive |
1137 # Installing from archive |
1138 from eric.eric6.UI.Info import Version, CopyrightShort |
1138 from eric.eric7.UI.Info import Version, CopyrightShort |
1139 elif os.path.exists(os.path.join("eric6", "UI", "Info.py")): |
1139 elif os.path.exists(os.path.join("eric7", "UI", "Info.py")): |
1140 # Installing from source tree |
1140 # Installing from source tree |
1141 from eric6.UI.Info import Version, CopyrightShort |
1141 from eric7.UI.Info import Version, CopyrightShort |
1142 else: |
1142 else: |
1143 Version = "Unknown" |
1143 Version = "Unknown" |
1144 CopyrightShort = "(c) 2002 - 2021 Detlev Offenbach" |
1144 CopyrightShort = "(c) 2002 - 2021 Detlev Offenbach" |
1145 |
1145 |
1146 copyToFile( |
1146 copyToFile( |
1220 |
1220 |
1221 apis = [] |
1221 apis = [] |
1222 if installApis: |
1222 if installApis: |
1223 for progLanguage in progLanguages: |
1223 for progLanguage in progLanguages: |
1224 for apiName in sorted( |
1224 for apiName in sorted( |
1225 glob.glob(os.path.join(eric6SourceDir, "APIs", progLanguage, |
1225 glob.glob(os.path.join(eric7SourceDir, "APIs", progLanguage, |
1226 "*.api"))): |
1226 "*.api"))): |
1227 apis.append(os.path.basename(apiName)) |
1227 apis.append(os.path.basename(apiName)) |
1228 if progLanguage == "Python": |
1228 if progLanguage == "Python": |
1229 # treat Python3 API files the same as Python API files |
1229 # treat Python3 API files the same as Python API files |
1230 for apiName in sorted( |
1230 for apiName in sorted( |
1231 glob.glob(os.path.join(eric6SourceDir, "APIs", "Python3", |
1231 glob.glob(os.path.join(eric7SourceDir, "APIs", "Python3", |
1232 "*.api"))): |
1232 "*.api"))): |
1233 apis.append(os.path.basename(apiName)) |
1233 apis.append(os.path.basename(apiName)) |
1234 |
1234 |
1235 # treat MicroPython API files the same as Python API files |
1235 # treat MicroPython API files the same as Python API files |
1236 for apiName in sorted( |
1236 for apiName in sorted( |
1237 glob.glob(os.path.join(eric6SourceDir, "APIs", |
1237 glob.glob(os.path.join(eric7SourceDir, "APIs", |
1238 "MicroPython", "*.api"))): |
1238 "MicroPython", "*.api"))): |
1239 apis.append(os.path.basename(apiName)) |
1239 apis.append(os.path.basename(apiName)) |
1240 |
1240 |
1241 macConfig = ( |
1241 macConfig = ( |
1242 (""" 'macAppBundlePath': r'{0}',\n""" |
1242 (""" 'macAppBundlePath': r'{0}',\n""" |
1836 """ |
1836 """ |
1837 global cfg |
1837 global cfg |
1838 |
1838 |
1839 majorVersion, minorVersion = sys.version_info[:2] |
1839 majorVersion, minorVersion = sys.version_info[:2] |
1840 entriesTemplates = [ |
1840 entriesTemplates = [ |
1841 ("eric6 (Python {0}.{1}).lnk", |
1841 ("eric7 (Python {0}.{1}).lnk", |
1842 os.path.join(cfg["bindir"], "eric6.cmd"), |
1842 os.path.join(cfg["bindir"], "eric7.cmd"), |
1843 os.path.join(cfg["ericPixDir"], "eric6.ico")), |
1843 os.path.join(cfg["ericPixDir"], "eric7.ico")), |
1844 ("eric6 Browser (Python {0}.{1}).lnk", |
1844 ("eric7 Browser (Python {0}.{1}).lnk", |
1845 os.path.join(cfg["bindir"], "eric6_browse.cmd"), |
1845 os.path.join(cfg["bindir"], "eric7_browse.cmd"), |
1846 os.path.join(cfg["ericPixDir"], "ericWeb48.ico")), |
1846 os.path.join(cfg["ericPixDir"], "ericWeb48.ico")), |
1847 ] |
1847 ] |
1848 |
1848 |
1849 return [ |
1849 return [ |
1850 (e[0].format(majorVersion, minorVersion), e[1], e[2]) |
1850 (e[0].format(majorVersion, minorVersion), e[1], e[2]) |
1968 |
1968 |
1969 # cleanup source if installing from source |
1969 # cleanup source if installing from source |
1970 if installFromSource: |
1970 if installFromSource: |
1971 print("Cleaning up source ...") |
1971 print("Cleaning up source ...") |
1972 sourceDir = os.path.abspath("..") |
1972 sourceDir = os.path.abspath("..") |
1973 eric6SourceDir = os.path.join(sourceDir, "eric6") |
1973 eric7SourceDir = os.path.join(sourceDir, "eric7") |
1974 cleanupSource(eric6SourceDir) |
1974 cleanupSource(eric7SourceDir) |
1975 print() |
1975 print() |
1976 |
1976 |
1977 if installFromSource: |
1977 if installFromSource: |
1978 sourceDir = os.path.abspath("..") |
1978 sourceDir = os.path.abspath("..") |
1979 eric6SourceDir = os.path.join(sourceDir, "eric6") |
1979 eric7SourceDir = os.path.join(sourceDir, "eric7") |
1980 configName = os.path.join(eric6SourceDir, "eric6config.py") |
1980 configName = os.path.join(eric7SourceDir, "eric7config.py") |
1981 if os.path.exists(os.path.join(sourceDir, ".hg")): |
1981 if os.path.exists(os.path.join(sourceDir, ".hg")): |
1982 # we are installing from source with repo |
1982 # we are installing from source with repo |
1983 infoName = os.path.join(eric6SourceDir, "UI", "Info.py") |
1983 infoName = os.path.join(eric7SourceDir, "UI", "Info.py") |
1984 prepareInfoFile(infoName) |
1984 prepareInfoFile(infoName) |
1985 |
1985 |
1986 if len(cfg) == 0: |
1986 if len(cfg) == 0: |
1987 createInstallConfig() |
1987 createInstallConfig() |
1988 |
1988 |
2026 print("\nCompiling source files ...") |
2026 print("\nCompiling source files ...") |
2027 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]") |
2027 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]") |
2028 sys.stdout = io.StringIO() |
2028 sys.stdout = io.StringIO() |
2029 if distDir: |
2029 if distDir: |
2030 compileall.compile_dir( |
2030 compileall.compile_dir( |
2031 eric6SourceDir, |
2031 eric7SourceDir, |
2032 ddir=os.path.join(distDir, modDir, cfg['ericDir']), |
2032 ddir=os.path.join(distDir, modDir, cfg['ericDir']), |
2033 rx=skipRe, |
2033 rx=skipRe, |
2034 quiet=True) |
2034 quiet=True) |
2035 py_compile.compile( |
2035 py_compile.compile( |
2036 configName, |
2036 configName, |
2037 dfile=os.path.join(distDir, modDir, "eric6config.py")) |
2037 dfile=os.path.join(distDir, modDir, "eric7config.py")) |
2038 else: |
2038 else: |
2039 compileall.compile_dir( |
2039 compileall.compile_dir( |
2040 eric6SourceDir, |
2040 eric7SourceDir, |
2041 ddir=os.path.join(modDir, cfg['ericDir']), |
2041 ddir=os.path.join(modDir, cfg['ericDir']), |
2042 rx=skipRe, |
2042 rx=skipRe, |
2043 quiet=True) |
2043 quiet=True) |
2044 py_compile.compile(configName, |
2044 py_compile.compile(configName, |
2045 dfile=os.path.join(modDir, "eric6config.py")) |
2045 dfile=os.path.join(modDir, "eric7config.py")) |
2046 sys.stdout = sys.__stdout__ |
2046 sys.stdout = sys.__stdout__ |
2047 print("\nInstalling eric ...") |
2047 print("\nInstalling eric ...") |
2048 res = installEric() |
2048 res = installEric() |
2049 |
2049 |
2050 if createInstallInfoFile: |
2050 if createInstallInfoFile: |