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