Renamed
[netstory] / build_netstory.py
1 #!/usr/bin/python2.5\r
2 # -*- coding: utf-8 -*-\r
3 ## This program is free software; you can redistribute it and/or modify\r
4 ## it under the terms of the GNU General Public License as published\r
5 ## by the Free Software Foundation; version 2 only.\r
6 ##\r
7 ## This program is distributed in the hope that it will be useful,\r
8 ## but WITHOUT ANY WARRANTY; without even the implied warranty of\r
9 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
10 ## GNU General Public License for more details.\r
11 ##\r
12 import py2deb\r
13 import os\r
14 if __name__ == "__main__":\r
15     try:\r
16         os.chdir(os.path.dirname(sys.argv[0]))\r
17     except:\r
18         pass\r
19     print\r
20     p=py2deb.Py2deb("netstory")   #This is the package name and MUST be in lowercase! (using e.g. "mClock" fails miserably...)\r
21     p.description="Record and view your home network data counter periodically.\n"\\r
22                   "This utility consists of two parts:\n"\\r
23                   "a daemon that records network data counters in background and\n"\\r
24                   "an GUI application to view hourly, daily, weekly and monthly net traffics."\r
25     p.author="Jere Malinen"\r
26     p.mail="jeremmalinen@gmail.com"\r
27     p.depends = "python2.5, python2.5-qt4-core, python2.5-qt4-gui"\r
28 \r
29     p.section="user/network"\r
30 \r
31     p.icon = "/home/user/MyDocs/py2deb/netstory/src/usr/share/icons/hicolor/48x48/hildon/netstory.png"\r
32     p.arch="all"             #should be all for python, any for all arch\r
33     p.urgency="low"           #not used in maemo onl for deb os\r
34     p.distribution="fremantle"\r
35     p.repository="extras-devel"\r
36     p.xsbc_bugtracker="https://garage.maemo.org/tracker/?atid=5917&group_id=1670&func=browse"\r
37     p.postinstall="""#!/bin/sh\r
38         chmod +x /opt/netstory/netstory.py /opt/netstory/netstoryd.py  || echo "Warning: chmod failed. The package might not work properly"\r
39         start netstoryd || echo "Warning: Starting the netstory daemon failed. The package might not work properly."\r
40         """ #Set here your post install script\r
41     #  p.postremove="""#!/bin/sh\r
42     #  chmod +x /usr/bin/mclock.py""" #Set here your post remove script\r
43     #  p.preinstall="""#!/bin/sh\r
44     #  chmod +x /usr/bin/mclock.py""" #Set here your pre install script\r
45     p.preremove="""#!/bin/sh\r
46         stop netstoryd || echo "Warning: Stopping the netstoryd daemon failed."\r
47         rm -f /opt/netstory/*.pyc /opt/netstory/*.pyo\r
48         """ #Set here your pre remove script\r
49     version = "0.1.2"         #Version of your software, e.g. "1.2.0" or "0.8.2"\r
50     build = "1"              #Build number, e.g. "1" for the first build of this version of your software. Increment for later re-builds of the same version of your software.\r
51                            #Text with changelog information to be displayed in the package "Details" tab of the Maemo Application Manager\r
52     changeloginformation = 'Adjusted width of the columns.'\r
53     dir_name = "src"          #Name of the subfolder containing your package source files (e.g. usr\share\icons\hicolor\scalable\myappicon.svg, usr\lib\myapp\somelib.py). We suggest to leave it named src in all projects and will refer to that in the wiki article on maemo.org\r
54     #Thanks to DareTheHair from talk.maemo.org for this snippet that recursively builds the file list \r
55     for root, dirs, files in os.walk(dir_name):\r
56         real_dir = root[len(dir_name):]\r
57         fake_file = []\r
58         for f in files:\r
59            fake_file.append(root + os.sep + f + "|" + f)\r
60         if len(fake_file) > 0:\r
61            p[real_dir] = fake_file\r
62     print p\r
63     r = p.generate(version,build,changelog=changeloginformation,tar=True,dsc=True,changes=True,build=False,src=True)