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