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