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

Sat, 08 Oct 2016 19:59:32 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 08 Oct 2016 19:59:32 +0200
changeset 5214
0473e5256ca9
parent 5212
9162e25f77ab
child 5215
c7eb25505d6c

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:01:03 2016 +0200
+++ b/eric6.appdata.xml	Sat Oct 08 19:59:32 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,5 +24,12 @@
   <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>
-</application>
+ <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:01:03 2016 +0200
+++ b/install.py	Sat Oct 08 19:59:32 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.
@@ -827,7 +865,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)
@@ -840,12 +878,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