scripts/install.py

branch
eric7
changeset 10513
805a0450862d
parent 10503
6a37b6ac3928
child 10517
aecd5a8c958c
equal deleted inserted replaced
10512:b7292f2691f9 10513:805a0450862d
935 global distDir, sourceDir 935 global distDir, sourceDir
936 936
937 dataSourceDir = os.path.join(eric7SourceDir, "data", "linux") 937 dataSourceDir = os.path.join(eric7SourceDir, "data", "linux")
938 938
939 if distDir: 939 if distDir:
940 # create directories first
941 for directory in (
942 os.path.normpath(os.path.join(distDir, name))
943 for name in (
944 "usr/share/icons",
945 "usr/share/icons/hicolor/48x48/apps",
946 "usr/share/applications",
947 "usr/share/metainfo",
948 "usr/share/appdata",
949 )
950 ):
951 if not os.path.exists(directory):
952 os.makedirs(directory)
953
940 dst = os.path.normpath(os.path.join(distDir, "usr/share/icons")) 954 dst = os.path.normpath(os.path.join(distDir, "usr/share/icons"))
941 if not os.path.exists(dst): 955 for icon in ("eric_icon.png", "ericWeb48_icon.png"):
942 os.makedirs(dst) 956 shutilCopy(
943 shutilCopy( 957 os.path.join(eric7SourceDir, "pixmaps", icon),
944 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), 958 os.path.join(dst, icon.replace("_icon", "").replace("48", "")),
945 os.path.join(dst, "eric.png"), 959 )
946 )
947 shutilCopy(
948 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
949 os.path.join(dst, "ericWeb.png"),
950 )
951 960
952 dst = os.path.normpath( 961 dst = os.path.normpath(
953 os.path.join(distDir, "usr/share/icons/hicolor/48x48/apps") 962 os.path.join(distDir, "usr/share/icons/hicolor/48x48/apps")
954 ) 963 )
955 if not os.path.exists(dst): 964 for icon in ("eric48_icon.png", "ericWeb48_icon.png"):
956 os.makedirs(dst) 965 shutilCopy(
957 shutilCopy( 966 os.path.join(eric7SourceDir, "pixmaps", icon),
958 os.path.join(eric7SourceDir, "pixmaps", "eric48_icon.png"), 967 os.path.join(dst, icon.replace("48_icon", "")),
959 os.path.join(dst, "eric.png"), 968 )
960 )
961 shutilCopy(
962 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
963 os.path.join(dst, "ericWeb.png"),
964 )
965 969
966 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications")) 970 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications"))
967 if not os.path.exists(dst): 971 for desktop in ("eric7_ide", "eric7_browser"):
968 os.makedirs(dst) 972 copyDesktopFile(
969 copyDesktopFile( 973 os.path.join(dataSourceDir, desktop + ".desktop.in"),
970 os.path.join(dataSourceDir, "eric7_ide.desktop.in"), 974 os.path.join(dst, desktop + ".desktop")
971 os.path.join(dst, "eric7_ide.desktop"), 975 )
972 ) 976
973 copyDesktopFile( 977 for dst in (
974 os.path.join(dataSourceDir, "eric7_browser.desktop.in"), 978 os.path.normpath(os.path.join(distDir, "usr/share/metainfo")),
975 os.path.join(dst, "eric7_browser.desktop"), 979 os.path.normpath(os.path.join(distDir, "usr/share/appdata")),
976 ) 980 ):
977 981 copyAppStreamFile(
978 dst = os.path.normpath(os.path.join(distDir, "usr/share/metainfo")) 982 os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
979 if not os.path.exists(dst): 983 os.path.join(dst, "eric7.appdata.xml"),
980 os.makedirs(dst) 984 )
981 copyAppStreamFile( 985
982 os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
983 os.path.join(dst, "eric7.appdata.xml"),
984 )
985 elif os.getuid() == 0: 986 elif os.getuid() == 0:
987 # eric meta data
986 shutilCopy( 988 shutilCopy(
987 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), 989 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"),
988 "/usr/share/icons/eric.png", 990 "/usr/share/icons/eric.png",
989 ) 991 )
990 shutilCopy( 992 shutilCopy(
1003 elif os.path.exists("/usr/share/appdata"): 1005 elif os.path.exists("/usr/share/appdata"):
1004 copyAppStreamFile( 1006 copyAppStreamFile(
1005 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), 1007 os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
1006 "/usr/share/appdata/eric7.appdata.xml", 1008 "/usr/share/appdata/eric7.appdata.xml",
1007 ) 1009 )
1010
1011 # eric web browser meta data
1008 shutilCopy( 1012 shutilCopy(
1009 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), 1013 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
1010 "/usr/share/icons/ericWeb.png", 1014 "/usr/share/icons/ericWeb.png",
1011 ) 1015 )
1012 shutilCopy( 1016 shutilCopy(
1015 ) 1019 )
1016 copyDesktopFile( 1020 copyDesktopFile(
1017 os.path.join(dataSourceDir, "eric7_browser.desktop.in"), 1021 os.path.join(dataSourceDir, "eric7_browser.desktop.in"),
1018 "/usr/share/applications/eric7_browser.desktop", 1022 "/usr/share/applications/eric7_browser.desktop",
1019 ) 1023 )
1024
1020 elif os.getuid() >= 1000: 1025 elif os.getuid() >= 1000:
1021 # it is assumed, that user ids start at 1000 1026 # it is assumed, that user ids start at 1000
1022 localPath = os.path.join(os.path.expanduser("~"), ".local", "share") 1027 localPath = os.path.join(os.path.expanduser("~"), ".local", "share")
1023 # create directories first 1028 # create directories first
1024 for directory in [ 1029 for directory in [
1031 "appdata", 1036 "appdata",
1032 ) 1037 )
1033 ]: 1038 ]:
1034 if not os.path.isdir(directory): 1039 if not os.path.isdir(directory):
1035 os.makedirs(directory) 1040 os.makedirs(directory)
1041
1036 # now copy the files 1042 # now copy the files
1043 # eric meta data
1037 shutilCopy( 1044 shutilCopy(
1038 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"), 1045 os.path.join(eric7SourceDir, "pixmaps", "eric_icon.png"),
1039 os.path.join(localPath, "icons", "eric.png"), 1046 os.path.join(localPath, "icons", "eric.png"),
1040 ) 1047 )
1041 shutilCopy( 1048 shutilCopy(
1052 ) 1059 )
1053 copyAppStreamFile( 1060 copyAppStreamFile(
1054 os.path.join(dataSourceDir, "eric7.appdata.xml.in"), 1061 os.path.join(dataSourceDir, "eric7.appdata.xml.in"),
1055 os.path.join(localPath, "appdata", "eric7.appdata.xml"), 1062 os.path.join(localPath, "appdata", "eric7.appdata.xml"),
1056 ) 1063 )
1064 # eric web browser meta data
1057 shutilCopy( 1065 shutilCopy(
1058 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), 1066 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
1059 os.path.join(localPath, "icons", "ericWeb.png"), 1067 os.path.join(localPath, "icons", "ericWeb.png"),
1060 ) 1068 )
1061 shutilCopy( 1069 shutilCopy(

eric ide

mercurial