481 def cleanUp(): |
483 def cleanUp(): |
482 """ |
484 """ |
483 Uninstall the old eric files. |
485 Uninstall the old eric files. |
484 """ |
486 """ |
485 global platBinDir, platBinDirOld |
487 global platBinDir, platBinDirOld |
486 |
488 |
487 try: |
489 try: |
488 from eric7config import getConfig |
490 from eric7config import getConfig |
489 except ImportError: |
491 except ImportError: |
490 # eric wasn't installed previously |
492 # eric wasn't installed previously |
491 return |
493 return |
492 except SyntaxError: |
494 except SyntaxError: |
493 # an incomplete or old config file was found |
495 # an incomplete or old config file was found |
494 return |
496 return |
495 |
497 |
496 global pyModDir, progLanguages |
498 global pyModDir, progLanguages |
497 |
499 |
498 # Remove the menu entry for Linux systems |
500 # Remove the menu entry for Linux systems |
499 if sys.platform.startswith("linux"): |
501 if sys.platform.startswith("linux"): |
500 cleanUpLinuxSpecifics() |
502 cleanUpLinuxSpecifics() |
501 # Remove the Desktop and Start Menu entries for Windows systems |
503 # Remove the Desktop and Start Menu entries for Windows systems |
502 elif sys.platform.startswith(("win", "cygwin")): |
504 elif sys.platform.startswith(("win", "cygwin")): |
503 cleanUpWindowsLinks() |
505 cleanUpWindowsLinks() |
504 |
506 |
505 # Remove the wrapper scripts |
507 # Remove the wrapper scripts |
506 rem_wnames = [ |
508 rem_wnames = [ |
507 "eric7_api", "eric7_browser", "eric7_compare", "eric7_configure", |
509 "eric7_api", |
508 "eric7_diff", "eric7_doc", "eric7_editor", "eric7_hexeditor", |
510 "eric7_browser", |
509 "eric7_iconeditor", "eric7_plugininstall", "eric7_pluginrepository", |
511 "eric7_compare", |
510 "eric7_pluginuninstall", "eric7_qregularexpression", "eric7_re", |
512 "eric7_configure", |
511 "eric7_shell", "eric7_snap", "eric7_sqlbrowser", "eric7_testing", |
513 "eric7_diff", |
512 "eric7_tray", "eric7_trpreviewer", "eric7_uipreviewer", |
514 "eric7_doc", |
513 "eric7_virtualenv", "eric7", |
515 "eric7_editor", |
|
516 "eric7_hexeditor", |
|
517 "eric7_iconeditor", |
|
518 "eric7_plugininstall", |
|
519 "eric7_pluginrepository", |
|
520 "eric7_pluginuninstall", |
|
521 "eric7_qregularexpression", |
|
522 "eric7_re", |
|
523 "eric7_shell", |
|
524 "eric7_snap", |
|
525 "eric7_sqlbrowser", |
|
526 "eric7_testing", |
|
527 "eric7_tray", |
|
528 "eric7_trpreviewer", |
|
529 "eric7_uipreviewer", |
|
530 "eric7_virtualenv", |
|
531 "eric7", |
514 # obsolete scripts below |
532 # obsolete scripts below |
515 "eric7_unittest", |
533 "eric7_unittest", |
516 ] |
534 ] |
517 |
535 |
518 try: |
536 try: |
519 dirs = [platBinDir, getConfig('bindir')] |
537 dirs = [platBinDir, getConfig("bindir")] |
520 if platBinDirOld: |
538 if platBinDirOld: |
521 dirs.append(platBinDirOld) |
539 dirs.append(platBinDirOld) |
522 for rem_wname in rem_wnames: |
540 for rem_wname in rem_wnames: |
523 for d in dirs: |
541 for d in dirs: |
524 for rwname in wrapperNames(d, rem_wname): |
542 for rwname in wrapperNames(d, rem_wname): |
525 if os.path.exists(rwname): |
543 if os.path.exists(rwname): |
526 os.remove(rwname) |
544 os.remove(rwname) |
527 |
545 |
528 # Cleanup our config file(s) |
546 # Cleanup our config file(s) |
529 for name in ['eric7config.py', 'eric7config.pyc', 'eric7.pth']: |
547 for name in ["eric7config.py", "eric7config.pyc", "eric7.pth"]: |
530 e6cfile = os.path.join(pyModDir, name) |
548 e6cfile = os.path.join(pyModDir, name) |
531 if os.path.exists(e6cfile): |
549 if os.path.exists(e6cfile): |
532 os.remove(e6cfile) |
550 os.remove(e6cfile) |
533 e6cfile = os.path.join(pyModDir, "__pycache__", name) |
551 e6cfile = os.path.join(pyModDir, "__pycache__", name) |
534 path, ext = os.path.splitext(e6cfile) |
552 path, ext = os.path.splitext(e6cfile) |
535 for f in glob.glob("{0}.*{1}".format(path, ext)): |
553 for f in glob.glob("{0}.*{1}".format(path, ext)): |
536 os.remove(f) |
554 os.remove(f) |
537 |
555 |
538 # Cleanup the install directories |
556 # Cleanup the install directories |
539 for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir', |
557 for name in [ |
540 'ericCSSDir', 'ericIconDir', 'ericPixDir', |
558 "ericExamplesDir", |
541 'ericTemplatesDir', 'ericCodeTemplatesDir', |
559 "ericDocDir", |
542 'ericOthersDir', 'ericStylesDir', 'ericThemesDir', |
560 "ericDTDDir", |
543 'ericDir']: |
561 "ericCSSDir", |
|
562 "ericIconDir", |
|
563 "ericPixDir", |
|
564 "ericTemplatesDir", |
|
565 "ericCodeTemplatesDir", |
|
566 "ericOthersDir", |
|
567 "ericStylesDir", |
|
568 "ericThemesDir", |
|
569 "ericDir", |
|
570 ]: |
544 with contextlib.suppress(AttributeError): |
571 with contextlib.suppress(AttributeError): |
545 if os.path.exists(getConfig(name)): |
572 if os.path.exists(getConfig(name)): |
546 shutil.rmtree(getConfig(name), True) |
573 shutil.rmtree(getConfig(name), True) |
547 |
574 |
548 # Cleanup translations |
575 # Cleanup translations |
549 for name in glob.glob( |
576 for name in glob.glob( |
550 os.path.join(getConfig('ericTranslationsDir'), 'eric7_*.qm')): |
577 os.path.join(getConfig("ericTranslationsDir"), "eric7_*.qm") |
|
578 ): |
551 if os.path.exists(name): |
579 if os.path.exists(name): |
552 os.remove(name) |
580 os.remove(name) |
553 |
581 |
554 # Cleanup API files |
582 # Cleanup API files |
555 with contextlib.suppress(AttributeError): |
583 with contextlib.suppress(AttributeError): |
556 apidir = getConfig('apidir') |
584 apidir = getConfig("apidir") |
557 for progLanguage in progLanguages: |
585 for progLanguage in progLanguages: |
558 for name in getConfig('apis'): |
586 for name in getConfig("apis"): |
559 apiname = os.path.join(apidir, progLanguage.lower(), name) |
587 apiname = os.path.join(apidir, progLanguage.lower(), name) |
560 if os.path.exists(apiname): |
588 if os.path.exists(apiname): |
561 os.remove(apiname) |
589 os.remove(apiname) |
562 for apiname in glob.glob( |
590 for apiname in glob.glob( |
563 os.path.join(apidir, progLanguage.lower(), "*.bas")): |
591 os.path.join(apidir, progLanguage.lower(), "*.bas") |
|
592 ): |
564 if os.path.basename(apiname) != "eric7.bas": |
593 if os.path.basename(apiname) != "eric7.bas": |
565 os.remove(apiname) |
594 os.remove(apiname) |
566 |
595 |
567 if sys.platform == "darwin": |
596 if sys.platform == "darwin": |
568 # delete the Mac app bundle |
597 # delete the Mac app bundle |
569 cleanUpMacAppBundle() |
598 cleanUpMacAppBundle() |
570 except OSError as msg: |
599 except OSError as msg: |
571 sys.stderr.write( |
600 sys.stderr.write("Error: {0}\nTry install with admin rights.\n".format(msg)) |
572 'Error: {0}\nTry install with admin rights.\n'.format(msg)) |
|
573 exit(7) |
601 exit(7) |
574 |
602 |
575 |
603 |
576 def cleanUpLinuxSpecifics(): |
604 def cleanUpLinuxSpecifics(): |
577 """ |
605 """ |
690 |
716 |
691 |
717 |
692 def installEric(): |
718 def installEric(): |
693 """ |
719 """ |
694 Actually perform the installation steps. |
720 Actually perform the installation steps. |
695 |
721 |
696 @return result code (integer) |
722 @return result code (integer) |
697 """ |
723 """ |
698 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName |
724 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName |
699 global installApis |
725 global installApis |
700 |
726 |
701 # Create the platform specific wrappers. |
727 # Create the platform specific wrappers. |
702 scriptsDir = "install_scripts" |
728 scriptsDir = "install_scripts" |
703 if not os.path.isdir(scriptsDir): |
729 if not os.path.isdir(scriptsDir): |
704 os.mkdir(scriptsDir) |
730 os.mkdir(scriptsDir) |
705 wnames = [] |
731 wnames = [] |
706 for name in ["eric7_api", "eric7_doc"]: |
732 for name in ["eric7_api", "eric7_doc"]: |
707 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir, False)) |
733 wnames.append(createPyWrapper(cfg["ericDir"], name, scriptsDir, False)) |
708 for name in ["eric7_browser", "eric7_compare", "eric7_configure", |
734 for name in [ |
709 "eric7_diff", "eric7_editor", "eric7_hexeditor", |
735 "eric7_browser", |
710 "eric7_iconeditor", "eric7_plugininstall", |
736 "eric7_compare", |
711 "eric7_pluginrepository", "eric7_pluginuninstall", |
737 "eric7_configure", |
712 "eric7_qregularexpression", "eric7_re", "eric7_shell", |
738 "eric7_diff", |
713 "eric7_snap", "eric7_sqlbrowser", "eric7_tray", |
739 "eric7_editor", |
714 "eric7_trpreviewer", "eric7_uipreviewer", "eric7_testing", |
740 "eric7_hexeditor", |
715 "eric7_virtualenv", "eric7"]: |
741 "eric7_iconeditor", |
716 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir)) |
742 "eric7_plugininstall", |
717 |
743 "eric7_pluginrepository", |
|
744 "eric7_pluginuninstall", |
|
745 "eric7_qregularexpression", |
|
746 "eric7_re", |
|
747 "eric7_shell", |
|
748 "eric7_snap", |
|
749 "eric7_sqlbrowser", |
|
750 "eric7_tray", |
|
751 "eric7_trpreviewer", |
|
752 "eric7_uipreviewer", |
|
753 "eric7_testing", |
|
754 "eric7_virtualenv", |
|
755 "eric7", |
|
756 ]: |
|
757 wnames.append(createPyWrapper(cfg["ericDir"], name, scriptsDir)) |
|
758 |
718 # set install prefix, if not None |
759 # set install prefix, if not None |
719 if distDir: |
760 if distDir: |
720 for key in list(cfg.keys()): |
761 for key in list(cfg.keys()): |
721 cfg[key] = os.path.normpath( |
762 cfg[key] = os.path.normpath(os.path.join(distDir, cfg[key].lstrip(os.sep))) |
722 os.path.join(distDir, cfg[key].lstrip(os.sep))) |
763 |
723 |
|
724 try: |
764 try: |
725 # Install the files |
765 # Install the files |
726 # make the install directories |
766 # make the install directories |
727 for key in cfg: |
767 for key in cfg: |
728 if cfg[key] and not os.path.isdir(cfg[key]): |
768 if cfg[key] and not os.path.isdir(cfg[key]): |
729 os.makedirs(cfg[key]) |
769 os.makedirs(cfg[key]) |
730 |
770 |
731 # copy the eric config file |
771 # copy the eric config file |
732 if distDir: |
772 if distDir: |
733 shutilCopy(configName, cfg['mdir']) |
773 shutilCopy(configName, cfg["mdir"]) |
734 if os.path.exists(configName + 'c'): |
774 if os.path.exists(configName + "c"): |
735 shutilCopy(configName + 'c', cfg['mdir']) |
775 shutilCopy(configName + "c", cfg["mdir"]) |
736 else: |
776 else: |
737 shutilCopy(configName, modDir) |
777 shutilCopy(configName, modDir) |
738 if os.path.exists(configName + 'c'): |
778 if os.path.exists(configName + "c"): |
739 shutilCopy(configName + 'c', modDir) |
779 shutilCopy(configName + "c", modDir) |
740 |
780 |
741 # copy the various parts of eric |
781 # copy the various parts of eric |
742 copyTree( |
782 copyTree( |
743 eric7SourceDir, |
783 eric7SourceDir, |
744 cfg['ericDir'], |
784 cfg["ericDir"], |
745 ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
785 ["*.py", "*.pyc", "*.pyo", "*.pyw"], |
746 excludePatterns=["eric7config.py*"]) |
786 excludePatterns=["eric7config.py*"], |
|
787 ) |
747 copyTree( |
788 copyTree( |
748 os.path.join(eric7SourceDir, "Plugins"), |
789 os.path.join(eric7SourceDir, "Plugins"), |
749 os.path.join(cfg['ericDir'], "Plugins"), |
790 os.path.join(cfg["ericDir"], "Plugins"), |
750 ['*.svgz', '*.svg', '*.png', '*.style', '*.tmpl', '*.txt']) |
791 ["*.svgz", "*.svg", "*.png", "*.style", "*.tmpl", "*.txt"], |
|
792 ) |
751 copyTree( |
793 copyTree( |
752 os.path.join(eric7SourceDir, "Documentation"), |
794 os.path.join(eric7SourceDir, "Documentation"), |
753 cfg['ericDocDir'], |
795 cfg["ericDocDir"], |
754 ['*.html', '*.qch']) |
796 ["*.html", "*.qch"], |
755 copyTree( |
797 ) |
756 os.path.join(eric7SourceDir, "CSSs"), |
798 copyTree(os.path.join(eric7SourceDir, "CSSs"), cfg["ericCSSDir"], ["*.css"]) |
757 cfg['ericCSSDir'], |
|
758 ['*.css']) |
|
759 copyTree( |
799 copyTree( |
760 os.path.join(eric7SourceDir, "Styles"), |
800 os.path.join(eric7SourceDir, "Styles"), |
761 cfg['ericStylesDir'], |
801 cfg["ericStylesDir"], |
762 ['*.qss', '*.ehj']) |
802 ["*.qss", "*.ehj"], |
|
803 ) |
763 copyTree( |
804 copyTree( |
764 os.path.join(eric7SourceDir, "Themes"), |
805 os.path.join(eric7SourceDir, "Themes"), cfg["ericThemesDir"], ["*.ethj"] |
765 cfg['ericThemesDir'], |
806 ) |
766 ['*.ethj']) |
|
767 copyTree( |
807 copyTree( |
768 os.path.join(eric7SourceDir, "i18n"), |
808 os.path.join(eric7SourceDir, "i18n"), cfg["ericTranslationsDir"], ["*.qm"] |
769 cfg['ericTranslationsDir'], |
809 ) |
770 ['*.qm']) |
|
771 copyTree( |
810 copyTree( |
772 os.path.join(eric7SourceDir, "icons"), |
811 os.path.join(eric7SourceDir, "icons"), |
773 cfg['ericIconDir'], |
812 cfg["ericIconDir"], |
774 ['*.svgz', '*.svg', '*.png', 'LICENSE*.*', 'readme.txt']) |
813 ["*.svgz", "*.svg", "*.png", "LICENSE*.*", "readme.txt"], |
|
814 ) |
775 copyTree( |
815 copyTree( |
776 os.path.join(eric7SourceDir, "pixmaps"), |
816 os.path.join(eric7SourceDir, "pixmaps"), |
777 cfg['ericPixDir'], |
817 cfg["ericPixDir"], |
778 ['*.svgz', '*.svg', '*.png', '*.xpm', '*.ico', '*.gif']) |
818 ["*.svgz", "*.svg", "*.png", "*.xpm", "*.ico", "*.gif"], |
|
819 ) |
779 copyTree( |
820 copyTree( |
780 os.path.join(eric7SourceDir, "DesignerTemplates"), |
821 os.path.join(eric7SourceDir, "DesignerTemplates"), |
781 cfg['ericTemplatesDir'], |
822 cfg["ericTemplatesDir"], |
782 ['*.tmpl']) |
823 ["*.tmpl"], |
|
824 ) |
783 copyTree( |
825 copyTree( |
784 os.path.join(eric7SourceDir, "CodeTemplates"), |
826 os.path.join(eric7SourceDir, "CodeTemplates"), |
785 cfg['ericCodeTemplatesDir'], |
827 cfg["ericCodeTemplatesDir"], |
786 ['*.tmpl']) |
828 ["*.tmpl"], |
|
829 ) |
787 copyTree( |
830 copyTree( |
788 os.path.join(eric7SourceDir, "DebugClients", "Python", "coverage"), |
831 os.path.join(eric7SourceDir, "DebugClients", "Python", "coverage"), |
789 os.path.join(cfg['ericDir'], "DebugClients", "Python", "coverage"), |
832 os.path.join(cfg["ericDir"], "DebugClients", "Python", "coverage"), |
790 ['*.js', '*.html', '*.png', '*.css', '*.scss', '*.txt', '*.rst']) |
833 ["*.js", "*.html", "*.png", "*.css", "*.scss", "*.txt", "*.rst"], |
791 |
834 ) |
|
835 |
792 # copy some data files needed at various places |
836 # copy some data files needed at various places |
793 copyTree( |
837 copyTree( |
794 os.path.join(eric7SourceDir, "data"), |
838 os.path.join(eric7SourceDir, "data"), |
795 os.path.join(cfg['ericDir'], "data"), |
839 os.path.join(cfg["ericDir"], "data"), |
796 ['*.txt']) |
840 ["*.txt"], |
|
841 ) |
797 copyTree( |
842 copyTree( |
798 os.path.join(eric7SourceDir, "EricNetwork", "data"), |
843 os.path.join(eric7SourceDir, "EricNetwork", "data"), |
799 os.path.join(cfg['ericDir'], "EricNetwork", "data"), |
844 os.path.join(cfg["ericDir"], "EricNetwork", "data"), |
800 ['*.dat', '*.txt']) |
845 ["*.dat", "*.txt"], |
|
846 ) |
801 copyTree( |
847 copyTree( |
802 os.path.join(eric7SourceDir, "IconEditor", "cursors"), |
848 os.path.join(eric7SourceDir, "IconEditor", "cursors"), |
803 os.path.join(cfg['ericDir'], "IconEditor", "cursors"), |
849 os.path.join(cfg["ericDir"], "IconEditor", "cursors"), |
804 ['*.xpm']) |
850 ["*.xpm"], |
|
851 ) |
805 copyTree( |
852 copyTree( |
806 os.path.join(eric7SourceDir, "UI", "data"), |
853 os.path.join(eric7SourceDir, "UI", "data"), |
807 os.path.join(cfg['ericDir'], "UI", "data"), |
854 os.path.join(cfg["ericDir"], "UI", "data"), |
808 ['*.css']) |
855 ["*.css"], |
|
856 ) |
809 copyTree( |
857 copyTree( |
810 os.path.join(eric7SourceDir, "WebBrowser"), |
858 os.path.join(eric7SourceDir, "WebBrowser"), |
811 os.path.join(cfg['ericDir'], "WebBrowser"), |
859 os.path.join(cfg["ericDir"], "WebBrowser"), |
812 ['*.xbel', '*.xml', '*.html', '*.png', '*.gif', '*.js']) |
860 ["*.xbel", "*.xml", "*.html", "*.png", "*.gif", "*.js"], |
813 |
861 ) |
|
862 |
814 # copy the wrappers |
863 # copy the wrappers |
815 for wname in wnames: |
864 for wname in wnames: |
816 shutilCopy(wname, cfg['bindir'], perm=0o755) |
865 shutilCopy(wname, cfg["bindir"], perm=0o755) |
817 os.remove(wname) |
866 os.remove(wname) |
818 shutil.rmtree(scriptsDir) |
867 shutil.rmtree(scriptsDir) |
819 |
868 |
820 # copy the license file |
869 # copy the license file |
821 shutilCopy(os.path.join(sourceDir, "docs", "LICENSE.GPL3"), |
870 shutilCopy(os.path.join(sourceDir, "docs", "LICENSE.GPL3"), cfg["ericDir"]) |
822 cfg['ericDir']) |
871 |
823 |
|
824 # create the global plugins directory |
872 # create the global plugins directory |
825 createGlobalPluginsDir() |
873 createGlobalPluginsDir() |
826 |
874 |
827 except OSError as msg: |
875 except OSError as msg: |
828 sys.stderr.write( |
876 sys.stderr.write("Error: {0}\nTry install with admin rights.\n".format(msg)) |
829 'Error: {0}\nTry install with admin rights.\n'.format(msg)) |
877 return 7 |
830 return(7) |
878 |
831 |
|
832 # copy some text files to the doc area |
879 # copy some text files to the doc area |
833 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
880 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
834 try: |
881 try: |
835 shutilCopy(os.path.join(sourceDir, "docs", name), |
882 shutilCopy(os.path.join(sourceDir, "docs", name), cfg["ericDocDir"]) |
836 cfg['ericDocDir']) |
|
837 except OSError: |
883 except OSError: |
838 print("Could not install '{0}'.".format( |
884 print( |
839 os.path.join(sourceDir, "docs", name))) |
885 "Could not install '{0}'.".format(os.path.join(sourceDir, "docs", name)) |
840 for name in glob.glob(os.path.join(sourceDir, 'docs', 'README*.*')): |
886 ) |
|
887 for name in glob.glob(os.path.join(sourceDir, "docs", "README*.*")): |
841 try: |
888 try: |
842 shutilCopy(name, cfg['ericDocDir']) |
889 shutilCopy(name, cfg["ericDocDir"]) |
843 except OSError: |
890 except OSError: |
844 print("Could not install '{0}'.".format(name)) |
891 print("Could not install '{0}'.".format(name)) |
845 |
892 |
846 # copy some more stuff |
893 # copy some more stuff |
847 for name in ('default.ekj', 'default_Mac.ekj', |
894 for name in ("default.ekj", "default_Mac.ekj", "default.e4k", "default_Mac.e4k"): |
848 'default.e4k', 'default_Mac.e4k'): |
|
849 try: |
895 try: |
850 shutilCopy(os.path.join(sourceDir, "others", name), |
896 shutilCopy(os.path.join(sourceDir, "others", name), cfg["ericOthersDir"]) |
851 cfg['ericOthersDir']) |
|
852 except OSError: |
897 except OSError: |
853 print("Could not install '{0}'.".format( |
898 print( |
854 os.path.join(sourceDir, "others", name))) |
899 "Could not install '{0}'.".format( |
855 |
900 os.path.join(sourceDir, "others", name) |
|
901 ) |
|
902 ) |
|
903 |
856 # install the API file |
904 # install the API file |
857 if installApis: |
905 if installApis: |
858 for progLanguage in progLanguages: |
906 for progLanguage in progLanguages: |
859 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
907 apidir = os.path.join(cfg["apidir"], progLanguage.lower()) |
860 print("Installing {0} API files to '{1}'.".format( |
908 print("Installing {0} API files to '{1}'.".format(progLanguage, apidir)) |
861 progLanguage, apidir)) |
|
862 if not os.path.exists(apidir): |
909 if not os.path.exists(apidir): |
863 os.makedirs(apidir) |
910 os.makedirs(apidir) |
864 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
911 for apiName in glob.glob( |
865 progLanguage, "*.api")): |
912 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api") |
|
913 ): |
866 try: |
914 try: |
867 shutilCopy(apiName, apidir) |
915 shutilCopy(apiName, apidir) |
868 except OSError: |
916 except OSError: |
869 print("Could not install '{0}' (no permission)." |
917 print("Could not install '{0}' (no permission).".format(apiName)) |
870 .format(apiName)) |
918 for apiName in glob.glob( |
871 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
919 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.bas") |
872 progLanguage, "*.bas")): |
920 ): |
873 try: |
921 try: |
874 shutilCopy(apiName, apidir) |
922 shutilCopy(apiName, apidir) |
875 except OSError: |
923 except OSError: |
876 print("Could not install '{0}' (no permission)." |
924 print("Could not install '{0}' (no permission).".format(apiName)) |
877 .format(apiName)) |
|
878 if progLanguage == "Python": |
925 if progLanguage == "Python": |
879 # copy Python3 API files to the same destination |
926 # copy Python3 API files to the same destination |
880 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
927 for apiName in glob.glob( |
881 "Python3", "*.api")): |
928 os.path.join(eric7SourceDir, "APIs", "Python3", "*.api") |
|
929 ): |
882 try: |
930 try: |
883 shutilCopy(apiName, apidir) |
931 shutilCopy(apiName, apidir) |
884 except OSError: |
932 except OSError: |
885 print("Could not install '{0}' (no permission)." |
933 print( |
886 .format(apiName)) |
934 "Could not install '{0}' (no permission).".format(apiName) |
887 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
935 ) |
888 "Python3", "*.bas")): |
936 for apiName in glob.glob( |
889 if os.path.exists(os.path.join( |
937 os.path.join(eric7SourceDir, "APIs", "Python3", "*.bas") |
890 apidir, os.path.basename( |
938 ): |
891 apiName.replace(".bas", ".api")))): |
939 if os.path.exists( |
|
940 os.path.join( |
|
941 apidir, os.path.basename(apiName.replace(".bas", ".api")) |
|
942 ) |
|
943 ): |
892 try: |
944 try: |
893 shutilCopy(apiName, apidir) |
945 shutilCopy(apiName, apidir) |
894 except OSError: |
946 except OSError: |
895 print("Could not install '{0}' (no permission)." |
947 print( |
896 .format(apiName)) |
948 "Could not install '{0}' (no permission).".format( |
897 |
949 apiName |
|
950 ) |
|
951 ) |
|
952 |
898 # copy MicroPython API files to the same destination |
953 # copy MicroPython API files to the same destination |
899 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
954 for apiName in glob.glob( |
900 "MicroPython", "*.api")): |
955 os.path.join(eric7SourceDir, "APIs", "MicroPython", "*.api") |
|
956 ): |
901 try: |
957 try: |
902 shutilCopy(apiName, apidir) |
958 shutilCopy(apiName, apidir) |
903 except OSError: |
959 except OSError: |
904 print("Could not install '{0}' (no permission)." |
960 print( |
905 .format(apiName)) |
961 "Could not install '{0}' (no permission).".format(apiName) |
906 for apiName in glob.glob(os.path.join(eric7SourceDir, "APIs", |
962 ) |
907 "MicroPython", "*.bas")): |
963 for apiName in glob.glob( |
908 if os.path.exists(os.path.join( |
964 os.path.join(eric7SourceDir, "APIs", "MicroPython", "*.bas") |
909 apidir, os.path.basename( |
965 ): |
910 apiName.replace(".bas", ".api")))): |
966 if os.path.exists( |
|
967 os.path.join( |
|
968 apidir, os.path.basename(apiName.replace(".bas", ".api")) |
|
969 ) |
|
970 ): |
911 try: |
971 try: |
912 shutilCopy(apiName, apidir) |
972 shutilCopy(apiName, apidir) |
913 except OSError: |
973 except OSError: |
914 print("Could not install '{0}' (no permission)." |
974 print( |
915 .format(apiName)) |
975 "Could not install '{0}' (no permission).".format( |
916 |
976 apiName |
|
977 ) |
|
978 ) |
|
979 |
917 # Create menu entry for Linux systems |
980 # Create menu entry for Linux systems |
918 if sys.platform.startswith("linux"): |
981 if sys.platform.startswith("linux"): |
919 createLinuxSpecifics() |
982 createLinuxSpecifics() |
920 |
983 |
921 # Create Desktop and Start Menu entries for Windows systems |
984 # Create Desktop and Start Menu entries for Windows systems |
922 elif sys.platform.startswith(("win", "cygwin")): |
985 elif sys.platform.startswith(("win", "cygwin")): |
923 createWindowsLinks() |
986 createWindowsLinks() |
924 |
987 |
925 # Create a Mac application bundle |
988 # Create a Mac application bundle |
926 elif sys.platform == "darwin": |
989 elif sys.platform == "darwin": |
927 createMacAppBundle(cfg['ericDir']) |
990 createMacAppBundle(cfg["ericDir"]) |
928 |
991 |
929 return 0 |
992 return 0 |
930 |
993 |
931 |
994 |
932 def createLinuxSpecifics(): |
995 def createLinuxSpecifics(): |
933 """ |
996 """ |
934 Install Linux specific files. |
997 Install Linux specific files. |
935 """ |
998 """ |
936 global distDir, sourceDir |
999 global distDir, sourceDir |
937 |
1000 |
938 dataSourceDir = os.path.join(eric7SourceDir, "data", "linux") |
1001 dataSourceDir = os.path.join(eric7SourceDir, "data", "linux") |
939 |
1002 |
940 if distDir: |
1003 if distDir: |
941 dst = os.path.normpath(os.path.join(distDir, "usr/share/icons")) |
1004 dst = os.path.normpath(os.path.join(distDir, "usr/share/icons")) |
942 if not os.path.exists(dst): |
1005 if not os.path.exists(dst): |
943 os.makedirs(dst) |
1006 os.makedirs(dst) |
944 shutilCopy( |
1007 shutilCopy( |
945 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), |
1008 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), |
946 os.path.join(dst, "eric.png")) |
1009 os.path.join(dst, "eric.png"), |
|
1010 ) |
947 shutilCopy( |
1011 shutilCopy( |
948 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1012 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
949 os.path.join(dst, "ericWeb.png")) |
1013 os.path.join(dst, "ericWeb.png"), |
950 |
1014 ) |
|
1015 |
951 dst = os.path.normpath( |
1016 dst = os.path.normpath( |
952 os.path.join(distDir, "usr/share/icons/hicolor/48x48/apps")) |
1017 os.path.join(distDir, "usr/share/icons/hicolor/48x48/apps") |
|
1018 ) |
953 if not os.path.exists(dst): |
1019 if not os.path.exists(dst): |
954 os.makedirs(dst) |
1020 os.makedirs(dst) |
955 shutilCopy( |
1021 shutilCopy( |
956 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"), |
1022 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"), |
957 os.path.join(dst, "eric.png")) |
1023 os.path.join(dst, "eric.png"), |
|
1024 ) |
958 shutilCopy( |
1025 shutilCopy( |
959 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1026 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
960 os.path.join(dst, "ericWeb.png")) |
1027 os.path.join(dst, "ericWeb.png"), |
961 |
1028 ) |
962 dst = os.path.normpath( |
1029 |
963 os.path.join(distDir, "usr/share/applications")) |
1030 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications")) |
964 if not os.path.exists(dst): |
1031 if not os.path.exists(dst): |
965 os.makedirs(dst) |
1032 os.makedirs(dst) |
966 copyDesktopFile(os.path.join(dataSourceDir, "eric7.desktop.in"), |
1033 copyDesktopFile( |
967 os.path.join(dst, "eric7.desktop")) |
1034 os.path.join(dataSourceDir, "eric7.desktop.in"), |
|
1035 os.path.join(dst, "eric7.desktop"), |
|
1036 ) |
968 copyDesktopFile( |
1037 copyDesktopFile( |
969 os.path.join(dataSourceDir, "eric7_browser.desktop.in"), |
1038 os.path.join(dataSourceDir, "eric7_browser.desktop.in"), |
970 os.path.join(dst, "eric7_browser.desktop")) |
1039 os.path.join(dst, "eric7_browser.desktop"), |
971 |
1040 ) |
972 dst = os.path.normpath( |
1041 |
973 os.path.join(distDir, "usr/share/metainfo")) |
1042 dst = os.path.normpath(os.path.join(distDir, "usr/share/metainfo")) |
974 if not os.path.exists(dst): |
1043 if not os.path.exists(dst): |
975 os.makedirs(dst) |
1044 os.makedirs(dst) |
976 copyAppStreamFile( |
1045 copyAppStreamFile( |
977 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
1046 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
978 os.path.join(dst, "eric7.appdata.xml")) |
1047 os.path.join(dst, "eric7.appdata.xml"), |
|
1048 ) |
979 elif os.getuid() == 0: |
1049 elif os.getuid() == 0: |
980 shutilCopy( |
1050 shutilCopy( |
981 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), |
1051 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), |
982 "/usr/share/icons/eric.png") |
1052 "/usr/share/icons/eric.png", |
|
1053 ) |
983 shutilCopy( |
1054 shutilCopy( |
984 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"), |
1055 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"), |
985 "/usr/share/icons/hicolor/48x48/apps/eric.png") |
1056 "/usr/share/icons/hicolor/48x48/apps/eric.png", |
|
1057 ) |
986 copyDesktopFile( |
1058 copyDesktopFile( |
987 os.path.join(dataSourceDir, "eric7.desktop.in"), |
1059 os.path.join(dataSourceDir, "eric7.desktop.in"), |
988 "/usr/share/applications/eric7.desktop") |
1060 "/usr/share/applications/eric7.desktop", |
|
1061 ) |
989 if os.path.exists("/usr/share/metainfo"): |
1062 if os.path.exists("/usr/share/metainfo"): |
990 copyAppStreamFile( |
1063 copyAppStreamFile( |
991 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
1064 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
992 "/usr/share/metainfo/eric7.appdata.xml") |
1065 "/usr/share/metainfo/eric7.appdata.xml", |
|
1066 ) |
993 elif os.path.exists("/usr/share/appdata"): |
1067 elif os.path.exists("/usr/share/appdata"): |
994 copyAppStreamFile( |
1068 copyAppStreamFile( |
995 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
1069 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
996 "/usr/share/appdata/eric7.appdata.xml") |
1070 "/usr/share/appdata/eric7.appdata.xml", |
|
1071 ) |
997 shutilCopy( |
1072 shutilCopy( |
998 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1073 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
999 "/usr/share/icons/ericWeb.png") |
1074 "/usr/share/icons/ericWeb.png", |
|
1075 ) |
1000 shutilCopy( |
1076 shutilCopy( |
1001 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1077 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1002 "/usr/share/icons/hicolor/48x48/apps/ericWeb.png") |
1078 "/usr/share/icons/hicolor/48x48/apps/ericWeb.png", |
|
1079 ) |
1003 copyDesktopFile( |
1080 copyDesktopFile( |
1004 os.path.join(dataSourceDir, "eric7_browser.desktop.in"), |
1081 os.path.join(dataSourceDir, "eric7_browser.desktop.in"), |
1005 "/usr/share/applications/eric7_browser.desktop") |
1082 "/usr/share/applications/eric7_browser.desktop", |
|
1083 ) |
1006 elif os.getuid() >= 1000: |
1084 elif os.getuid() >= 1000: |
1007 # it is assumed, that user ids start at 1000 |
1085 # it is assumed, that user ids start at 1000 |
1008 localPath = os.path.join(os.path.expanduser("~"), |
1086 localPath = os.path.join(os.path.expanduser("~"), ".local", "share") |
1009 ".local", "share") |
|
1010 # create directories first |
1087 # create directories first |
1011 for directory in [os.path.join(localPath, name) |
1088 for directory in [ |
1012 for name in ("icons", "icons/hicolor/48x48/apps", |
1089 os.path.join(localPath, name) |
1013 "applications", "metainfo", "appdata")]: |
1090 for name in ( |
|
1091 "icons", |
|
1092 "icons/hicolor/48x48/apps", |
|
1093 "applications", |
|
1094 "metainfo", |
|
1095 "appdata", |
|
1096 ) |
|
1097 ]: |
1014 if not os.path.isdir(directory): |
1098 if not os.path.isdir(directory): |
1015 os.makedirs(directory) |
1099 os.makedirs(directory) |
1016 # now copy the files |
1100 # now copy the files |
1017 shutilCopy( |
1101 shutilCopy( |
1018 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), |
1102 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), |
1019 os.path.join(localPath, "icons", "eric.png")) |
1103 os.path.join(localPath, "icons", "eric.png"), |
|
1104 ) |
1020 shutilCopy( |
1105 shutilCopy( |
1021 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"), |
1106 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"), |
1022 os.path.join(localPath, "icons/hicolor/48x48/apps", "eric.png")) |
1107 os.path.join(localPath, "icons/hicolor/48x48/apps", "eric.png"), |
|
1108 ) |
1023 copyDesktopFile( |
1109 copyDesktopFile( |
1024 os.path.join(dataSourceDir, "eric7.desktop.in"), |
1110 os.path.join(dataSourceDir, "eric7.desktop.in"), |
1025 os.path.join(localPath, "applications", "eric7.desktop")) |
1111 os.path.join(localPath, "applications", "eric7.desktop"), |
|
1112 ) |
1026 copyAppStreamFile( |
1113 copyAppStreamFile( |
1027 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
1114 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
1028 os.path.join(localPath, "metainfo", "eric7.appdata.xml")) |
1115 os.path.join(localPath, "metainfo", "eric7.appdata.xml"), |
|
1116 ) |
1029 copyAppStreamFile( |
1117 copyAppStreamFile( |
1030 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
1118 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), |
1031 os.path.join(localPath, "appdata", "eric7.appdata.xml")) |
1119 os.path.join(localPath, "appdata", "eric7.appdata.xml"), |
|
1120 ) |
1032 shutilCopy( |
1121 shutilCopy( |
1033 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1122 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1034 os.path.join(localPath, "icons", "ericWeb.png")) |
1123 os.path.join(localPath, "icons", "ericWeb.png"), |
|
1124 ) |
1035 shutilCopy( |
1125 shutilCopy( |
1036 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1126 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), |
1037 os.path.join(localPath, "icons/hicolor/48x48/apps", "ericWeb.png")) |
1127 os.path.join(localPath, "icons/hicolor/48x48/apps", "ericWeb.png"), |
|
1128 ) |
1038 copyDesktopFile( |
1129 copyDesktopFile( |
1039 os.path.join(dataSourceDir, "eric7_browser.desktop.in"), |
1130 os.path.join(dataSourceDir, "eric7_browser.desktop.in"), |
1040 os.path.join(localPath, "applications", |
1131 os.path.join(localPath, "applications", "eric7_browser.desktop"), |
1041 "eric7_browser.desktop")) |
1132 ) |
1042 |
1133 |
1043 |
1134 |
1044 def createWindowsLinks(): |
1135 def createWindowsLinks(): |
1045 """ |
1136 """ |
1046 Create Desktop and Start Menu links. |
1137 Create Desktop and Start Menu links. |
1047 """ |
1138 """ |
1048 try: |
1139 try: |
1049 # check, if pywin32 is available |
1140 # check, if pywin32 is available |
1050 from win32com.client import Dispatch # __IGNORE_WARNING__ |
1141 from win32com.client import Dispatch # __IGNORE_WARNING__ |
1051 except ImportError: |
1142 except ImportError: |
1052 installed = pipInstall( |
1143 installed = pipInstall( |
1053 "pywin32", |
1144 "pywin32", |
1054 "\nThe Python package 'pywin32' could not be imported.", |
1145 "\nThe Python package 'pywin32' could not be imported.", |
1055 force=False |
1146 force=False, |
1056 ) |
1147 ) |
1057 if installed: |
1148 if installed: |
1058 # create the links via an external script to get around some |
1149 # create the links via an external script to get around some |
1059 # startup magic done by pywin32.pth |
1150 # startup magic done by pywin32.pth |
1060 args = [ |
1151 args = [ |
1061 sys.executable, |
1152 sys.executable, |
1062 os.path.join(os.path.dirname(__file__), |
1153 os.path.join(os.path.dirname(__file__), "create_windows_links.py"), |
1063 "create_windows_links.py"), |
|
1064 ] |
1154 ] |
1065 subprocess.run(args) # secok |
1155 subprocess.run(args) # secok |
1066 else: |
1156 else: |
1067 print( |
1157 print( |
1068 "\nThe Python package 'pywin32' is not installed. Desktop and" |
1158 "\nThe Python package 'pywin32' is not installed. Desktop and" |
1069 " Start Menu entries will not be created." |
1159 " Start Menu entries will not be created." |
1070 ) |
1160 ) |
1071 return |
1161 return |
1072 |
1162 |
1073 regPath = ( |
1163 regPath = ( |
1074 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" + |
1164 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" |
1075 "\\User Shell Folders" |
1165 + "\\User Shell Folders" |
1076 ) |
1166 ) |
1077 |
1167 |
1078 # 1. create desktop shortcuts |
1168 # 1. create desktop shortcuts |
1079 regName = "Desktop" |
1169 regName = "Desktop" |
1080 desktopEntry = getWinregEntry(regName, regPath) |
1170 desktopEntry = getWinregEntry(regName, regPath) |
1081 if desktopEntry: |
1171 if desktopEntry: |
1082 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry)) |
1172 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry)) |
1083 for linkName, targetPath, iconPath in windowsDesktopEntries(): |
1173 for linkName, targetPath, iconPath in windowsDesktopEntries(): |
1084 linkPath = os.path.join(desktopFolder, linkName) |
1174 linkPath = os.path.join(desktopFolder, linkName) |
1085 createWindowsShortcut(linkPath, targetPath, iconPath) |
1175 createWindowsShortcut(linkPath, targetPath, iconPath) |
1086 |
1176 |
1087 # 2. create start menu entry and shortcuts |
1177 # 2. create start menu entry and shortcuts |
1088 regName = "Programs" |
1178 regName = "Programs" |
1089 programsEntry = getWinregEntry(regName, regPath) |
1179 programsEntry = getWinregEntry(regName, regPath) |
1090 if programsEntry: |
1180 if programsEntry: |
1091 programsFolder = os.path.normpath(os.path.expandvars(programsEntry)) |
1181 programsFolder = os.path.normpath(os.path.expandvars(programsEntry)) |
1152 pathlist_n = [pybin] |
1239 pathlist_n = [pybin] |
1153 for path_ in pathlist: |
1240 for path_ in pathlist: |
1154 if path_ and path_ not in pathlist_n: |
1241 if path_ and path_ not in pathlist_n: |
1155 pathlist_n.append(path_) |
1242 pathlist_n.append(path_) |
1156 pathLine = "PATH={0}\n".format(os.pathsep.join(pathlist_n)) |
1243 pathLine = "PATH={0}\n".format(os.pathsep.join(pathlist_n)) |
1157 |
1244 |
1158 # create the wrapper script |
1245 # create the wrapper script |
1159 wrapper = ('''#!/bin/sh\n''' |
1246 wrapper = ( |
1160 '''\n''' |
1247 """#!/bin/sh\n""" |
1161 '''{0}''' |
1248 """\n""" |
1162 '''{1}''' |
1249 """{0}""" |
1163 '''exec "{2}" "{3}/{4}.py" "$@"\n''' |
1250 """{1}""" |
1164 .format(pathLine, dyldLine, starter, pydir, "eric7")) |
1251 """exec "{2}" "{3}/{4}.py" "$@"\n""".format( |
|
1252 pathLine, dyldLine, starter, pydir, "eric7" |
|
1253 ) |
|
1254 ) |
1165 copyToFile(wname, wrapper) |
1255 copyToFile(wname, wrapper) |
1166 os.chmod(wname, 0o755) # secok |
1256 os.chmod(wname, 0o755) # secok |
1167 |
1257 |
1168 shutilCopy(os.path.join(eric7SourceDir, "pixmaps", "eric_2.icns"), |
1258 shutilCopy( |
1169 os.path.join(directories["icns"], "eric.icns")) |
1259 os.path.join(eric7SourceDir, "pixmaps", "eric_2.icns"), |
1170 |
1260 os.path.join(directories["icns"], "eric.icns"), |
|
1261 ) |
|
1262 |
1171 if os.path.exists(os.path.join("eric", "eric7", "UI", "Info.py")): |
1263 if os.path.exists(os.path.join("eric", "eric7", "UI", "Info.py")): |
1172 # Installing from archive |
1264 # Installing from archive |
1173 from eric.eric7.UI.Info import Version, CopyrightShort |
1265 from eric.eric7.UI.Info import Version, CopyrightShort |
1174 elif os.path.exists(os.path.join("eric7", "UI", "Info.py")): |
1266 elif os.path.exists(os.path.join("eric7", "UI", "Info.py")): |
1175 # Installing from source tree |
1267 # Installing from source tree |
1176 from eric7.UI.Info import Version, CopyrightShort |
1268 from eric7.UI.Info import Version, CopyrightShort |
1177 else: |
1269 else: |
1178 Version = "Unknown" |
1270 Version = "Unknown" |
1179 CopyrightShort = "(c) 2002 - 2022 Detlev Offenbach" |
1271 CopyrightShort = "(c) 2002 - 2022 Detlev Offenbach" |
1180 |
1272 |
1181 copyToFile( |
1273 copyToFile( |
1182 os.path.join(directories["contents"], "Info.plist"), |
1274 os.path.join(directories["contents"], "Info.plist"), |
1183 '''<?xml version="1.0" encoding="UTF-8"?>\n''' |
1275 """<?xml version="1.0" encoding="UTF-8"?>\n""" |
1184 '''<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"\n''' |
1276 """<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"\n""" |
1185 ''' "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n''' |
1277 """ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n""" |
1186 '''<plist version="1.0">\n''' |
1278 """<plist version="1.0">\n""" |
1187 '''<dict>\n''' |
1279 """<dict>\n""" |
1188 ''' <key>CFBundleExecutable</key>\n''' |
1280 """ <key>CFBundleExecutable</key>\n""" |
1189 ''' <string>eric7</string>\n''' |
1281 """ <string>eric7</string>\n""" |
1190 ''' <key>CFBundleIconFile</key>\n''' |
1282 """ <key>CFBundleIconFile</key>\n""" |
1191 ''' <string>eric.icns</string>\n''' |
1283 """ <string>eric.icns</string>\n""" |
1192 ''' <key>CFBundleInfoDictionaryVersion</key>\n''' |
1284 """ <key>CFBundleInfoDictionaryVersion</key>\n""" |
1193 ''' <string>{1}</string>\n''' |
1285 """ <string>{1}</string>\n""" |
1194 ''' <key>CFBundleName</key>\n''' |
1286 """ <key>CFBundleName</key>\n""" |
1195 ''' <string>{0}</string>\n''' |
1287 """ <string>{0}</string>\n""" |
1196 ''' <key>CFBundleDisplayName</key>\n''' |
1288 """ <key>CFBundleDisplayName</key>\n""" |
1197 ''' <string>{0}</string>\n''' |
1289 """ <string>{0}</string>\n""" |
1198 ''' <key>CFBundlePackageType</key>\n''' |
1290 """ <key>CFBundlePackageType</key>\n""" |
1199 ''' <string>APPL</string>\n''' |
1291 """ <string>APPL</string>\n""" |
1200 ''' <key>CFBundleSignature</key>\n''' |
1292 """ <key>CFBundleSignature</key>\n""" |
1201 ''' <string>ERIC-IDE</string>\n''' |
1293 """ <string>ERIC-IDE</string>\n""" |
1202 ''' <key>CFBundleVersion</key>\n''' |
1294 """ <key>CFBundleVersion</key>\n""" |
1203 ''' <string>{1}</string>\n''' |
1295 """ <string>{1}</string>\n""" |
1204 ''' <key>CFBundleGetInfoString</key>\n''' |
1296 """ <key>CFBundleGetInfoString</key>\n""" |
1205 ''' <string>{1}, {2}</string>\n''' |
1297 """ <string>{1}, {2}</string>\n""" |
1206 ''' <key>CFBundleIdentifier</key>\n''' |
1298 """ <key>CFBundleIdentifier</key>\n""" |
1207 ''' <string>org.python-projects.eric-ide</string>\n''' |
1299 """ <string>org.python-projects.eric-ide</string>\n""" |
1208 ''' <key>NSRequiresAquaSystemAppearance</key>\n''' |
1300 """ <key>NSRequiresAquaSystemAppearance</key>\n""" |
1209 ''' <string>false</string>\n''' |
1301 """ <string>false</string>\n""" |
1210 ''' <key>LSEnvironment</key>\n''' |
1302 """ <key>LSEnvironment</key>\n""" |
1211 ''' <dict>\n''' |
1303 """ <dict>\n""" |
1212 ''' <key>LANG</key>\n''' |
1304 """ <key>LANG</key>\n""" |
1213 ''' <string>en_US.UTF-8</string>\n''' |
1305 """ <string>en_US.UTF-8</string>\n""" |
1214 ''' <key>LC_ALL</key>\n''' |
1306 """ <key>LC_ALL</key>\n""" |
1215 ''' <string>en_US.UTF-8</string>\n''' |
1307 """ <string>en_US.UTF-8</string>\n""" |
1216 ''' <key>LC_CTYPE</key>\n''' |
1308 """ <key>LC_CTYPE</key>\n""" |
1217 ''' <string>en_US.UTF-8</string>\n''' |
1309 """ <string>en_US.UTF-8</string>\n""" |
1218 ''' </dict>\n''' |
1310 """ </dict>\n""" |
1219 '''</dict>\n''' |
1311 """</dict>\n""" |
1220 '''</plist>\n'''.format( |
1312 """</plist>\n""".format( |
1221 macAppBundleName.replace(".app", ""), |
1313 macAppBundleName.replace(".app", ""), |
1222 Version.split(None, 1)[0], |
1314 Version.split(None, 1)[0], |
1223 CopyrightShort)) |
1315 CopyrightShort, |
|
1316 ), |
|
1317 ) |
1224 |
1318 |
1225 |
1319 |
1226 def createInstallConfig(): |
1320 def createInstallConfig(): |
1227 """ |
1321 """ |
1228 Create the installation config dictionary. |
1322 Create the installation config dictionary. |
1229 """ |
1323 """ |
1230 global modDir, platBinDir, cfg, apisDir, installApis |
1324 global modDir, platBinDir, cfg, apisDir, installApis |
1231 |
1325 |
1232 ericdir = os.path.join(modDir, "eric7") |
1326 ericdir = os.path.join(modDir, "eric7") |
1233 cfg = { |
1327 cfg = { |
1234 'ericDir': ericdir, |
1328 "ericDir": ericdir, |
1235 'ericPixDir': os.path.join(ericdir, "pixmaps"), |
1329 "ericPixDir": os.path.join(ericdir, "pixmaps"), |
1236 'ericIconDir': os.path.join(ericdir, "icons"), |
1330 "ericIconDir": os.path.join(ericdir, "icons"), |
1237 'ericDTDDir': os.path.join(ericdir, "DTDs"), |
1331 "ericDTDDir": os.path.join(ericdir, "DTDs"), |
1238 'ericCSSDir': os.path.join(ericdir, "CSSs"), |
1332 "ericCSSDir": os.path.join(ericdir, "CSSs"), |
1239 'ericStylesDir': os.path.join(ericdir, "Styles"), |
1333 "ericStylesDir": os.path.join(ericdir, "Styles"), |
1240 'ericThemesDir': os.path.join(ericdir, "Themes"), |
1334 "ericThemesDir": os.path.join(ericdir, "Themes"), |
1241 'ericDocDir': os.path.join(ericdir, "Documentation"), |
1335 "ericDocDir": os.path.join(ericdir, "Documentation"), |
1242 'ericExamplesDir': os.path.join(ericdir, "Examples"), |
1336 "ericExamplesDir": os.path.join(ericdir, "Examples"), |
1243 'ericTranslationsDir': os.path.join(ericdir, "i18n"), |
1337 "ericTranslationsDir": os.path.join(ericdir, "i18n"), |
1244 'ericTemplatesDir': os.path.join(ericdir, "DesignerTemplates"), |
1338 "ericTemplatesDir": os.path.join(ericdir, "DesignerTemplates"), |
1245 'ericCodeTemplatesDir': os.path.join(ericdir, 'CodeTemplates'), |
1339 "ericCodeTemplatesDir": os.path.join(ericdir, "CodeTemplates"), |
1246 'ericOthersDir': ericdir, |
1340 "ericOthersDir": ericdir, |
1247 'bindir': platBinDir, |
1341 "bindir": platBinDir, |
1248 'mdir': modDir, |
1342 "mdir": modDir, |
1249 } |
1343 } |
1250 if installApis: |
1344 if installApis: |
1251 if apisDir: |
1345 if apisDir: |
1252 cfg['apidir'] = apisDir |
1346 cfg["apidir"] = apisDir |
1253 else: |
1347 else: |
1254 cfg['apidir'] = os.path.join(ericdir, "api") |
1348 cfg["apidir"] = os.path.join(ericdir, "api") |
1255 else: |
1349 else: |
1256 cfg['apidir'] = "" |
1350 cfg["apidir"] = "" |
|
1351 |
|
1352 |
1257 configLength = 16 |
1353 configLength = 16 |
1258 |
1354 |
1259 |
1355 |
1260 def createConfig(): |
1356 def createConfig(): |
1261 """ |
1357 """ |
1262 Create a config file with the respective config entries. |
1358 Create a config file with the respective config entries. |
1263 """ |
1359 """ |
1264 global cfg, macAppBundlePath, configName |
1360 global cfg, macAppBundlePath, configName |
1265 |
1361 |
1266 apis = [] |
1362 apis = [] |
1267 if installApis: |
1363 if installApis: |
1268 for progLanguage in progLanguages: |
1364 for progLanguage in progLanguages: |
1269 for apiName in sorted( |
1365 for apiName in sorted( |
1270 glob.glob(os.path.join(eric7SourceDir, "APIs", progLanguage, |
1366 glob.glob(os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api")) |
1271 "*.api"))): |
1367 ): |
1272 apis.append(os.path.basename(apiName)) |
1368 apis.append(os.path.basename(apiName)) |
1273 if progLanguage == "Python": |
1369 if progLanguage == "Python": |
1274 # treat Python3 API files the same as Python API files |
1370 # treat Python3 API files the same as Python API files |
1275 for apiName in sorted( |
1371 for apiName in sorted( |
1276 glob.glob(os.path.join(eric7SourceDir, "APIs", "Python3", |
1372 glob.glob(os.path.join(eric7SourceDir, "APIs", "Python3", "*.api")) |
1277 "*.api"))): |
1373 ): |
1278 apis.append(os.path.basename(apiName)) |
1374 apis.append(os.path.basename(apiName)) |
1279 |
1375 |
1280 # treat MicroPython API files the same as Python API files |
1376 # treat MicroPython API files the same as Python API files |
1281 for apiName in sorted( |
1377 for apiName in sorted( |
1282 glob.glob(os.path.join(eric7SourceDir, "APIs", |
1378 glob.glob( |
1283 "MicroPython", "*.api"))): |
1379 os.path.join(eric7SourceDir, "APIs", "MicroPython", "*.api") |
|
1380 ) |
|
1381 ): |
1284 apis.append(os.path.basename(apiName)) |
1382 apis.append(os.path.basename(apiName)) |
1285 |
1383 |
1286 macConfig = ( |
1384 macConfig = ( |
1287 (""" 'macAppBundlePath': r'{0}',\n""" |
1385 ( |
1288 """ 'macAppBundleName': r'{1}',\n""").format(macAppBundlePath, |
1386 """ 'macAppBundlePath': r'{0}',\n""" |
1289 macAppBundleName) |
1387 """ 'macAppBundleName': r'{1}',\n""" |
1290 if sys.platform == "darwin" else |
1388 ).format(macAppBundlePath, macAppBundleName) |
1291 "" |
1389 if sys.platform == "darwin" |
|
1390 else "" |
1292 ) |
1391 ) |
1293 config = ( |
1392 config = ( |
1294 """# -*- coding: utf-8 -*-\n""" |
1393 """# -*- coding: utf-8 -*-\n""" |
1295 """#\n""" |
1394 """#\n""" |
1296 """# This module contains the configuration of the individual eric""" |
1395 """# This module contains the configuration of the individual eric""" |
1394 @type bool |
1502 @type bool |
1395 @return flag indicating a successful installation |
1503 @return flag indicating a successful installation |
1396 @rtype bool |
1504 @rtype bool |
1397 """ |
1505 """ |
1398 global yes2All |
1506 global yes2All |
1399 |
1507 |
1400 ok = False |
1508 ok = False |
1401 if yes2All or force: |
1509 if yes2All or force: |
1402 answer = "y" |
1510 answer = "y" |
1403 else: |
1511 else: |
1404 print("{0}\nShall '{1}' be installed using pip? (Y/n)" |
1512 print( |
1405 .format(message, packageName), end=" ") |
1513 "{0}\nShall '{1}' be installed using pip? (Y/n)".format( |
1406 answer = input() # secok |
1514 message, packageName |
|
1515 ), |
|
1516 end=" ", |
|
1517 ) |
|
1518 answer = input() # secok |
1407 if answer in ("", "Y", "y"): |
1519 if answer in ("", "Y", "y"): |
1408 exitCode = subprocess.run( # secok |
1520 exitCode = subprocess.run( # secok |
1409 [sys.executable, "-m", "pip", "install", "--prefer-binary", |
1521 [ |
1410 "--upgrade", packageName] |
1522 sys.executable, |
|
1523 "-m", |
|
1524 "pip", |
|
1525 "install", |
|
1526 "--prefer-binary", |
|
1527 "--upgrade", |
|
1528 packageName, |
|
1529 ] |
1411 ).returncode |
1530 ).returncode |
1412 ok = (exitCode == 0) |
1531 ok = exitCode == 0 |
1413 |
1532 |
1414 return ok |
1533 return ok |
1415 |
1534 |
1416 |
1535 |
1417 def isPipOutdated(): |
1536 def isPipOutdated(): |
1418 """ |
1537 """ |
1419 Check, if pip is outdated. |
1538 Check, if pip is outdated. |
1420 |
1539 |
1421 @return flag indicating an outdated pip |
1540 @return flag indicating an outdated pip |
1422 @rtype bool |
1541 @rtype bool |
1423 """ |
1542 """ |
1424 try: |
1543 try: |
1425 pipOut = subprocess.run( # secok |
1544 pipOut = subprocess.run( # secok |
1426 [sys.executable, "-m", "pip", "list", "--outdated", |
1545 [sys.executable, "-m", "pip", "list", "--outdated", "--format=json"], |
1427 "--format=json"], |
1546 check=True, |
1428 check=True, capture_output=True, text=True |
1547 capture_output=True, |
|
1548 text=True, |
1429 ).stdout |
1549 ).stdout |
1430 except (OSError, subprocess.CalledProcessError): |
1550 except (OSError, subprocess.CalledProcessError): |
1431 pipOut = "[]" # default empty list |
1551 pipOut = "[]" # default empty list |
1432 try: |
1552 try: |
1433 jsonList = json.loads(pipOut) |
1553 jsonList = json.loads(pipOut) |
1434 except Exception: |
1554 except Exception: |
1435 jsonList = [] |
1555 jsonList = [] |
1436 for package in jsonList: |
1556 for package in jsonList: |
1437 if isinstance(package, dict) and package["name"] == "pip": |
1557 if isinstance(package, dict) and package["name"] == "pip": |
1438 print("'pip' is outdated (installed {0}, available {1})".format( |
1558 print( |
1439 package["version"], package["latest_version"] |
1559 "'pip' is outdated (installed {0}, available {1})".format( |
1440 )) |
1560 package["version"], package["latest_version"] |
|
1561 ) |
|
1562 ) |
1441 return True |
1563 return True |
1442 |
1564 |
1443 return False |
1565 return False |
1444 |
1566 |
1445 |
1567 |
1446 def updatePip(): |
1568 def updatePip(): |
1447 """ |
1569 """ |
1448 Update the installed pip package. |
1570 Update the installed pip package. |
1449 """ |
1571 """ |
1450 global yes2All |
1572 global yes2All |
1451 |
1573 |
1452 if yes2All: |
1574 if yes2All: |
1453 answer = "y" |
1575 answer = "y" |
1454 else: |
1576 else: |
1455 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ") |
1577 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ") |
1456 answer = input() # secok |
1578 answer = input() # secok |
1457 if answer in ("", "Y", "y"): |
1579 if answer in ("", "Y", "y"): |
1458 subprocess.run( # secok |
1580 subprocess.run( # secok |
1459 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"]) |
1581 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"] |
|
1582 ) |
1460 |
1583 |
1461 |
1584 |
1462 def versionToStr(version): |
1585 def versionToStr(version): |
1463 """ |
1586 """ |
1464 Function to convert a version number into a version string. |
1587 Function to convert a version number into a version string. |
1465 |
1588 |
1466 @param version version number to convert |
1589 @param version version number to convert |
1467 @type int |
1590 @type int |
1468 @return version string |
1591 @return version string |
1469 @rtype str |
1592 @rtype str |
1470 """ |
1593 """ |
1471 parts = [] |
1594 parts = [] |
1472 while version: |
1595 while version: |
1473 parts.append(version & 0xff) |
1596 parts.append(version & 0xFF) |
1474 version >>= 8 |
1597 version >>= 8 |
1475 return '.'.join(str(p) for p in reversed(parts)) |
1598 return ".".join(str(p) for p in reversed(parts)) |
1476 |
1599 |
1477 |
1600 |
1478 def doDependancyChecks(): |
1601 def doDependancyChecks(): |
1479 """ |
1602 """ |
1480 Perform some dependency checks. |
1603 Perform some dependency checks. |
1481 """ |
1604 """ |
1482 global verbose |
1605 global verbose |
1483 |
1606 |
1484 requiredVersions = { |
1607 requiredVersions = { |
1485 "pyqt6": 0x60200, # v6.2.0 |
1608 "pyqt6": 0x60200, # v6.2.0 |
1486 "pyqt6-charts": 0x60200, # v6.2.0 |
1609 "pyqt6-charts": 0x60200, # v6.2.0 |
1487 "pyqt6-webengine": 0x60200, # v6.2.0 |
1610 "pyqt6-webengine": 0x60200, # v6.2.0 |
1488 "pyqt6-qscintilla": 0x20d00, # v2.13.0 |
1611 "pyqt6-qscintilla": 0x20D00, # v2.13.0 |
1489 "sip": 0x60100, # v6.1.0 |
1612 "sip": 0x60100, # v6.1.0 |
1490 } |
1613 } |
1491 |
1614 |
1492 try: |
1615 try: |
1493 isSudo = os.getuid() == 0 and sys.platform != "darwin" |
1616 isSudo = os.getuid() == 0 and sys.platform != "darwin" |
1494 # disregard sudo installs on macOS |
1617 # disregard sudo installs on macOS |
1495 except AttributeError: |
1618 except AttributeError: |
1496 isSudo = False |
1619 isSudo = False |
1497 |
1620 |
1498 print('Checking dependencies') |
1621 print("Checking dependencies") |
1499 |
1622 |
1500 # update pip first even if we don't need to install anything |
1623 # update pip first even if we don't need to install anything |
1501 if not isSudo and isPipOutdated(): |
1624 if not isSudo and isPipOutdated(): |
1502 updatePip() |
1625 updatePip() |
1503 print("\n") |
1626 print("\n") |
1504 |
1627 |
1505 # perform dependency checks |
1628 # perform dependency checks |
1506 if sys.version_info < (3, 7, 0) or sys.version_info >= (3, 12, 0): |
1629 if sys.version_info < (3, 7, 0) or sys.version_info >= (3, 12, 0): |
1507 print('Sorry, you must have Python 3.7.0 or higher, but less 3.12.0.') |
1630 print("Sorry, you must have Python 3.7.0 or higher, but less 3.12.0.") |
1508 print("Yours is {0}.".format( |
1631 print("Yours is {0}.".format(".".join(str(v) for v in sys.version_info[:3]))) |
1509 ".".join(str(v) for v in sys.version_info[:3]) |
|
1510 )) |
|
1511 exit(5) |
1632 exit(5) |
1512 |
1633 |
1513 try: |
1634 try: |
1514 import xml.etree # __IGNORE_WARNING__ |
1635 import xml.etree # __IGNORE_WARNING__ |
1515 except ImportError: |
1636 except ImportError: |
1516 print('Your Python installation is missing the XML module.') |
1637 print("Your Python installation is missing the XML module.") |
1517 print('Please install it and try again.') |
1638 print("Please install it and try again.") |
1518 exit(5) |
1639 exit(5) |
1519 |
1640 |
1520 try: |
1641 try: |
1521 from PyQt6.QtCore import qVersion |
1642 from PyQt6.QtCore import qVersion |
1522 except ImportError as err: |
1643 except ImportError as err: |
1523 msg = "'PyQt6' could not be detected.{0}".format( |
1644 msg = "'PyQt6' could not be detected.{0}".format( |
1524 "\nError: {0}".format(err) if verbose else "") |
1645 "\nError: {0}".format(err) if verbose else "" |
|
1646 ) |
1525 installed = not isSudo and pipInstall( |
1647 installed = not isSudo and pipInstall( |
1526 "PyQt6>={0}".format(versionToStr(requiredVersions["pyqt6"])), |
1648 "PyQt6>={0}".format(versionToStr(requiredVersions["pyqt6"])), msg |
1527 msg |
|
1528 ) |
1649 ) |
1529 if installed: |
1650 if installed: |
1530 # try to import it again |
1651 # try to import it again |
1531 try: |
1652 try: |
1532 from PyQt6.QtCore import qVersion |
1653 from PyQt6.QtCore import qVersion |
1533 except ImportError as msg: |
1654 except ImportError as msg: |
1534 print('Sorry, please install PyQt6.') |
1655 print("Sorry, please install PyQt6.") |
1535 print('Error: {0}'.format(msg)) |
1656 print("Error: {0}".format(msg)) |
1536 exit(1) |
1657 exit(1) |
1537 else: |
1658 else: |
1538 print('Sorry, please install PyQt6.') |
1659 print("Sorry, please install PyQt6.") |
1539 print('Error: {0}'.format(msg)) |
1660 print("Error: {0}".format(msg)) |
1540 exit(1) |
1661 exit(1) |
1541 print("Found PyQt6") |
1662 print("Found PyQt6") |
1542 |
1663 |
1543 try: |
1664 try: |
1544 pyuic = "pyuic6" |
1665 pyuic = "pyuic6" |
1545 from PyQt6 import uic # __IGNORE_WARNING__ |
1666 from PyQt6 import uic # __IGNORE_WARNING__ |
1546 except ImportError as err: |
1667 except ImportError as err: |
1547 print("Sorry, {0} is not installed.".format(pyuic)) |
1668 print("Sorry, {0} is not installed.".format(pyuic)) |
1548 if verbose: |
1669 if verbose: |
1549 print('Error: {0}'.format(err)) |
1670 print("Error: {0}".format(err)) |
1550 exit(1) |
1671 exit(1) |
1551 print("Found {0}".format(pyuic)) |
1672 print("Found {0}".format(pyuic)) |
1552 |
1673 |
1553 try: |
1674 try: |
1554 from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__ |
1675 from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__ |
1555 except ImportError as err: |
1676 except ImportError as err: |
1556 if isSudo: |
1677 if isSudo: |
1557 print("Optional 'PyQt6-WebEngine' could not be detected.") |
1678 print("Optional 'PyQt6-WebEngine' could not be detected.") |
1558 else: |
1679 else: |
1559 msg = ( |
1680 msg = "Optional 'PyQt6-WebEngine' could not be detected.{0}".format( |
1560 "Optional 'PyQt6-WebEngine' could not be detected.{0}" |
1681 "\nError: {0}".format(err) if verbose else "" |
1561 .format("\nError: {0}".format(err) if verbose else "") |
|
1562 ) |
1682 ) |
1563 pipInstall( |
1683 pipInstall( |
1564 "PyQt6-WebEngine>={0}".format( |
1684 "PyQt6-WebEngine>={0}".format( |
1565 versionToStr(requiredVersions["pyqt6-webengine"])), |
1685 versionToStr(requiredVersions["pyqt6-webengine"]) |
1566 msg |
1686 ), |
|
1687 msg, |
1567 ) |
1688 ) |
1568 |
1689 |
1569 try: |
1690 try: |
1570 from PyQt6 import QtCharts # __IGNORE_WARNING__ |
1691 from PyQt6 import QtCharts # __IGNORE_WARNING__ |
1571 except ImportError as err: |
1692 except ImportError as err: |
1572 if isSudo: |
1693 if isSudo: |
1573 print("Optional 'PyQt6-Charts' could not be detected.") |
1694 print("Optional 'PyQt6-Charts' could not be detected.") |
1574 else: |
1695 else: |
1575 msg = "Optional 'PyQt6-Charts' could not be detected.{0}".format( |
1696 msg = "Optional 'PyQt6-Charts' could not be detected.{0}".format( |
1576 "\nError: {0}".format(err) if verbose else "") |
1697 "\nError: {0}".format(err) if verbose else "" |
|
1698 ) |
1577 pipInstall( |
1699 pipInstall( |
1578 "PyQt6-Charts>={0}".format( |
1700 "PyQt6-Charts>={0}".format( |
1579 versionToStr(requiredVersions["pyqt6-charts"])), |
1701 versionToStr(requiredVersions["pyqt6-charts"]) |
1580 msg |
1702 ), |
|
1703 msg, |
1581 ) |
1704 ) |
1582 print("Found PyQt6-Charts") |
1705 print("Found PyQt6-Charts") |
1583 |
1706 |
1584 try: |
1707 try: |
1585 from PyQt6 import Qsci # __IGNORE_WARNING__ |
1708 from PyQt6 import Qsci # __IGNORE_WARNING__ |
1586 except ImportError as err: |
1709 except ImportError as err: |
1587 msg = "'PyQt6-QScintilla' could not be detected.{0}".format( |
1710 msg = "'PyQt6-QScintilla' could not be detected.{0}".format( |
1588 "\nError: {0}".format(err) if verbose else "") |
1711 "\nError: {0}".format(err) if verbose else "" |
|
1712 ) |
1589 installed = not isSudo and pipInstall( |
1713 installed = not isSudo and pipInstall( |
1590 "PyQt6-QScintilla>={0}".format( |
1714 "PyQt6-QScintilla>={0}".format( |
1591 versionToStr(requiredVersions["pyqt6-qscintilla"])), |
1715 versionToStr(requiredVersions["pyqt6-qscintilla"]) |
1592 msg |
1716 ), |
|
1717 msg, |
1593 ) |
1718 ) |
1594 if installed: |
1719 if installed: |
1595 # try to import it again |
1720 # try to import it again |
1596 try: |
1721 try: |
1597 from PyQt6 import Qsci # __IGNORE_WARNING__ |
1722 from PyQt6 import Qsci # __IGNORE_WARNING__ |
|
1723 |
1598 message = None |
1724 message = None |
1599 except ImportError as msg: |
1725 except ImportError as msg: |
1600 message = str(msg) |
1726 message = str(msg) |
1601 else: |
1727 else: |
1602 message = "PyQt6-QScintilla could not be installed." |
1728 message = "PyQt6-QScintilla could not be installed." |
1603 if message: |
1729 if message: |
1604 print("Sorry, please install QScintilla2 and") |
1730 print("Sorry, please install QScintilla2 and") |
1605 print("its PyQt6 wrapper.") |
1731 print("its PyQt6 wrapper.") |
1606 print('Error: {0}'.format(message)) |
1732 print("Error: {0}".format(message)) |
1607 exit(1) |
1733 exit(1) |
1608 print("Found PyQt6-QScintilla") |
1734 print("Found PyQt6-QScintilla") |
1609 |
1735 |
1610 impModulesList = [ |
1736 impModulesList = [ |
1611 "PyQt6.QtGui", "PyQt6.QtNetwork", "PyQt6.QtPrintSupport", |
1737 "PyQt6.QtGui", |
1612 "PyQt6.QtSql", "PyQt6.QtSvg", "PyQt6.QtSvgWidgets", "PyQt6.QtWidgets", |
1738 "PyQt6.QtNetwork", |
|
1739 "PyQt6.QtPrintSupport", |
|
1740 "PyQt6.QtSql", |
|
1741 "PyQt6.QtSvg", |
|
1742 "PyQt6.QtSvgWidgets", |
|
1743 "PyQt6.QtWidgets", |
1613 ] |
1744 ] |
1614 optionalModulesList = { |
1745 optionalModulesList = { |
1615 # key is pip project name |
1746 # key is pip project name |
1616 # value is tuple of package name, pip install constraint |
1747 # value is tuple of package name, pip install constraint |
1617 "docutils": ("docutils", ""), |
1748 "docutils": ("docutils", ""), |
1633 "trove-classifiers": ("trove_classifiers", ""), |
1764 "trove-classifiers": ("trove_classifiers", ""), |
1634 "black": ("black", ">=22.6.0"), |
1765 "black": ("black", ">=22.6.0"), |
1635 } |
1766 } |
1636 if not ignorePyqt6Tools: |
1767 if not ignorePyqt6Tools: |
1637 optionalModulesList["qt6-applications"] = ("qt6_applications", "") |
1768 optionalModulesList["qt6-applications"] = ("qt6_applications", "") |
1638 |
1769 |
1639 # check mandatory modules |
1770 # check mandatory modules |
1640 modulesOK = True |
1771 modulesOK = True |
1641 for impModule in impModulesList: |
1772 for impModule in impModulesList: |
1642 name = impModule.split(".")[1] |
1773 name = impModule.split(".")[1] |
1643 try: |
1774 try: |
1644 __import__(impModule) |
1775 __import__(impModule) |
1645 print("Found", name) |
1776 print("Found", name) |
1646 except ImportError as err: |
1777 except ImportError as err: |
1647 print('Sorry, please install {0}.'.format(name)) |
1778 print("Sorry, please install {0}.".format(name)) |
1648 if verbose: |
1779 if verbose: |
1649 print('Error: {0}'.format(err)) |
1780 print("Error: {0}".format(err)) |
1650 modulesOK = False |
1781 modulesOK = False |
1651 if not modulesOK: |
1782 if not modulesOK: |
1652 exit(1) |
1783 exit(1) |
1653 |
1784 |
1654 # check optional modules |
1785 # check optional modules |
1655 for optPackage in optionalModulesList: |
1786 for optPackage in optionalModulesList: |
1656 try: |
1787 try: |
1657 __import__(optionalModulesList[optPackage][0]) |
1788 __import__(optionalModulesList[optPackage][0]) |
1658 print("Found", optPackage) |
1789 print("Found", optPackage) |
1659 except ImportError as err: |
1790 except ImportError as err: |
1660 if isSudo: |
1791 if isSudo: |
1661 print("Optional '{0}' could not be detected." |
1792 print("Optional '{0}' could not be detected.".format(optPackage)) |
1662 .format(optPackage)) |
|
1663 else: |
1793 else: |
1664 msg = "Optional '{0}' could not be detected.{1}".format( |
1794 msg = "Optional '{0}' could not be detected.{1}".format( |
1665 optPackage, |
1795 optPackage, "\nError: {0}".format(err) if verbose else "" |
1666 "\nError: {0}".format(err) if verbose else "" |
|
1667 ) |
1796 ) |
1668 pipInstall( |
1797 pipInstall(optPackage + optionalModulesList[optPackage][1], msg) |
1669 optPackage + optionalModulesList[optPackage][1], |
1798 |
1670 msg |
|
1671 ) |
|
1672 |
|
1673 # determine the platform dependent black list |
1799 # determine the platform dependent black list |
1674 if sys.platform.startswith(("win", "cygwin")): |
1800 if sys.platform.startswith(("win", "cygwin")): |
1675 PlatformBlackLists = PlatformsBlackLists["windows"] |
1801 PlatformBlackLists = PlatformsBlackLists["windows"] |
1676 elif sys.platform.startswith("linux"): |
1802 elif sys.platform.startswith("linux"): |
1677 PlatformBlackLists = PlatformsBlackLists["linux"] |
1803 PlatformBlackLists = PlatformsBlackLists["linux"] |
1678 else: |
1804 else: |
1679 PlatformBlackLists = PlatformsBlackLists["mac"] |
1805 PlatformBlackLists = PlatformsBlackLists["mac"] |
1680 |
1806 |
1681 print("\nVersion Information") |
1807 print("\nVersion Information") |
1682 print("-------------------") |
1808 print("-------------------") |
1683 |
1809 |
1684 print("Python: {0:d}.{1:d}.{2:d}".format(*sys.version_info[:3])) |
1810 print("Python: {0:d}.{1:d}.{2:d}".format(*sys.version_info[:3])) |
1685 |
1811 |
1686 # check version of Qt |
1812 # check version of Qt |
1687 # =================== |
1813 # =================== |
1688 qtMajor = int(qVersion().split('.')[0]) |
1814 qtMajor = int(qVersion().split(".")[0]) |
1689 qtMinor = int(qVersion().split('.')[1]) |
1815 qtMinor = int(qVersion().split(".")[1]) |
1690 print("Qt6: {0}".format(qVersion().strip())) |
1816 print("Qt6: {0}".format(qVersion().strip())) |
1691 if qtMajor == 6 and qtMinor < 1: |
1817 if qtMajor == 6 and qtMinor < 1: |
1692 print('Sorry, you must have Qt version 6.1.0 or better.') |
1818 print("Sorry, you must have Qt version 6.1.0 or better.") |
1693 exit(2) |
1819 exit(2) |
1694 |
1820 |
1695 # check version of sip |
1821 # check version of sip |
1696 # ==================== |
1822 # ==================== |
1697 with contextlib.suppress(ImportError, AttributeError): |
1823 with contextlib.suppress(ImportError, AttributeError): |
1698 try: |
1824 try: |
1699 from PyQt6 import sip |
1825 from PyQt6 import sip |
1700 except ImportError: |
1826 except ImportError: |
1701 import sip |
1827 import sip |
1702 print("sip:", sip.SIP_VERSION_STR.strip()) |
1828 print("sip:", sip.SIP_VERSION_STR.strip()) |
1703 # always assume, that snapshots or dev versions are new enough |
1829 # always assume, that snapshots or dev versions are new enough |
1704 if ( |
1830 if "snapshot" not in sip.SIP_VERSION_STR and "dev" not in sip.SIP_VERSION_STR: |
1705 "snapshot" not in sip.SIP_VERSION_STR and |
|
1706 "dev" not in sip.SIP_VERSION_STR |
|
1707 ): |
|
1708 if sip.SIP_VERSION < requiredVersions["sip"]: |
1831 if sip.SIP_VERSION < requiredVersions["sip"]: |
1709 print( |
1832 print( |
1710 'Sorry, you must have sip {0} or higher or' |
1833 "Sorry, you must have sip {0} or higher or" |
1711 ' a recent development release.' |
1834 " a recent development release.".format( |
1712 .format(versionToStr(requiredVersions["sip"])) |
1835 versionToStr(requiredVersions["sip"]) |
|
1836 ) |
1713 ) |
1837 ) |
1714 exit(3) |
1838 exit(3) |
1715 # check for blacklisted versions |
1839 # check for blacklisted versions |
1716 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]: |
1840 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]: |
1717 if vers == sip.SIP_VERSION: |
1841 if vers == sip.SIP_VERSION: |
1718 print( |
1842 print( |
1719 'Sorry, sip version {0} is not compatible with eric.' |
1843 "Sorry, sip version {0} is not compatible with eric.".format( |
1720 .format(versionToStr(vers))) |
1844 versionToStr(vers) |
1721 print('Please install another version.') |
1845 ) |
|
1846 ) |
|
1847 print("Please install another version.") |
1722 exit(3) |
1848 exit(3) |
1723 |
1849 |
1724 # check version of PyQt6 |
1850 # check version of PyQt6 |
1725 # ====================== |
1851 # ====================== |
1726 from PyQt6.QtCore import PYQT_VERSION, PYQT_VERSION_STR |
1852 from PyQt6.QtCore import PYQT_VERSION, PYQT_VERSION_STR |
|
1853 |
1727 print("PyQt6:", PYQT_VERSION_STR.strip()) |
1854 print("PyQt6:", PYQT_VERSION_STR.strip()) |
1728 # always assume, that snapshots or dev versions are new enough |
1855 # always assume, that snapshots or dev versions are new enough |
1729 if "snapshot" not in PYQT_VERSION_STR and "dev" not in PYQT_VERSION_STR: |
1856 if "snapshot" not in PYQT_VERSION_STR and "dev" not in PYQT_VERSION_STR: |
1730 if PYQT_VERSION < requiredVersions["pyqt6"]: |
1857 if PYQT_VERSION < requiredVersions["pyqt6"]: |
1731 print( |
1858 print( |
1732 'Sorry, you must have PyQt {0} or better or' |
1859 "Sorry, you must have PyQt {0} or better or" |
1733 ' a recent development release.' |
1860 " a recent development release.".format( |
1734 .format(versionToStr(requiredVersions["pyqt6"])) |
1861 versionToStr(requiredVersions["pyqt6"]) |
|
1862 ) |
1735 ) |
1863 ) |
1736 exit(4) |
1864 exit(4) |
1737 # check for blacklisted versions |
1865 # check for blacklisted versions |
1738 for vers in BlackLists["PyQt6"] + PlatformBlackLists["PyQt6"]: |
1866 for vers in BlackLists["PyQt6"] + PlatformBlackLists["PyQt6"]: |
1739 if vers == PYQT_VERSION: |
1867 if vers == PYQT_VERSION: |
1740 print('Sorry, PyQt version {0} is not compatible with eric.' |
1868 print( |
1741 .format(versionToStr(vers))) |
1869 "Sorry, PyQt version {0} is not compatible with eric.".format( |
1742 print('Please install another version.') |
1870 versionToStr(vers) |
|
1871 ) |
|
1872 ) |
|
1873 print("Please install another version.") |
1743 exit(4) |
1874 exit(4) |
1744 |
1875 |
1745 # check version of QScintilla |
1876 # check version of QScintilla |
1746 # =========================== |
1877 # =========================== |
1747 from PyQt6.Qsci import QSCINTILLA_VERSION, QSCINTILLA_VERSION_STR |
1878 from PyQt6.Qsci import QSCINTILLA_VERSION, QSCINTILLA_VERSION_STR |
|
1879 |
1748 print("PyQt6-QScintilla:", QSCINTILLA_VERSION_STR.strip()) |
1880 print("PyQt6-QScintilla:", QSCINTILLA_VERSION_STR.strip()) |
1749 # always assume, that snapshots or dev versions are new enough |
1881 # always assume, that snapshots or dev versions are new enough |
1750 if ( |
1882 if "snapshot" not in QSCINTILLA_VERSION_STR and "dev" not in QSCINTILLA_VERSION_STR: |
1751 "snapshot" not in QSCINTILLA_VERSION_STR and |
|
1752 "dev" not in QSCINTILLA_VERSION_STR |
|
1753 ): |
|
1754 if QSCINTILLA_VERSION < requiredVersions["pyqt6-qscintilla"]: |
1883 if QSCINTILLA_VERSION < requiredVersions["pyqt6-qscintilla"]: |
1755 print( |
1884 print( |
1756 'Sorry, you must have PyQt6-QScintilla {0} or higher or' |
1885 "Sorry, you must have PyQt6-QScintilla {0} or higher or" |
1757 ' a recent development release.' |
1886 " a recent development release.".format( |
1758 .format(versionToStr(requiredVersions["pyqt6-qscintilla"])) |
1887 versionToStr(requiredVersions["pyqt6-qscintilla"]) |
|
1888 ) |
1759 ) |
1889 ) |
1760 exit(5) |
1890 exit(5) |
1761 # check for blacklisted versions |
1891 # check for blacklisted versions |
1762 for vers in ( |
1892 for vers in BlackLists["QScintilla2"] + PlatformBlackLists["QScintilla2"]: |
1763 BlackLists["QScintilla2"] + |
|
1764 PlatformBlackLists["QScintilla2"] |
|
1765 ): |
|
1766 if vers == QSCINTILLA_VERSION: |
1893 if vers == QSCINTILLA_VERSION: |
1767 print( |
1894 print( |
1768 'Sorry, QScintilla2 version {0} is not compatible with' |
1895 "Sorry, QScintilla2 version {0} is not compatible with" |
1769 ' eric.'.format(versionToStr(vers))) |
1896 " eric.".format(versionToStr(vers)) |
1770 print('Please install another version.') |
1897 ) |
|
1898 print("Please install another version.") |
1771 exit(5) |
1899 exit(5) |
1772 |
1900 |
1773 # print version info for additional modules |
1901 # print version info for additional modules |
1774 with contextlib.suppress(NameError, AttributeError): |
1902 with contextlib.suppress(NameError, AttributeError): |
1775 print("PyQt6-Charts:", QtCharts.PYQT_CHART_VERSION_STR) |
1903 print("PyQt6-Charts:", QtCharts.PYQT_CHART_VERSION_STR) |
1776 |
1904 |
1777 with contextlib.suppress(ImportError, AttributeError): |
1905 with contextlib.suppress(ImportError, AttributeError): |
1778 from PyQt6 import QtWebEngineCore |
1906 from PyQt6 import QtWebEngineCore |
|
1907 |
1779 print("PyQt6-WebEngine:", QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) |
1908 print("PyQt6-WebEngine:", QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) |
1780 |
1909 |
1781 print() |
1910 print() |
1782 print("All dependencies ok.") |
1911 print("All dependencies ok.") |
1783 print() |
1912 print() |
1784 |
1913 |
1785 |
1914 |
1786 def __pyName(py_dir, py_file): |
1915 def __pyName(py_dir, py_file): |
1787 """ |
1916 """ |
1788 Local function to create the Python source file name for the compiled |
1917 Local function to create the Python source file name for the compiled |
1789 .ui file. |
1918 .ui file. |
1790 |
1919 |
1791 @param py_dir suggested name of the directory (string) |
1920 @param py_dir suggested name of the directory (string) |
1792 @param py_file suggested name for the compile source file (string) |
1921 @param py_file suggested name for the compile source file (string) |
1793 @return tuple of directory name (string) and source file name (string) |
1922 @return tuple of directory name (string) and source file name (string) |
1794 """ |
1923 """ |
1795 return py_dir, "Ui_{0}".format(py_file) |
1924 return py_dir, "Ui_{0}".format(py_file) |
2036 ignorePyqt6Tools = True |
2174 ignorePyqt6Tools = True |
2037 elif opt == "--no-info": |
2175 elif opt == "--no-info": |
2038 createInstallInfoFile = False |
2176 createInstallInfoFile = False |
2039 elif opt in ["-v", "--verbose"]: |
2177 elif opt in ["-v", "--verbose"]: |
2040 verbose = True |
2178 verbose = True |
2041 |
2179 |
2042 infoName = "" |
2180 infoName = "" |
2043 installFromSource = not os.path.isdir(sourceDir) |
2181 installFromSource = not os.path.isdir(sourceDir) |
2044 |
2182 |
2045 # check dependencies |
2183 # check dependencies |
2046 if depChecks: |
2184 if depChecks: |
2047 doDependancyChecks() |
2185 doDependancyChecks() |
2048 |
2186 |
2049 if installFromSource: |
2187 if installFromSource: |
2050 sourceDir = os.path.abspath("..") |
2188 sourceDir = os.path.abspath("..") |
2051 |
2189 |
2052 eric7SourceDir = ( |
2190 eric7SourceDir = ( |
2053 os.path.join(sourceDir, "eric7") |
2191 os.path.join(sourceDir, "eric7") |
2054 if os.path.exists(os.path.join(sourceDir, "eric7")) else |
2192 if os.path.exists(os.path.join(sourceDir, "eric7")) |
2055 os.path.join(sourceDir, "src", "eric7") |
2193 else os.path.join(sourceDir, "src", "eric7") |
2056 ) |
2194 ) |
2057 |
2195 |
2058 # cleanup source if installing from source |
2196 # cleanup source if installing from source |
2059 if installFromSource: |
2197 if installFromSource: |
2060 print("Cleaning up source ...") |
2198 print("Cleaning up source ...") |
2061 cleanupSource(eric7SourceDir) |
2199 cleanupSource(eric7SourceDir) |
2062 print() |
2200 print() |
2063 |
2201 |
2064 configName = os.path.join(eric7SourceDir, "eric7config.py") |
2202 configName = os.path.join(eric7SourceDir, "eric7config.py") |
2065 if os.path.exists(os.path.join(sourceDir, ".hg")): |
2203 if os.path.exists(os.path.join(sourceDir, ".hg")): |
2066 # we are installing from source with repo |
2204 # we are installing from source with repo |
2067 infoName = os.path.join(eric7SourceDir, "UI", "Info.py") |
2205 infoName = os.path.join(eric7SourceDir, "UI", "Info.py") |
2068 prepareInfoFile(infoName) |
2206 prepareInfoFile(infoName) |
2069 |
2207 |
2070 if len(cfg) == 0: |
2208 if len(cfg) == 0: |
2071 createInstallConfig() |
2209 createInstallConfig() |
2072 |
2210 |
2073 # get rid of development config file, if it exists |
2211 # get rid of development config file, if it exists |
2074 with contextlib.suppress(OSError): |
2212 with contextlib.suppress(OSError): |
2075 if installFromSource: |
2213 if installFromSource: |
2076 os.rename(configName, configName + ".orig") |
2214 os.rename(configName, configName + ".orig") |
2077 configNameC = configName + 'c' |
2215 configNameC = configName + "c" |
2078 if os.path.exists(configNameC): |
2216 if os.path.exists(configNameC): |
2079 os.remove(configNameC) |
2217 os.remove(configNameC) |
2080 os.remove(configName) |
2218 os.remove(configName) |
2081 |
2219 |
2082 # cleanup old installation |
2220 # cleanup old installation |
2083 print("Cleaning up old installation ...") |
2221 print("Cleaning up old installation ...") |
2084 try: |
2222 try: |
2085 if doCleanup: |
2223 if doCleanup: |
2086 if distDir: |
2224 if distDir: |
2087 shutil.rmtree(distDir, True) |
2225 shutil.rmtree(distDir, True) |
2088 else: |
2226 else: |
2089 cleanUp() |
2227 cleanUp() |
2090 except OSError as msg: |
2228 except OSError as msg: |
2091 sys.stderr.write('Error: {0}\nTry install as root.\n'.format(msg)) |
2229 sys.stderr.write("Error: {0}\nTry install as root.\n".format(msg)) |
2092 exit(7) |
2230 exit(7) |
2093 |
2231 |
2094 # Create a config file and delete the default one |
2232 # Create a config file and delete the default one |
2095 print("\nCreating configuration file ...") |
2233 print("\nCreating configuration file ...") |
2096 createConfig() |
2234 createConfig() |
2097 |
2235 |
2098 createInstallInfo() |
2236 createInstallInfo() |
2099 |
2237 |
2100 # Compile .ui files |
2238 # Compile .ui files |
2101 print("\nCompiling user interface files ...") |
2239 print("\nCompiling user interface files ...") |
2102 # step 1: remove old Ui_*.py files |
2240 # step 1: remove old Ui_*.py files |
2103 for root, _, files in os.walk(sourceDir): |
2241 for root, _, files in os.walk(sourceDir): |
2104 for file in [f for f in files if fnmatch.fnmatch(f, 'Ui_*.py')]: |
2242 for file in [f for f in files if fnmatch.fnmatch(f, "Ui_*.py")]: |
2105 os.remove(os.path.join(root, file)) |
2243 os.remove(os.path.join(root, file)) |
2106 # step 2: compile the forms |
2244 # step 2: compile the forms |
2107 compileUiFiles() |
2245 compileUiFiles() |
2108 |
2246 |
2109 if doCompile: |
2247 if doCompile: |
2110 print("\nCompiling source files ...") |
2248 print("\nCompiling source files ...") |
2111 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]") |
2249 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]") |
2112 sys.stdout = io.StringIO() |
2250 sys.stdout = io.StringIO() |
2113 if distDir: |
2251 if distDir: |
2114 compileall.compile_dir( |
2252 compileall.compile_dir( |
2115 eric7SourceDir, |
2253 eric7SourceDir, |
2116 ddir=os.path.join(distDir, modDir, cfg['ericDir']), |
2254 ddir=os.path.join(distDir, modDir, cfg["ericDir"]), |
2117 rx=skipRe, |
2255 rx=skipRe, |
2118 quiet=True) |
2256 quiet=True, |
|
2257 ) |
2119 py_compile.compile( |
2258 py_compile.compile( |
2120 configName, |
2259 configName, dfile=os.path.join(distDir, modDir, "eric7config.py") |
2121 dfile=os.path.join(distDir, modDir, "eric7config.py")) |
2260 ) |
2122 else: |
2261 else: |
2123 compileall.compile_dir( |
2262 compileall.compile_dir( |
2124 eric7SourceDir, |
2263 eric7SourceDir, |
2125 ddir=os.path.join(modDir, cfg['ericDir']), |
2264 ddir=os.path.join(modDir, cfg["ericDir"]), |
2126 rx=skipRe, |
2265 rx=skipRe, |
2127 quiet=True) |
2266 quiet=True, |
2128 py_compile.compile(configName, |
2267 ) |
2129 dfile=os.path.join(modDir, "eric7config.py")) |
2268 py_compile.compile(configName, dfile=os.path.join(modDir, "eric7config.py")) |
2130 sys.stdout = sys.__stdout__ |
2269 sys.stdout = sys.__stdout__ |
2131 print("\nInstalling eric ...") |
2270 print("\nInstalling eric ...") |
2132 res = installEric() |
2271 res = installEric() |
2133 |
2272 |
2134 if createInstallInfoFile: |
2273 if createInstallInfoFile: |
2135 with open(os.path.join(cfg["ericDir"], |
2274 with open( |
2136 installInfoName), "w") as installInfoFile: |
2275 os.path.join(cfg["ericDir"], installInfoName), "w" |
|
2276 ) as installInfoFile: |
2137 json.dump(installInfo, installInfoFile, indent=2) |
2277 json.dump(installInfo, installInfoFile, indent=2) |
2138 |
2278 |
2139 # do some cleanup |
2279 # do some cleanup |
2140 with contextlib.suppress(OSError): |
2280 with contextlib.suppress(OSError): |
2141 if installFromSource: |
2281 if installFromSource: |
2142 os.remove(configName) |
2282 os.remove(configName) |
2143 configNameC = configName + 'c' |
2283 configNameC = configName + "c" |
2144 if os.path.exists(configNameC): |
2284 if os.path.exists(configNameC): |
2145 os.remove(configNameC) |
2285 os.remove(configNameC) |
2146 os.rename(configName + ".orig", configName) |
2286 os.rename(configName + ".orig", configName) |
2147 with contextlib.suppress(OSError): |
2287 with contextlib.suppress(OSError): |
2148 if installFromSource and infoName: |
2288 if installFromSource and infoName: |
2149 os.remove(infoName) |
2289 os.remove(infoName) |
2150 infoNameC = infoName + 'c' |
2290 infoNameC = infoName + "c" |
2151 if os.path.exists(infoNameC): |
2291 if os.path.exists(infoNameC): |
2152 os.remove(infoNameC) |
2292 os.remove(infoNameC) |
2153 os.rename(infoName + ".orig", infoName) |
2293 os.rename(infoName + ".orig", infoName) |
2154 |
2294 |
2155 print("\nInstallation complete.") |
2295 print("\nInstallation complete.") |
2156 print() |
2296 print() |
2157 |
2297 |
2158 exit(res) |
2298 exit(res) |
2159 |
2299 |
2160 |
2300 |
2161 if __name__ == "__main__": |
2301 if __name__ == "__main__": |
2162 try: |
2302 try: |
2163 main(sys.argv) |
2303 main(sys.argv) |
2164 except SystemExit: |
2304 except SystemExit: |
2165 raise |
2305 raise |
2166 except Exception: |
2306 except Exception: |
2167 print("""An internal error occured. Please report all the output""" |
2307 print( |
2168 """ of the program,\nincluding the following traceback, to""" |
2308 """An internal error occured. Please report all the output""" |
2169 """ eric-bugs@eric-ide.python-projects.org.\n""") |
2309 """ of the program,\nincluding the following traceback, to""" |
|
2310 """ eric-bugs@eric-ide.python-projects.org.\n""" |
|
2311 ) |
2170 raise |
2312 raise |
2171 |
2313 |
2172 # |
2314 # |
2173 # eflag: noqa = M801 |
2315 # eflag: noqa = M801 |