In a round about way, fixed the setting the date issue (I hope)
[doneit] / support / builddeb.py
1 #!/usr/bin/python2.5
2
3 from py2deb import *
4
5
6 __appname__ = "doneit"
7 __description__ = "Todo Manager"
8 __author__ = "Ed Page"
9 __email__ = "eopage@byu.net"
10 __version__ = "0.3.0"
11 __build__ = 0
12 __changelog__ = '''\
13 0.3.0
14  * Initial Release
15 '''
16
17
18 __postinstall__ = '''#!/bin/sh
19
20 gtk-update-icon-cache /usr/share/icons/hicolor
21 '''
22
23
24 def find_files(path):
25         for root, dirs, files in os.walk(path):
26                 for file in files:
27                         if file.startswith("src-"):
28                                 fileParts = file.split("-")
29                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
30                                 assert unused == "src"
31                                 relPath = os.sep.join(relPathParts)
32                                 yield relPath, file, newName
33
34
35 def unflatten_files(files):
36         d = {}
37         for relPath, oldName, newName in files:
38                 if relPath not in d:
39                         d[relPath] = []
40                 d[relPath].append((oldName, newName))
41         return d
42
43
44 if __name__ == "__main__":
45         try:
46                 os.chdir(os.path.dirname(sys.argv[0]))
47         except:
48                 pass
49
50         p = Py2deb(__appname__)
51         p.description = __description__
52         p.author = __author__
53         p.mail = __email__
54         p.license = "lgpl"
55         p.depends = "python2.5, python2.5-gtk2"
56         p.section = "user/communication"
57         p.arch = "all"
58         p.urgency = "low"
59         p.distribution = "chinook diablo"
60         p.repository = "extras-devel"
61         p.changelog = __changelog__
62         p.postinstall = __postinstall__
63         p.icon="26x26-doneit.png"
64         p["/usr/bin"] = [ "doneit.py" ]
65         for relPath, files in unflatten_files(find_files(".")).iteritems():
66                 fullPath = "/usr/lib/doneit"
67                 if relPath:
68                         fullPath += os.sep+relPath
69                 p[fullPath] = list(
70                         "|".join((oldName, newName))
71                         for (oldName, newName) in files
72                 )
73         # p["/usr/share/applications/hildon"] = ["doneit.desktop"]
74         # p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-doneit.png|doneit.png"]
75         # p["/usr/share/icons/hicolor/64x64/hildon"] = ["64x64-doneit.png|doneit.png"]
76         # p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-doneit.png|doneit.png"]
77
78         print p
79         print p.generate(
80                 __version__, __build__, changelog=__changelog__,
81                 tar=True, dsc=True, changes=True, build=False, src=True
82         )