Fixes to comply with the current AppStream file format and contents. 6_1_x

Sat, 08 Oct 2016 20:16:25 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 08 Oct 2016 20:16:25 +0200
branch
6_1_x
changeset 5216
113279c2a38b
parent 5213
62fd9019de8d
child 5217
e8b74fbe6c2f

Fixes to comply with the current AppStream file format and contents.

eric6.appdata.xml file | annotate | diff | comparison | revisions
install.py file | annotate | diff | comparison | revisions
--- a/eric6.appdata.xml	Sat Oct 08 17:02:26 2016 +0200
+++ b/eric6.appdata.xml	Sat Oct 08 20:16:25 2016 +0200
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<application>
- <id type="desktop">eric6@MARKER@.desktop</id>
+<component type="desktop">
+ <id>eric6@MARKER@.desktop</id>
  <metadata_license>CC-BY-3.0</metadata_license>
  <project_license>GPL-3.0+</project_license>
  <name>eric6@MARKER@</name>
@@ -24,17 +24,13 @@
   <screenshot width="1431" height="1254">http://eric-ide.python-projects.org/images/eric5-screen-10.png</screenshot>
  </screenshots>
  <url type="homepage">http://eric-ide.python-projects.org</url>
- <updatecontact>detlev_at_die-offenbachs.de</updatecontact>
- <keywords>
-   <keyword>qt</keyword>
-   <keyword>python</keyword>
-   <keyword>development</keyword>
-   <keyword>ide</keyword>
-   <keyword>debugger</keyword>
-   <keyword>editor</keyword>
-   <keyword>unit test</keyword>
-   <keyword>mercurial</keyword>
-   <keyword>subversion</keyword>
-   <keyword>git</keyword>
- </keywords>
-</application>
+ <url type="bugtracker">https://die-offenbachs.homelinux.org/issues/</url>
+ <url type="translate">http://eric-ide.python-projects.org/eric-translations.html</url>
+ <url type="donation">https://www.paypal.com/cgi-bin/webscr?item_name=Donation+to+Eric+Integrated+Development+Environment&amp;cmd=_donations&amp;business=detlev@die-offenbachs.de</url>
+ <update_contact>detlev_AT_die-offenbachs.de</update_contact>
+ <developer_name>Detlev Offenbach</developer_name>
+ <translation type="qt">eric6</translation>
+ <releases>
+   <release version="@VERSION@" date="@DATE@" />
+ </releases>
+</component>
--- a/install.py	Sat Oct 08 17:02:26 2016 +0200
+++ b/install.py	Sat Oct 08 20:16:25 2016 +0200
@@ -30,6 +30,7 @@
 import distutils.sysconfig
 import codecs
 import subprocess
+import time
 
 # Define the globals.
 progName = None
@@ -306,6 +307,43 @@
     os.chmod(dst, 0o644)
 
 
+def copyAppStreamFile(src, dst, marker):
+    """
+    Modify an appstream file and write it to its destination.
+    
+    @param src source file name (string)
+    @param dst destination file name (string)
+    @param marker marker to be used (string)
+    """
+    if os.path.exists(os.path.join("eric", "UI", "Info.py")):
+        # Installing from archive
+        from eric.UI.Info import Version
+    elif os.path.exists(os.path.join("UI", "Info.py")):
+        # Installing from source tree
+        from UI.Info import Version
+    else:
+        Version = "Unknown"
+    
+    if sys.version_info[0] == 2:
+        f = codecs.open(src, "r", "utf-8")
+    else:
+        f = open(src, "r", encoding="utf-8")
+    text = f.read()
+    f.close()
+    
+    text = text.replace("@MARKER@", marker)\
+        .replace("@VERSION@", Version.split(None, 1)[0])\
+        .replace("@DATE@", time.strftime("%Y-%m-%d"))
+    
+    if sys.version_info[0] == 2:
+        f = codecs.open(dst, "w", "utf-8")
+    else:
+        f = open(dst, "w", encoding="utf-8")
+    f.write(text)
+    f.close()
+    os.chmod(dst, 0o644)
+
+
 def wrapperName(dname, wfile):
     """
     Create the platform specific name for the wrapper script.
@@ -819,7 +857,7 @@
                 os.path.join(distDir, "usr/share/metainfo"))
             if not os.path.exists(dst):
                 os.makedirs(dst)
-            copyDesktopFile(
+            copyAppStreamFile(
                 os.path.join(sourceDir, "eric6.appdata.xml"),
                 os.path.join(dst, "eric6" + marker + ".appdata.xml"),
                 marker)
@@ -832,12 +870,12 @@
                 "/usr/share/applications/eric6" + marker + ".desktop",
                 marker)
             if os.path.exists("/usr/share/metainfo"):
-                copyDesktopFile(
+                copyAppStreamFile(
                     os.path.join(sourceDir, "eric6.appdata.xml"),
                     "/usr/share/metainfo/eric6" + marker + ".appdata.xml",
                     marker)
             elif os.path.exists("/usr/share/appdata"):
-                copyDesktopFile(
+                copyAppStreamFile(
                     os.path.join(sourceDir, "eric6.appdata.xml"),
                     "/usr/share/appdata/eric6" + marker + ".appdata.xml",
                     marker)

eric ide

mercurial