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