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