Updating build number due to small changes and enabling .desktop file
[doneit] / support / builddeb.py
1 #!/usr/bin/python2.5
2
3 from py2deb import *
4
5
6 __appname__ = "doneit"
7 __description__ = "Todo Manager"
8 __author__ = "Ed Page"
9 __email__ = "eopage@byu.net"
10 __version__ = "0.3.0"
11 __build__ = 1
12 __changelog__ = '''\
13 0.3.0
14  * Initial Release
15  * Backend Support: Remember The Milk
16  * Completing of tasks
17  * Browse to task URLs
18  * Task editing:
19    * Task list
20    * Task Name
21    * Task Priority
22    * Task Due Date
23  * Note Viewer / Editor
24  * Not supported:
25    * Adding, renaming, and (un)archiving of lists
26    * Uncompleting a task and viewing completed tasks
27    * Viewing/editing of task recurrence, time estimate, tags, location, url
28    * Postponing tasks
29 '''
30
31
32 __postinstall__ = '''#!/bin/sh
33
34 gtk-update-icon-cache /usr/share/icons/hicolor
35 '''
36
37
38 def find_files(path):
39         for root, dirs, files in os.walk(path):
40                 for file in files:
41                         if file.startswith("src-"):
42                                 fileParts = file.split("-")
43                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
44                                 assert unused == "src"
45                                 relPath = os.sep.join(relPathParts)
46                                 yield relPath, file, newName
47
48
49 def unflatten_files(files):
50         d = {}
51         for relPath, oldName, newName in files:
52                 if relPath not in d:
53                         d[relPath] = []
54                 d[relPath].append((oldName, newName))
55         return d
56
57
58 if __name__ == "__main__":
59         try:
60                 os.chdir(os.path.dirname(sys.argv[0]))
61         except:
62                 pass
63
64         p = Py2deb(__appname__)
65         p.description = __description__
66         p.author = __author__
67         p.mail = __email__
68         p.license = "lgpl"
69         p.depends = "python2.5, python2.5-gtk2"
70         p.section = "user/communication"
71         p.arch = "all"
72         p.urgency = "low"
73         p.distribution = "chinook diablo"
74         p.repository = "extras-devel"
75         p.changelog = __changelog__
76         p.postinstall = __postinstall__
77         p.icon="26x26-doneit.png"
78         p["/usr/bin"] = [ "doneit.py" ]
79         for relPath, files in unflatten_files(find_files(".")).iteritems():
80                 fullPath = "/usr/lib/doneit"
81                 if relPath:
82                         fullPath += os.sep+relPath
83                 p[fullPath] = list(
84                         "|".join((oldName, newName))
85                         for (oldName, newName) in files
86                 )
87         p["/usr/share/applications/hildon"] = ["doneit.desktop"]
88         # p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-doneit.png|doneit.png"]
89         # p["/usr/share/icons/hicolor/64x64/hildon"] = ["64x64-doneit.png|doneit.png"]
90         # p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-doneit.png|doneit.png"]
91
92         print p
93         print p.generate(
94                 __version__, __build__, changelog=__changelog__,
95                 tar=True, dsc=True, changes=True, build=False, src=True
96         )