Minor fixes either made directly or found good in dialcentral and brought over
[ejpi] / support / builddeb.py
1 #!/usr/bin/python2.5
2
3 from py2deb import *
4
5
6 __appname__ = "ejpi"
7 __description__ = "RPN Calculator"
8 __author__ = "Ed Page"
9 __email__ = "eopage@byu.net"
10 __version__ = "0.9.2"
11 __build__ = 0
12 __changelog__ = '''\
13 0.9.2 - ""
14  * Experimenting with faster startup by including pyc files in package
15
16 0.9.1 - "Laziness doesn't always pay off"
17  * Profiled the code with an especial focus on the pie menus
18  * Tried to reduce potential bugs with double clicks
19  * Fixed a visual artifact issue on popup
20
21 0.9.0 - "Feed is for horses, so what about feedback?"
22  * Initial public release
23  * Pie menus for keys
24  * Modifiable history
25  * Supports different number types and bases
26  * Basic trig support
27 '''
28
29
30 __postinstall__ = '''#!/bin/sh
31
32 gtk-update-icon-cache /usr/share/icons/hicolor
33 '''
34
35
36 def find_files(path):
37         for root, dirs, files in os.walk(path):
38                 for file in files:
39                         if file.startswith("src-"):
40                                 fileParts = file.split("-")
41                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
42                                 assert unused == "src"
43                                 relPath = os.sep.join(relPathParts)
44                                 yield relPath, file, newName
45
46
47 def unflatten_files(files):
48         d = {}
49         for relPath, oldName, newName in files:
50                 if relPath not in d:
51                         d[relPath] = []
52                 d[relPath].append((oldName, newName))
53         return d
54
55
56 if __name__ == "__main__":
57         try:
58                 os.chdir(os.path.dirname(sys.argv[0]))
59         except:
60                 pass
61
62         p = Py2deb(__appname__)
63         p.description = __description__
64         p.author = __author__
65         p.mail = __email__
66         p.license = "lgpl"
67         p.depends = "python2.5, python2.5-gtk2"
68         p.section = "user/accessories"
69         p.arch = "all"
70         p.urgency = "low"
71         p.distribution = "chinook diablo"
72         p.repository = "extras-devel"
73         p.changelog = __changelog__
74         p.postinstall = __postinstall__
75         p.icon="26x26-ejpi.png"
76         p["/usr/bin"] = [ "ejpi.py" ]
77         for relPath, files in unflatten_files(find_files(".")).iteritems():
78                 fullPath = "/usr/lib/ejpi"
79                 if relPath:
80                         fullPath += os.sep+relPath
81                 p[fullPath] = list(
82                         "|".join((oldName, newName))
83                         for (oldName, newName) in files
84                 )
85         p["/usr/share/applications/hildon"] = ["ejpi.desktop"]
86         # p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-ejpi.png|ejpi.png"]
87         # p["/usr/share/icons/hicolor/64x64/hildon"] = ["64x64-ejpi.png|ejpi.png"]
88         # p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-ejpi.png|ejpi.png"]
89
90         print p
91         print p.generate(
92                 __version__, __build__, changelog=__changelog__,
93                 tar=True, dsc=True, changes=True, build=False, src=True
94         )