Fixing some more build issues
[ejpi] / support / builddeb.py
1 #!/usr/bin/python2.5
2
3 from py2deb import *
4
5
6 __appname__ = "ejpi"
7 __description__ = "RPN Calculator"
8 __author__ = "Ed Page"
9 __email__ = "eopage@byu.net"
10 __version__ = "0.9.0"
11 __build__ = 4
12 __changelog__ = '''\
13 0.9.0 - "Feed is for horses, so what about feedback?"
14 * Initial public release
15 * Pie menus for keys
16 * Modifiable history
17 * Supports different number types and bases
18 * Basic trig support
19 '''
20
21
22 __postinstall__ = '''#!/bin/sh
23
24 gtk-update-icon-cache /usr/share/icons/hicolor
25 '''
26
27
28 def find_files(path):
29         for root, dirs, files in os.walk(path):
30                 for file in files:
31                         if file.startswith("src-"):
32                                 fileParts = file.split("-")
33                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
34                                 assert unused == "src"
35                                 relPath = os.sep.join(relPathParts)
36                                 yield relPath, file, newName
37
38
39 def unflatten_files(files):
40         d = {}
41         for relPath, oldName, newName in files:
42                 if relPath not in d:
43                         d[relPath] = []
44                 d[relPath].append((oldName, newName))
45         return d
46
47
48 if __name__ == "__main__":
49         try:
50                 os.chdir(os.path.dirname(sys.argv[0]))
51         except:
52                 pass
53
54         p = Py2deb(__appname__)
55         p.description = __description__
56         p.author = __author__
57         p.mail = __email__
58         p.license = "lgpl"
59         p.depends = "python2.5, python2.5-gtk2"
60         # p.section = "user/utilities"
61         p.section = "user/accessories"
62         p.arch = "all"
63         p.urgency = "low"
64         p.distribution = "chinook diablo"
65         p.repository = "extras-devel"
66         p.changelog = __changelog__
67         p.postinstall = __postinstall__
68         p.icon="26x26-ejpi.png"
69         p["/usr/bin"] = [ "ejpi.py" ]
70         for relPath, files in unflatten_files(find_files(".")).iteritems():
71                 fullPath = "/usr/lib/ejpi"
72                 if relPath:
73                         fullPath += os.sep+relPath
74                 p[fullPath] = list(
75                         "|".join((oldName, newName))
76                         for (oldName, newName) in files
77                 )
78         p["/usr/share/applications/hildon"] = ["ejpi.desktop"]
79         # p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-dialcentral.png|dialcentral.png"]
80         # p["/usr/share/icons/hicolor/64x64/hildon"] = ["64x64-dialcentral.png|dialcentral.png"]
81         # p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-dialcentral.png|dialcentral.png"]
82
83         print p
84         print p.generate(
85                 __version__, __build__, changelog=__changelog__,
86                 tar=True, dsc=True, changes=True, build=False, src=True
87         )