d7becb11bea822f7f8e26accf33e9e3fd9bf3a3d
[ejpi] / support / builddeb.py
1 #!/usr/bin/python2.5
2
3 import os
4 import sys
5
6 import py2deb
7
8 import constants
9
10
11 __appname__ = constants.__app_name__
12 __description__ = "A Touch Screen Optimized RPN Calculator using Pie Menus"
13 __author__ = "Ed Page"
14 __email__ = "eopage@byu.net"
15 __version__ = constants.__version__
16 __build__ = 0
17 __changelog__ = '''
18 0.9.5
19
20 0.9.4
21  * Added icons
22  * Minor improvements
23  * Swapping the keyboard positions, seem more friendly to my thumb location this way
24
25 0.9.3 - ""
26  * Added +/-, !, sq, and sqrt functions
27  * Improved Documentation
28  * Copy of calculation result and the corresponding equation
29  * Bug fixes
30
31 0.9.2 - ""
32  * Experimenting with faster startup by including pyc files in package
33  * Minor tweaks and bug fixes
34
35 0.9.1 - "Laziness doesn't always pay off"
36  * Profiled the code with an especial focus on the pie menus
37  * Tried to reduce potential bugs with double clicks
38  * Fixed a visual artifact issue on popup
39
40 0.9.0 - "Feed is for horses, so what about feedback?"
41  * Initial public release
42  * Pie menus for keys
43  * Modifiable history
44  * Supports different number types and bases
45  * Basic trig support
46 '''
47
48
49 __postinstall__ = '''#!/bin/sh
50
51 gtk-update-icon-cache /usr/share/icons/hicolor
52 '''
53
54
55 def find_files(path):
56         for root, dirs, files in os.walk(path):
57                 for file in files:
58                         if file.startswith("src-"):
59                                 fileParts = file.split("-")
60                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
61                                 assert unused == "src"
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/accessories"
88         p.arch = "all"
89         p.urgency = "low"
90         p.distribution = "chinook diablo"
91         p.repository = "extras"
92         p.changelog = __changelog__
93         p.postinstall = __postinstall__
94         p.icon="26x26-ejpi.png"
95         p["/usr/bin"] = [ "ejpi.py" ]
96         for relPath, files in unflatten_files(find_files(".")).iteritems():
97                 fullPath = "/usr/lib/ejpi"
98                 if relPath:
99                         fullPath += os.sep+relPath
100                 p[fullPath] = list(
101                         "|".join((oldName, newName))
102                         for (oldName, newName) in files
103                 )
104         p["/usr/share/applications/hildon"] = ["ejpi.desktop"]
105         p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-ejpi.png|ejpi.png"]
106         p["/usr/share/icons/hicolor/64x64/hildon"] = ["64x64-ejpi.png|ejpi.png"]
107         p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-ejpi.png|ejpi.png"]
108
109         print p
110         print p.generate(
111                 __version__, __build__, changelog=__changelog__,
112                 tar=True, dsc=True, changes=True, build=False, src=True
113         )