Version bump
[quicknote] / support / builddeb.py
1 #!/usr/bin/python2.5
2
3 import os
4 import sys
5
6 try:
7         import py2deb
8 except ImportError:
9         import fake_py2deb as py2deb
10
11 import constants
12
13 __appname__ = constants.__app_name__
14 __description__ = "Simple note taking application in a similar vein as PalmOS Memos"
15 __author__ = "Christoph Wurstle"
16 __email__ = "n800@axique.net"
17 __version__ = constants.__version__
18 __build__ = 0
19 __changelog__ = '''
20 0.7.8
21
22 0.7.7
23  * Slight modifications to the note history and SQL dialogs
24  * On zoom, also hiding the history status and button
25  * Touched up the note list, making it ellipsize at the end rather than scroll
26  * Storing of zoom, wordwrap, and fullscreen settings
27
28 0.7.6
29   * Line-wrap
30   * Zoom
31
32 0.7.4
33   * fixed small bugs
34   * move category
35
36 0.7.3
37   * fixed small bugs
38   * move category
39
40 0.7.2
41   * improved sync, fixed a small bug
42
43 0.7.1
44   * improved sync
45
46 0.7.0
47   * Initial Release.
48 '''
49
50
51 __postinstall__ = '''#!/bin/sh -e
52
53 gtk-update-icon-cache -f /usr/share/icons/hicolor
54 exit 0
55 '''
56
57
58 def find_files(path, root):
59         print path, root
60         for unusedRoot, dirs, files in os.walk(path):
61                 for file in files:
62                         if file.startswith(root+"-"):
63                                 print "\t", root, file
64                                 fileParts = file.split("-")
65                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
66                                 assert unused == root
67                                 relPath = os.sep.join(relPathParts)
68                                 yield relPath, file, newName
69
70
71 def unflatten_files(files):
72         d = {}
73         for relPath, oldName, newName in files:
74                 if relPath not in d:
75                         d[relPath] = []
76                 d[relPath].append((oldName, newName))
77         return d
78
79
80 if __name__ == "__main__":
81         try:
82                 os.chdir(os.path.dirname(sys.argv[0]))
83         except:
84                 pass
85
86         p = py2deb.Py2deb(__appname__)
87         p.description = __description__
88         p.author = __author__
89         p.mail = __email__
90         p.license = "lgpl"
91         p.depends = "python2.5, python2.5-gtk2"
92         p.section = "user/other"
93         p.arch = "all"
94         p.urgency = "low"
95         p.distribution = "chinook diablo"
96         p.repository = "extras"
97         p.changelog = __changelog__
98         p.postinstall = __postinstall__
99         p.icon = "26x26-quicknote.png"
100         p["/usr/bin"] = [ "quicknote.py" ]
101         for relPath, files in unflatten_files(find_files(".", "locale")).iteritems():
102                 fullPath = "/usr/share/locale"
103                 if relPath:
104                         fullPath += os.sep+relPath
105                 p[fullPath] = list(
106                         "|".join((oldName, newName))
107                         for (oldName, newName) in files
108                 )
109         for relPath, files in unflatten_files(find_files(".", "src")).iteritems():
110                 fullPath = "/usr/lib/quicknote"
111                 if relPath:
112                         fullPath += os.sep+relPath
113                 p[fullPath] = list(
114                         "|".join((oldName, newName))
115                         for (oldName, newName) in files
116                 )
117         p["/usr/share/applications/hildon"] = ["quicknote.desktop"]
118         p["/usr/share/dbus-1/services"] = ["quicknote.service"]
119         p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-quicknote.png|quicknote.png"]
120         p["/usr/share/icons/hicolor/40x40/hildon"] = ["40x40-quicknote.png|quicknote.png"]
121         p["/usr/share/icons/hicolor/48x48/hildon"] = ["48x48-quicknote.png|quicknote.png"]
122         p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-quicknote.png|quicknote.png"]
123
124         print p
125         print p.generate(
126                 __version__, __build__, changelog=__changelog__,
127                 tar=True, dsc=True, changes=True, build=False, src=True
128         )