824 cfg['ericDir']) |
824 cfg['ericDir']) |
825 |
825 |
826 # create the global plugins directory |
826 # create the global plugins directory |
827 createGlobalPluginsDir() |
827 createGlobalPluginsDir() |
828 |
828 |
829 except (IOError, OSError) as msg: |
829 except OSError as msg: |
830 sys.stderr.write( |
830 sys.stderr.write( |
831 'Error: {0}\nTry install with admin rights.\n'.format(msg)) |
831 'Error: {0}\nTry install with admin rights.\n'.format(msg)) |
832 return(7) |
832 return(7) |
833 |
833 |
834 # copy some text files to the doc area |
834 # copy some text files to the doc area |
835 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
835 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
836 try: |
836 try: |
837 shutilCopy(os.path.join(sourceDir, "docs", name), |
837 shutilCopy(os.path.join(sourceDir, "docs", name), |
838 cfg['ericDocDir']) |
838 cfg['ericDocDir']) |
839 except EnvironmentError: |
839 except OSError: |
840 print("Could not install '{0}'.".format( |
840 print("Could not install '{0}'.".format( |
841 os.path.join(sourceDir, "docs", name))) |
841 os.path.join(sourceDir, "docs", name))) |
842 for name in glob.glob(os.path.join(sourceDir, 'docs', 'README*.*')): |
842 for name in glob.glob(os.path.join(sourceDir, 'docs', 'README*.*')): |
843 try: |
843 try: |
844 shutilCopy(name, cfg['ericDocDir']) |
844 shutilCopy(name, cfg['ericDocDir']) |
845 except EnvironmentError: |
845 except OSError: |
846 print("Could not install '{0}'.".format(name)) |
846 print("Could not install '{0}'.".format(name)) |
847 |
847 |
848 # copy some more stuff |
848 # copy some more stuff |
849 for name in ['default.e4k', 'default_Mac.e4k']: |
849 for name in ['default.e4k', 'default_Mac.e4k']: |
850 try: |
850 try: |
851 shutilCopy(os.path.join(sourceDir, "others", name), |
851 shutilCopy(os.path.join(sourceDir, "others", name), |
852 cfg['ericOthersDir']) |
852 cfg['ericOthersDir']) |
853 except EnvironmentError: |
853 except OSError: |
854 print("Could not install '{0}'.".format( |
854 print("Could not install '{0}'.".format( |
855 os.path.join(sourceDir, "others", name))) |
855 os.path.join(sourceDir, "others", name))) |
856 |
856 |
857 # install the API file |
857 # install the API file |
858 if installApis: |
858 if installApis: |
864 os.makedirs(apidir) |
864 os.makedirs(apidir) |
865 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
865 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
866 progLanguage, "*.api")): |
866 progLanguage, "*.api")): |
867 try: |
867 try: |
868 shutilCopy(apiName, apidir) |
868 shutilCopy(apiName, apidir) |
869 except EnvironmentError: |
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 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
872 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
873 progLanguage, "*.bas")): |
873 progLanguage, "*.bas")): |
874 try: |
874 try: |
875 shutilCopy(apiName, apidir) |
875 shutilCopy(apiName, apidir) |
876 except EnvironmentError: |
876 except OSError: |
877 print("Could not install '{0}' (no permission)." |
877 print("Could not install '{0}' (no permission)." |
878 .format(apiName)) |
878 .format(apiName)) |
879 if progLanguage == "Python": |
879 if progLanguage == "Python": |
880 # copy Python3 API files to the same destination |
880 # copy Python3 API files to the same destination |
881 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
881 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
882 "Python3", "*.api")): |
882 "Python3", "*.api")): |
883 try: |
883 try: |
884 shutilCopy(apiName, apidir) |
884 shutilCopy(apiName, apidir) |
885 except EnvironmentError: |
885 except OSError: |
886 print("Could not install '{0}' (no permission)." |
886 print("Could not install '{0}' (no permission)." |
887 .format(apiName)) |
887 .format(apiName)) |
888 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
888 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
889 "Python3", "*.bas")): |
889 "Python3", "*.bas")): |
890 if os.path.exists(os.path.join( |
890 if os.path.exists(os.path.join( |
891 apidir, os.path.basename( |
891 apidir, os.path.basename( |
892 apiName.replace(".bas", ".api")))): |
892 apiName.replace(".bas", ".api")))): |
893 try: |
893 try: |
894 shutilCopy(apiName, apidir) |
894 shutilCopy(apiName, apidir) |
895 except EnvironmentError: |
895 except OSError: |
896 print("Could not install '{0}' (no permission)." |
896 print("Could not install '{0}' (no permission)." |
897 .format(apiName)) |
897 .format(apiName)) |
898 |
898 |
899 # copy MicroPython API files to the same destination |
899 # copy MicroPython API files to the same destination |
900 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
900 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
901 "MicroPython", "*.api")): |
901 "MicroPython", "*.api")): |
902 try: |
902 try: |
903 shutilCopy(apiName, apidir) |
903 shutilCopy(apiName, apidir) |
904 except EnvironmentError: |
904 except OSError: |
905 print("Could not install '{0}' (no permission)." |
905 print("Could not install '{0}' (no permission)." |
906 .format(apiName)) |
906 .format(apiName)) |
907 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
907 for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", |
908 "MicroPython", "*.bas")): |
908 "MicroPython", "*.bas")): |
909 if os.path.exists(os.path.join( |
909 if os.path.exists(os.path.join( |
910 apidir, os.path.basename( |
910 apidir, os.path.basename( |
911 apiName.replace(".bas", ".api")))): |
911 apiName.replace(".bas", ".api")))): |
912 try: |
912 try: |
913 shutilCopy(apiName, apidir) |
913 shutilCopy(apiName, apidir) |
914 except EnvironmentError: |
914 except OSError: |
915 print("Could not install '{0}' (no permission)." |
915 print("Could not install '{0}' (no permission)." |
916 .format(apiName)) |
916 .format(apiName)) |
917 |
917 |
918 # Create menu entry for Linux systems |
918 # Create menu entry for Linux systems |
919 if sys.platform.startswith("linux"): |
919 if sys.platform.startswith("linux"): |
1983 os.rename(configName, configName + ".orig") |
1983 os.rename(configName, configName + ".orig") |
1984 configNameC = configName + 'c' |
1984 configNameC = configName + 'c' |
1985 if os.path.exists(configNameC): |
1985 if os.path.exists(configNameC): |
1986 os.remove(configNameC) |
1986 os.remove(configNameC) |
1987 os.remove(configName) |
1987 os.remove(configName) |
1988 except EnvironmentError: |
1988 except OSError: |
1989 pass |
1989 pass |
1990 |
1990 |
1991 # cleanup old installation |
1991 # cleanup old installation |
1992 print("Cleaning up old installation ...") |
1992 print("Cleaning up old installation ...") |
1993 try: |
1993 try: |
1994 if doCleanup: |
1994 if doCleanup: |
1995 if distDir: |
1995 if distDir: |
1996 shutil.rmtree(distDir, True) |
1996 shutil.rmtree(distDir, True) |
1997 else: |
1997 else: |
1998 cleanUp() |
1998 cleanUp() |
1999 except (IOError, OSError) as msg: |
1999 except OSError as msg: |
2000 sys.stderr.write('Error: {0}\nTry install as root.\n'.format(msg)) |
2000 sys.stderr.write('Error: {0}\nTry install as root.\n'.format(msg)) |
2001 exit(7) |
2001 exit(7) |
2002 |
2002 |
2003 # Create a config file and delete the default one |
2003 # Create a config file and delete the default one |
2004 print("\nCreating configuration file ...") |
2004 print("\nCreating configuration file ...") |
2050 os.remove(configName) |
2050 os.remove(configName) |
2051 configNameC = configName + 'c' |
2051 configNameC = configName + 'c' |
2052 if os.path.exists(configNameC): |
2052 if os.path.exists(configNameC): |
2053 os.remove(configNameC) |
2053 os.remove(configNameC) |
2054 os.rename(configName + ".orig", configName) |
2054 os.rename(configName + ".orig", configName) |
2055 except EnvironmentError: |
2055 except OSError: |
2056 pass |
2056 pass |
2057 try: |
2057 try: |
2058 if installFromSource and infoName: |
2058 if installFromSource and infoName: |
2059 os.remove(infoName) |
2059 os.remove(infoName) |
2060 infoNameC = infoName + 'c' |
2060 infoNameC = infoName + 'c' |
2061 if os.path.exists(infoNameC): |
2061 if os.path.exists(infoNameC): |
2062 os.remove(infoNameC) |
2062 os.remove(infoNameC) |
2063 os.rename(infoName + ".orig", infoName) |
2063 os.rename(infoName + ".orig", infoName) |
2064 except EnvironmentError: |
2064 except OSError: |
2065 pass |
2065 pass |
2066 |
2066 |
2067 print("\nInstallation complete.") |
2067 print("\nInstallation complete.") |
2068 print() |
2068 print() |
2069 |
2069 |