Bump to 0.8.0-3
[nqaap] / build_nqaap.py
1 #!/usr/bin/env python\r
2 # -*- coding: utf-8 -*-\r
3 \r
4 """\r
5 This program is free software; you can redistribute it and/or modify\r
6 it under the terms of the GNU General Public License as published\r
7 by the Free Software Foundation; version 2 only.\r
8 \r
9 This program is distributed in the hope that it will be useful,\r
10 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12 GNU General Public License for more details.\r
13 """\r
14 \r
15 import os\r
16 import sys\r
17 \r
18 import py2deb\r
19 \r
20 \r
21 def build_package(distribution):\r
22     try:\r
23         os.chdir(os.path.dirname(sys.argv[0]))\r
24     except:\r
25         pass\r
26     print\r
27     p=py2deb.Py2deb("nqaap") #This is the package name and MUST be in\r
28                                #lowercase! (using e.g. "mClock" fails\r
29                                #miserably...)\r
30     p.description="""Very simple Audiobook player.\r
31 Supports playing, pausing, seeking (sort of) and saving state when changing book/closing.\r
32 Plays books arranged as dirs under myDocs/Audiobooks\r
33 .\r
34 Homepage: http://nqaap.garage.maemo.org/"""\r
35     p.author="Soeren 'Pengman' Pedersen"\r
36     p.mail="pengmeister@gmail.com"\r
37     p.depends = ", ".join([\r
38         "python2.6 | python2.5",\r
39         "python-gtk2 | python2.5-gtk2",\r
40         "python-dbus | python2.5-dbus",\r
41         "python-telepathy | python2.5-telepathy",\r
42         "python-gobject | python2.5-gobject",\r
43     ])\r
44     maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"\r
45     p.depends += {\r
46         "debian": ", python-gst0.10",\r
47         "diablo": maemoSpecificDepends,\r
48         "fremantle": maemoSpecificDepends+", python-gst0.10",\r
49     }[distribution]\r
50     p.section = {\r
51         "debian": "multimedia",\r
52         "diablo": "user/multimedia",\r
53         "fremantle": "user/multimedia",\r
54     }[distribution]\r
55     p.icon = "/usr/share/icons/hicolor/48x48/hildon/nqaap.png"\r
56     p.arch="all"                #should be all for python, any for all arch\r
57     p.urgency="low"             #not used in maemo onl for deb os\r
58     p.distribution=distribution\r
59     p.repository="extras"\r
60     p.xsbc_bugtracker="http://talk.maemo.org/showthread.php?p=619738"\r
61     p.postinstall="""#!/bin/sh\r
62 rm -f ~/.nqaap/nqaap.log\r
63 """\r
64     #  p.postremove="""#!/bin/sh\r
65     #  chmod +x /usr/bin/mclock.py""" #Set here your post remove script\r
66     #  p.preinstall="""#!/bin/sh\r
67     #  chmod +x /usr/bin/mclock.py""" #Set here your pre install script\r
68     #  p.preremove="""#!/bin/sh\r
69     #  chmod +x /usr/bin/mclock.py""" #Set here your pre remove script\r
70     version = "0.8.0"           #Version of your software, e.g. "1.2.0" or "0.8.2"\r
71     build = "2" #Build number, e.g. "1" for the first build of this\r
72                                 #version of your software. Increment\r
73                                 #for later re-builds of the same\r
74                                 #version of your software.  Text with\r
75                                 #changelog information to be displayed\r
76                                 #in the package "Details" tab of the\r
77                                 #Maemo Application Manager\r
78     changeloginformation = "Merged changes from EPage (proper changelog later)\nNew Icon by Strutten."\r
79     # 0.7.2 : Seek bar now responds to clicks (rather than drags)\nFixed bug with wrong text showing on button after changed chapter.\r
80     # 0.7.1 : Fixed crash when current points to non existing book\r
81     # 0.7.0 : Now ignores pressed outside the chapter selection menu\nAdded help\r
82     # 0.6.1 : Fixed bug that prevented running on devices without Audiobook folder.\r
83     #         Added tip on where to place audiobooks.\r
84     # 0.6.0 : Now also plays .mp3 files\r
85     # 0.5.0 : Second release. Now shows which chapter is playing, and scrolls to it when changing.\r
86     # 0.4.9 : First release. Now it should work\r
87     #  \r
88     dir_name = "src" #Name of the subfolder containing your package\r
89                                 #source files\r
90                                 #(e.g. usr\share\icons\hicolor\scalable\myappicon.svg,\r
91                                 #usr\lib\myapp\somelib.py). We suggest\r
92                                 #to leave it named src in all projects\r
93                                 #and will refer to that in the wiki\r
94                                 #article on maemo.org\r
95     #Thanks to DareTheHair from talk.maemo.org for this snippet that\r
96     #recursively builds the file list\r
97     for root, dirs, files in os.walk(dir_name):\r
98         real_dir = root[len(dir_name):]\r
99         if '.' in real_dir:\r
100             continue # if some part of the dirname contains '.' we\r
101                                         # ignore all files (avoid .svn\r
102                                         # and others)\r
103         fake_file = []\r
104         for f in files:\r
105             fake_file.append(root + os.sep + f + "|" + f)\r
106         if len(fake_file) > 0:\r
107             p[real_dir] = fake_file\r
108 \r
109     print p\r
110     if distribution == "debian":\r
111         print p.generate(\r
112             version,\r
113             build,\r
114             changelog=changeloginformation,\r
115             build=True,\r
116             tar=False,\r
117             changes=False,\r
118             dsc=False,\r
119             src=False,\r
120         )\r
121     else:\r
122         print p.generate(\r
123             version,\r
124             build,\r
125             changelog=changeloginformation,\r
126             build=False,\r
127             tar=True,\r
128             changes=True,\r
129             dsc=True,\r
130             src=True,\r
131         )\r
132     print "Building for %s finished" % distribution\r
133 \r
134 \r
135 if __name__ == "__main__":\r
136     build_package("fremantle")\r