Making it easier to do distribution specific building
[nqaap] / build_nqaap_maemo5.py
index 5854d83..2c585a3 100644 (file)
@@ -1,17 +1,22 @@
-#!/usr/bin/python2.5\r
- # -*- coding: utf-8 -*-\r
- ## This program is free software; you can redistribute it and/or modify\r
- ## it under the terms of the GNU General Public License as published\r
- ## by the Free Software Foundation; version 2 only.\r
- ##\r
- ## This program is distributed in the hope that it will be useful,\r
- ## but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- ## GNU General Public License for more details.\r
- ##\r
+#!/usr/bin/env python\r
+# -*- coding: utf-8 -*-\r
+\r
+"""\r
+This program is free software; you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published\r
+by the Free Software Foundation; version 2 only.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+GNU General Public License for more details.\r
+"""\r
+\r
 import py2deb\r
 import os\r
-if __name__ == "__main__":\r
+\r
+\r
+def build_package(distribution):\r
     try:\r
         os.chdir(os.path.dirname(sys.argv[0]))\r
     except:\r
@@ -20,19 +25,39 @@ if __name__ == "__main__":
     p=py2deb.Py2deb("nqaap") #This is the package name and MUST be in\r
                                #lowercase! (using e.g. "mClock" fails\r
                                #miserably...)\r
-    p.description="Very simple Audiobook player. \nSupports playing, pausing, seeking (sort of) and saving state when changing book/closing.\nPlays books arranged as dirs under myDocs/Audiobooks"\r
+    p.description="""Very simple Audiobook player.\r
+Supports playing, pausing, seeking (sort of) and saving state when changing book/closing.\r
+Plays books arranged as dirs under myDocs/Audiobooks\r
+Homepage: http://nqaap.garage.maemo.org/"""\r
     p.author="Soeren 'Pengman' Pedersen"\r
     p.mail="pengmeister@gmail.com"\r
-    p.depends = "python2.5, python2.5-gtk2, python2.5-dbus, python2.5-telepathy, python2.5-gobject, python-gst0.10"\r
-    p.section="user/multimedia"\r
+    p.depends = ", ".join([\r
+        "python2.6 | python2.5",\r
+        "python-gtk2 | python2.5-gtk2",\r
+        "python-dbus | python2.5-dbus",\r
+        "python-telepathy | python2.5-telepathy",\r
+        "python-gobject | python2.5-gobject",\r
+    ])\r
+    maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"\r
+    p.depends += {\r
+        "debian": ", python-gst0.10",\r
+        "diablo": maemoSpecificDepends,\r
+        "fremantle": maemoSpecificDepends+", python-gst0.10",\r
+    }[distribution]\r
+    p.section = {\r
+        "debian": "multimedia",\r
+        "diablo": "user/multimedia",\r
+        "fremantle": "user/multimedia",\r
+    }[distribution]\r
     p.icon = "/usr/share/icons/hicolor/48x48/hildon/nqaap.png"\r
     p.arch="all"                #should be all for python, any for all arch\r
     p.urgency="low"             #not used in maemo onl for deb os\r
-    p.distribution="fremantle"\r
-    p.repository="extras-devel"\r
+    p.distribution=distribution\r
+    p.repository="extras"\r
     p.xsbc_bugtracker="http://talk.maemo.org/showthread.php?p=619738"\r
-    #  p.postinstall="""#!/bin/sh\r
-    #  chmod +x /usr/bin/mclock.py""" #Set here your post install script\r
+    p.postinstall="""#!/bin/sh\r
+rm -f ~/.nqaap/nqaap.log\r
+"""\r
     #  p.postremove="""#!/bin/sh\r
     #  chmod +x /usr/bin/mclock.py""" #Set here your post remove script\r
     #  p.preinstall="""#!/bin/sh\r
@@ -64,7 +89,6 @@ if __name__ == "__main__":
                                 #to leave it named src in all projects\r
                                 #and will refer to that in the wiki\r
                                 #article on maemo.org\r
-                                \r
     #Thanks to DareTheHair from talk.maemo.org for this snippet that\r
     #recursively builds the file list\r
     for root, dirs, files in os.walk(dir_name):\r
@@ -78,5 +102,32 @@ if __name__ == "__main__":
             fake_file.append(root + os.sep + f + "|" + f)\r
         if len(fake_file) > 0:\r
             p[real_dir] = fake_file\r
+\r
     print p\r
-    r = p.generate(version,build,changelog=changeloginformation,tar=True,dsc=True,changes=True,build=False,src=True)\r
+    if distribution == "debian":\r
+        print p.generate(\r
+            version,\r
+            build,\r
+            changelog=changeloginformation,\r
+            build=True,\r
+            tar=False,\r
+            changes=False,\r
+            dsc=False,\r
+            src=False,\r
+        )\r
+    else:\r
+        print p.generate(\r
+            version,\r
+            build,\r
+            changelog=changeloginformation,\r
+            build=False,\r
+            tar=True,\r
+            changes=True,\r
+            dsc=True,\r
+            src=True,\r
+        )\r
+    print "Building for %s finished" % distribution\r
+\r
+\r
+if __name__ == "__main__":\r
+    build_package("fremantle")\r