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