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