--- a/scripts/install.py Sun Oct 02 11:44:07 2022 +0200 +++ b/scripts/install.py Sun Oct 02 14:18:49 2022 +0200 @@ -603,7 +603,8 @@ for apiname in glob.glob( os.path.join(apidir, progLanguage, "*.bas") ) + glob.glob(os.path.join(apidir, progLanguage.lower(), "*.bas")): - os.remove(apiname) + if os.path.exists(apiname): + os.remove(apiname) # remove empty directories with contextlib.suppress(FileNotFoundError, OSError): @@ -696,7 +697,7 @@ desktopEntry = getWinregEntry(regName, regPath) if desktopEntry: desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry)) - for linkName in windowsDesktopNames(): + for linkName in windowsDesktopNames(clean=True): linkPath = os.path.join(desktopFolder, linkName) if os.path.exists(linkPath): try: @@ -2013,20 +2014,24 @@ shortcut.save() -def windowsDesktopNames(): +def windowsDesktopNames(clean=False): """ Function to generate the link names for the Windows Desktop. + @param clean flag indicating to get the desktop names for a cleanup operation + @type bool @return list of desktop link names @rtype list of str """ - return [e[0] for e in windowsDesktopEntries()] + return [e[0] for e in windowsDesktopEntries(clean=clean)] -def windowsDesktopEntries(): +def windowsDesktopEntries(clean=False): """ Function to generate data for the Windows Desktop links. + @param clean flag indicating to get the desktop entries for a cleanup operation + @type bool @return list of tuples containing the desktop link name, the link target and the icon target @rtype list of tuples of (str, str, str) @@ -2046,6 +2051,16 @@ os.path.join(cfg["ericPixDir"], "ericWeb48.ico"), ), ] + + if clean: + # clean obsolete entries as well + entriesTemplates.extend([ + ( + "eric7 (Python {0}.{1}).lnk", + os.path.join(cfg["bindir"], "eric7_ide.cmd"), + os.path.join(cfg["ericPixDir"], "eric7.ico"), + ), + ]) return [ (e[0].format(majorVersion, minorVersion), e[1], e[2]) for e in entriesTemplates @@ -2060,7 +2075,7 @@ @rtype str """ majorVersion, minorVersion = sys.version_info[:2] - return "eric7 IDE (Python {0}.{1})".format(majorVersion, minorVersion) + return "eric7 (Python {0}.{1})".format(majorVersion, minorVersion) def main(argv):