Fixed some issues installing eric7 on Windows platforms. eric7

Sun, 02 Oct 2022 14:18:49 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 02 Oct 2022 14:18:49 +0200
branch
eric7
changeset 9380
3d662dda80e8
parent 9378
ac7786c2109f
child 9381
3c9192161833

Fixed some issues installing eric7 on Windows platforms.

scripts/install.py file | annotate | diff | comparison | revisions
scripts/uninstall.py file | annotate | diff | comparison | revisions
src/eric7/eric7_ide.pyw file | annotate | diff | comparison | revisions
src/eric7/eric7_post_install.py file | annotate | diff | comparison | revisions
--- 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):
--- a/scripts/uninstall.py	Sun Oct 02 11:44:07 2022 +0200
+++ b/scripts/uninstall.py	Sun Oct 02 14:18:49 2022 +0200
@@ -131,6 +131,7 @@
         "eric7_editor",
         "eric7_hexeditor",
         "eric7_iconeditor",
+        "eric7_ide",
         "eric7_plugininstall",
         "eric7_pluginrepository",
         "eric7_pluginuninstall",
@@ -144,9 +145,9 @@
         "eric7_trpreviewer",
         "eric7_uipreviewer",
         "eric7_virtualenv",
-        "eric7",
         # obsolete scripts below
         "eric7_unittest",
+        "eric7",
     ]
 
     try:
@@ -208,7 +209,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):
@@ -446,8 +448,10 @@
     """
     majorVersion, minorVersion = sys.version_info[:2]
     linkTemplates = [
+        "eric7 IDE (Python {0}.{1}).lnk",
+        "eric7 Browser (Python {0}.{1}).lnk",
+        # obsolete entries below
         "eric7 (Python {0}.{1}).lnk",
-        "eric7 Browser (Python {0}.{1}).lnk",
     ]
 
     return [ll.format(majorVersion, minorVersion) for ll in linkTemplates]
--- a/src/eric7/eric7_ide.pyw	Sun Oct 02 11:44:07 2022 +0200
+++ b/src/eric7/eric7_ide.pyw	Sun Oct 02 14:18:49 2022 +0200
@@ -7,6 +7,6 @@
 Module implementing the Windows entry point.
 """
 
-from eric7 import main
+from eric7_ide import main
 
 main()
--- a/src/eric7/eric7_post_install.py	Sun Oct 02 11:44:07 2022 +0200
+++ b/src/eric7/eric7_post_install.py	Sun Oct 02 14:18:49 2022 +0200
@@ -95,7 +95,7 @@
     iconsDir = os.path.join(os.path.dirname(eric7.__file__), "pixmaps")
     entriesTemplates = [
         (
-            "eric7 (Python {0}.{1}).lnk",
+            "eric7 IDE (Python {0}.{1}).lnk",
             os.path.join(scriptsDir, "eric7_ide.exe"),
             os.path.join(iconsDir, "eric7.ico"),
         ),

eric ide

mercurial