Improved installation procedure to also create application icons on ChromeOS.

Sun, 03 Oct 2021 13:04:53 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 03 Oct 2021 13:04:53 +0200
changeset 8661
1dc0a266d5f5
parent 8657
1acee0c15156
child 8665
1600bcd3a378

Improved installation procedure to also create application icons on ChromeOS.

eric6/APIs/Python3/eric6.api file | annotate | diff | comparison | revisions
eric6/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
eric6/Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
eric6/Documentation/Source/eric6.eric6_post_install.html file | annotate | diff | comparison | revisions
eric6/eric6_post_install.py file | annotate | diff | comparison | revisions
eric6/pixmaps/eric48_icon.png file | annotate | diff | comparison | revisions
scripts/install.py file | annotate | diff | comparison | revisions
setup.py file | annotate | diff | comparison | revisions
--- a/eric6/APIs/Python3/eric6.api	Fri Oct 01 17:08:37 2021 +0200
+++ b/eric6/APIs/Python3/eric6.api	Sun Oct 03 13:04:53 2021 +0200
@@ -12230,6 +12230,7 @@
 eric6.eric6_pluginuninstall.main?4()
 eric6.eric6_post_install.copyDesktopFile?4(src, dst, scriptsdir)
 eric6.eric6_post_install.copyLinuxMetaData?4()
+eric6.eric6_post_install.copyMetaFile?4(srcname, dstpath, dstname)
 eric6.eric6_post_install.copyMetaFilesTree?4(src, dst)
 eric6.eric6_post_install.createWindowsLinks?4()
 eric6.eric6_post_install.createWindowsShortcut?4(linkPath, targetPath, iconPath)
Binary file eric6/Documentation/Help/source.qch has changed
--- a/eric6/Documentation/Help/source.qhp	Fri Oct 01 17:08:37 2021 +0200
+++ b/eric6/Documentation/Help/source.qhp	Sun Oct 03 13:04:53 2021 +0200
@@ -17700,6 +17700,7 @@
       <keyword name="copyDesktopFile" id="copyDesktopFile" ref="eric6.eric6_post_install.html#copyDesktopFile" />
       <keyword name="copyDesktopFile" id="copyDesktopFile" ref="install.html#copyDesktopFile" />
       <keyword name="copyLinuxMetaData" id="copyLinuxMetaData" ref="eric6.eric6_post_install.html#copyLinuxMetaData" />
+      <keyword name="copyMetaFile" id="copyMetaFile" ref="eric6.eric6_post_install.html#copyMetaFile" />
       <keyword name="copyMetaFilesTree" id="copyMetaFilesTree" ref="eric6.eric6_post_install.html#copyMetaFilesTree" />
       <keyword name="copyToFile" id="copyToFile" ref="install.html#copyToFile" />
       <keyword name="copyTree" id="copyTree" ref="install-debugclients.html#copyTree" />
--- a/eric6/Documentation/Source/eric6.eric6_post_install.html	Fri Oct 01 17:08:37 2021 +0200
+++ b/eric6/Documentation/Source/eric6.eric6_post_install.html	Sun Oct 03 13:04:53 2021 +0200
@@ -48,6 +48,10 @@
 <td>Function to copy the meta data files.</td>
 </tr>
 <tr>
+<td><a href="#copyMetaFile">copyMetaFile</a></td>
+<td>Function to copy a file to its destination.</td>
+</tr>
+<tr>
 <td><a href="#copyMetaFilesTree">copyMetaFilesTree</a></td>
 <td>Function to copy the files of a directory tree.</td>
 </tr>
@@ -113,6 +117,31 @@
 <div align="right"><a href="#top">Up</a></div>
 <hr />
 <hr />
+<a NAME="copyMetaFile" ID="copyMetaFile"></a>
+<h2>copyMetaFile</h2>
+<b>copyMetaFile</b>(<i>srcname, dstpath, dstname</i>)
+
+<p>
+    Function to copy a file to its destination.
+</p>
+<dl>
+
+<dt><i>srcname</i> (str)</dt>
+<dd>
+name of the source file
+</dd>
+<dt><i>dstpath</i> (str)</dt>
+<dd>
+name of the destination path
+</dd>
+<dt><i>dstname</i> (str)</dt>
+<dd>
+name of the destination file (without path)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+<hr />
 <a NAME="copyMetaFilesTree" ID="copyMetaFilesTree"></a>
 <h2>copyMetaFilesTree</h2>
 <b>copyMetaFilesTree</b>(<i>src, dst</i>)
--- a/eric6/eric6_post_install.py	Fri Oct 01 17:08:37 2021 +0200
+++ b/eric6/eric6_post_install.py	Sun Oct 03 13:04:53 2021 +0200
@@ -157,6 +157,13 @@
         copyMetaFilesTree(os.path.join(srcDir, metaDir),
                           os.path.join(dstDir, metaDir))
     
+    copyMetaFile(os.path.join(srcDir, "icons", "eric48_icon.png"),
+                 os.path.join(dstDir, "icons", "hicolor", "48x48", "apps"),
+                 "eric.png")
+    copyMetaFile(os.path.join(srcDir, "icons", "ericWeb48_icon.png"),
+                 os.path.join(dstDir, "icons", "hicolor", "48x48", "apps"),
+                 "ericWeb.png")
+    
     for desktop in ["eric6.desktop", "eric6_browser.desktop"]:
         copyDesktopFile(
             os.path.join(srcDir, "applications", desktop),
@@ -190,6 +197,24 @@
             copyMetaFilesTree(srcname, dstname)
 
 
+def copyMetaFile(srcname, dstpath, dstname):
+    """
+    Function to copy a file to its destination.
+    
+    @param srcname name of the source file
+    @type str
+    @param dstpath name of the destination path
+    @type str
+    @param dstname name of the destination file (without path)
+    @type str
+    """
+    if not os.path.isdir(dstpath):
+        os.makedirs(dstpath)
+    dstname = os.path.join(dstpath, dstname)
+    shutil.copy2(srcname, dstname)
+    os.chmod(dstname, 0o644)
+
+
 def copyDesktopFile(src, dst, scriptsdir):
     """
     Modify a desktop file and write it to its destination.
Binary file eric6/pixmaps/eric48_icon.png has changed
--- a/scripts/install.py	Fri Oct 01 17:08:37 2021 +0200
+++ b/scripts/install.py	Sun Oct 03 13:04:53 2021 +0200
@@ -939,6 +939,18 @@
         shutilCopy(
             os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"),
             os.path.join(dst, "ericWeb.png"))
+        
+        dst = os.path.normpath(
+            os.path.join(distDir, "usr/share/icons/hicolor/48x48/apps"))
+        if not os.path.exists(dst):
+            os.makedirs(dst)
+        shutilCopy(
+            os.path.join(eric6SourceDir, "pixmaps", "eric48_icon.png"),
+            os.path.join(dst, "eric.png"))
+        shutilCopy(
+            os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"),
+            os.path.join(dst, "ericWeb.png"))
+        
         dst = os.path.normpath(
             os.path.join(distDir, "usr/share/applications"))
         if not os.path.exists(dst):
@@ -948,6 +960,7 @@
         copyDesktopFile(
             os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"),
             os.path.join(dst, "eric6_browser.desktop"))
+        
         dst = os.path.normpath(
             os.path.join(distDir, "usr/share/metainfo"))
         if not os.path.exists(dst):
@@ -959,6 +972,9 @@
         shutilCopy(
             os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"),
             "/usr/share/icons/eric.png")
+        shutilCopy(
+            os.path.join(eric6SourceDir, "pixmaps", "eric48_icon.png"),
+            "/usr/share/icons/hicolor/48x48/apps/eric.png")
         copyDesktopFile(
             os.path.join(sourceDir, "linux", "eric6.desktop.in"),
             "/usr/share/applications/eric6.desktop")
@@ -973,6 +989,9 @@
         shutilCopy(
             os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"),
             "/usr/share/icons/ericWeb.png")
+        shutilCopy(
+            os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"),
+            "/usr/share/icons/hicolor/48x48/apps/ericWeb.png")
         copyDesktopFile(
             os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"),
             "/usr/share/applications/eric6_browser.desktop")
@@ -982,14 +1001,17 @@
                                  ".local", "share")
         # create directories first
         for directory in [os.path.join(localPath, name)
-                          for name in ("icons", "applications",
-                                       "metainfo", "appdata")]:
+                          for name in ("icons", "icons/hicolor/48x48/apps",
+                                       "applications", "metainfo", "appdata")]:
             if not os.path.isdir(directory):
                 os.makedirs(directory)
         # now copy the files
         shutilCopy(
             os.path.join(eric6SourceDir, "pixmaps", "eric_icon.png"),
             os.path.join(localPath, "icons", "eric.png"))
+        shutilCopy(
+            os.path.join(eric6SourceDir, "pixmaps", "eric48_icon.png"),
+            os.path.join(localPath, "icons/hicolor/48x48/apps", "eric.png"))
         copyDesktopFile(
             os.path.join(sourceDir, "linux", "eric6.desktop.in"),
             os.path.join(localPath, "applications", "eric6.desktop"))
@@ -1002,6 +1024,9 @@
         shutilCopy(
             os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"),
             os.path.join(localPath, "icons", "ericWeb.png"))
+        shutilCopy(
+            os.path.join(eric6SourceDir, "pixmaps", "ericWeb48_icon.png"),
+            os.path.join(localPath, "icons/hicolor/48x48/apps", "ericWeb.png"))
         copyDesktopFile(
             os.path.join(sourceDir, "linux", "eric6_browser.desktop.in"),
             os.path.join(localPath, "applications", "eric6_browser.desktop"))
--- a/setup.py	Fri Oct 01 17:08:37 2021 +0200
+++ b/setup.py	Sun Oct 03 13:04:53 2021 +0200
@@ -85,6 +85,8 @@
             ('share/icons', [
                 'eric6/icons/breeze-dark/eric.svg',
                 'eric6/icons/breeze-dark/ericWeb48.svg'
+                'eric6/pixmaps/eric48_icon.png',
+                'eric6/pixmaps/ericWeb48_icon.png'
             ]),
             ('share/appdata', ['linux/eric6.appdata.xml']),
             ('share/metainfo', ['linux/eric6.appdata.xml']),

eric ide

mercurial