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