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