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