Merge branch 'simpad' into org.openembedded.dev
[openembedded.git] / contrib / python / generate-manifest-2.4.py
1 #!/usr/bin/env python
2
3 # generate Python Manifest for the OpenEmbedded build system
4 # (C) 2002-2007 Michael 'Mickey' Lauer <mickey@Vanille.de>
5 # MIT license
6
7 import os
8 import sys
9 import time
10
11 VERSION = "2.4.4"
12 # increase when touching python-core
13 BASEREV = 2
14
15 __author__ = "Michael 'Mickey' Lauer <mickey@Vanille.de>"
16 __version__ = "20070721"
17
18 class MakefileMaker:
19
20     def __init__( self, outfile ):
21         """initialize"""
22         self.packages = {}
23         self.sourcePrefix = "/lib/python%s/" % VERSION[:3]
24         self.targetPrefix = "${libdir}/python%s" % VERSION[:3]
25         self.output = outfile
26         self.out( "#" * 120 )
27         self.out( "### AUTO-GENERATED by '%s' [(C) 2002-2007 Michael 'Mickey' Lauer <mickey@Vanille.de>] on %s" % ( sys.argv[0], time.asctime() ) )
28         self.out( "###" )
29         self.out( "### Visit THE Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy" )
30         self.out( "###" )
31         self.out( "### Warning: Manual edits will be lost!" )
32         self.out( "###" )
33         self.out( "#" * 120 )
34     #
35     # helper functions
36     #
37
38     def out( self, data ):
39         """print a line to the output file"""
40         print >> self.output, data
41
42     def setPrefix( self, sourcePrefix, targetPrefix ):
43         """set a file prefix for addPackage files"""
44         self.sourcePrefix = sourcePrefix
45         self.targetPrefix = targetPrefix
46
47     def doProlog( self ):
48         self.out( """ """ )
49         self.out( "" )
50
51     def addPackage( self, revision, name, description, dependencies, filenames ):
52         """add a package to the Makefile"""
53         if type( filenames ) == type( "" ):
54             filenames = filenames.split()
55         fullFilenames = []
56         for filename in filenames:
57             if filename[0] != "/":
58                 fullFilenames.append( ( "%s%s" % ( self.sourcePrefix, filename ), "%s%s" % ( self.targetPrefix, filename ) ) )
59             else:
60                 fullFilenames.append( ( filename, filename ) )
61         self.packages[name] = revision, description, dependencies, fullFilenames
62
63     def doBody( self ):
64         """generate body of Makefile"""
65
66         global VERSION
67
68         #
69         # generate provides line
70         # 
71  
72         provideLine = 'PROVIDES+="'
73         for name in self.packages:
74             provideLine += "%s " % name
75         provideLine += '"'
76
77         self.out( provideLine )
78         self.out( "" )       
79
80         #
81         # generate package line
82         #
83
84         packageLine = 'PACKAGES="'
85         for name in self.packages:
86             packageLine += "%s " % name
87         packageLine += '"'
88
89         self.out( packageLine )
90         self.out( "" )
91
92         #
93         # generate package variables
94         #
95
96         for name, data in self.packages.iteritems():
97             rev, desc, deps, files = data
98
99             #
100             # write out the description, revision and dependencies
101             #
102             self.out( 'DESCRIPTION_%s="%s"' % ( name, desc ) )
103             self.out( 'PR_%s="ml%d"' % ( name, rev + BASEREV ) )
104             self.out( 'RDEPENDS_%s="%s"' % ( name, deps.replace( ",", "" ) ) )
105
106             line = 'FILES_%s="' % name
107
108             #
109             # check which directories to make in the temporary directory
110             #
111
112             dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead.
113             for source, target in files:
114                 dirset[os.path.dirname( target )] = True
115
116             #
117             # generate which files to copy for the target (-dfR because whole directories are also allowed)
118             #
119
120             for source, target in files:
121                 line += "%s " % target
122
123             line += '"'
124             self.out( line )
125             self.out( "" )
126
127     def doEpilog( self ):
128         self.out( """""" )
129         self.out( "" )
130
131     def make( self ):
132         self.doProlog()
133         self.doBody()
134         self.doEpilog()
135
136 if __name__ == "__main__":
137
138     if len( sys.argv ) > 1:
139         os.popen( "rm -f ./%s" % sys.argv[1] )
140         outfile = file( sys.argv[1], "w" )
141     else:
142         outfile = sys.stdout
143
144     m = MakefileMaker( outfile )
145
146     # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies!
147     # Parameters: revision, name, description, dependencies, filenames
148     #
149
150     m.setPrefix( "/", "/usr/" )
151
152     m.addPackage( 2, "python-core", "Python Interpreter and core modules (needed!)", "",
153     "lib/python2.4/__future__.* lib/python2.4/copy.* lib/python2.4/copy_reg.* lib/python2.4/ConfigParser.* " +
154     "lib/python2.4/getopt.* lib/python2.4/linecache.* lib/python2.4/new.* " +
155     "lib/python2.4/os.* lib/python2.4/posixpath.* " +
156     "lib/python2.4/warnings.* lib/python2.4/site.* lib/python2.4/stat.* " +
157     "lib/python2.4/UserDict.* lib/python2.4/UserList.* lib/python2.4/UserString.* " +
158     "lib/python2.4/lib-dynload/binascii.so lib/python2.4/lib-dynload/struct.so lib/python2.4/lib-dynload/time.so " +
159     "lib/python2.4/lib-dynload/xreadlines.so lib/python2.4/types.* bin/python*" )
160
161     m.addPackage( 0, "python-core-dbg", "Python core module debug information", "python-core",
162     "lib/python2.4/lib-dynload/.debug bin/.debug lib/.debug" )
163
164     m.addPackage( 0, "python-devel", "Python Development Package", "python-core",
165     "include lib/python2.4/config" ) # package
166
167     m.addPackage( 0, "python-idle", "Python Integrated Development Environment", "python-core, python-tkinter",
168     "bin/idle lib/python2.4/idlelib" ) # package
169
170     m.addPackage( 0, "python-pydoc", "Python Interactive Help Support", "python-core, python-lang, python-stringold, python-re",
171     "bin/pydoc lib/python2.4/pydoc.*" )
172
173     m.addPackage( 0, "python-smtpd", "Python Simple Mail Transport Daemon", "python-core python-netserver python-email python-mime",
174     "bin/smtpd.*" )
175
176     m.setPrefix( "/lib/python2.4/", "${libdir}/python2.4/" )
177
178     m.addPackage( 0, "python-audio", "Python Audio Handling", "python-core",
179     "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.so lib-dynload/audioop.so" )
180
181     m.addPackage( 0, "python-bsddb", "Python Berkeley Database Bindings", "python-core",
182     "bsddb" ) # package
183
184     m.addPackage( 0, "python-codecs", "Python Codecs, Encodings & i18n Support", "python-core",
185     "codecs.* encodings gettext.* locale.* lib-dynload/_locale.so lib-dynload/unicodedata.so stringprep.* xdrlib.*" )
186
187     m.addPackage( 0, "python-compile", "Python Bytecode Compilation Support", "python-core",
188     "py_compile.* compileall.*" )
189
190     m.addPackage( 0, "python-compiler", "Python Compiler Support", "python-core",
191     "compiler" ) # package
192
193     m.addPackage( 0, "python-compression", "Python High Level Compression Support", "python-core, python-zlib",
194     "gzip.* zipfile.*" )
195
196     m.addPackage( 0, "python-crypt", "Python Basic Cryptographic and Hashing Support", "python-core",
197     "lib-dynload/crypt.so lib-dynload/md5.so lib-dynload/rotor.so lib-dynload/sha.so" )
198
199     m.addPackage( 0, "python-textutils", "Python Option Parsing, Text Wrapping and Comma-Separated-Value Support", "python-core, python-io, python-re, python-stringold",
200     "lib-dynload/_csv.so csv.* optparse.* textwrap.*" )
201
202     m.addPackage( 0, "python-curses", "Python Curses Support", "python-core",
203     "curses lib-dynload/_curses.so lib-dynload/_curses_panel.so" ) # package
204
205     m.addPackage( 0, "python-datetime", "Python Calendar and Time support", "python-core, python-codecs",
206     "_strptime.* calendar.* lib-dynload/datetime.so" )
207
208     m.addPackage( 0, "python-db", "Python File-Based Database Support", "python-core",
209     "anydbm.* dumbdbm.* whichdb.* " )
210
211     m.addPackage( 0, "python-debugger", "Python Debugger", "python-core, python-io, python-lang, python-re, python-stringold, python-shell",
212     "bdb.* pdb.*" )
213
214     m.addPackage( 0, "python-distutils", "Python Distribution Utilities", "python-core",
215     "config distutils" ) # package
216
217     m.addPackage( 0, "python-email", "Python Email Support", "python-core, python-io, python-re, python-mime, python-audio python-image",
218     "email" ) # package
219
220     m.addPackage( 0, "python-fcntl", "Python's fcntl Interface", "python-core",
221     "lib-dynload/fcntl.so" )
222
223     m.addPackage( 0, "python-hotshot", "Python Hotshot Profiler", "python-core",
224     "hotshot lib-dynload/_hotshot.so" )
225
226     m.addPackage( 0, "python-html", "Python HTML Processing", "python-core",
227     "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* " )
228
229     m.addPackage( 0, "python-gdbm", "Python GNU Database Support", "python-core",
230     "lib-dynload/gdbm.so" )
231
232     m.addPackage( 0, "python-image", "Python Graphical Image Handling", "python-core",
233     "colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" )
234
235     m.addPackage( 0, "python-io", "Python Low-Level I/O", "python-core, python-math",
236     "lib-dynload/_socket.so lib-dynload/_ssl.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so "
237     "pipes.* socket.* tempfile.* StringIO.* " )
238
239     m.addPackage( 0, "python-lang", "Python Low-Level Language Support", "python-core",
240     "lib-dynload/array.so lib-dynload/parser.so lib-dynload/operator.so lib-dynload/_weakref.so " +
241     "lib-dynload/itertools.so lib-dynload/collections.so lib-dynload/_bisect.so lib-dynload/_heapq.so " +
242     "atexit.* bisect.* code.* codeop.* dis.* heapq.* inspect.* keyword.* opcode.* repr.* token.* tokenize.* " + 
243     "traceback.* linecache.* weakref.*" )
244
245     m.addPackage( 0, "python-logging", "Python Logging Support", "python-core",
246     "logging" ) # package
247
248     m.addPackage( 0, "python-lib-old-and-deprecated", "Python Deprecated Libraries", "python-core",
249     "lib-old" ) # package
250
251     m.addPackage( 0, "python-tkinter", "Python Tcl/Tk Bindings", "python-core",
252     "lib-dynload/_tkinter.so lib-tk" ) # package
253
254     m.addPackage( 0, "python-math", "Python Math Support", "python-core",
255     "lib-dynload/cmath.so lib-dynload/math.so lib-dynload/_random.so random.* sets.*" )
256
257     m.addPackage( 0, "python-mime", "Python MIME Handling APIs", "python-core, python-io",
258     "mimetools.* uu.* quopri.* rfc822.*" )
259
260     m.addPackage( 0, "python-mmap", "Python Memory-Mapped-File Support", "python-core, python-io",
261     "lib-dynload/mmap.so " )
262
263     m.addPackage( 0, "python-unixadmin", "Python Unix Administration Support", "python-core",
264     "lib-dynload/nis.so lib-dynload/grp.so lib-dynload/pwd.so getpass.*" )
265
266     m.addPackage( 0, "python-netclient", "Python Internet Protocol Clients", "python-core, python-datetime, python-io, python-lang, python-logging, python-mime",
267     "*Cookie*.* " + 
268     "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.*" )
269
270     m.addPackage( 0, "python-netserver", "Python Internet Protocol Servers", "python-core, python-netclient",
271     "cgi.* BaseHTTPServer.* SimpleHTTPServer.* SocketServer.*" )
272
273     m.addPackage( 0, "python-pickle", "Python Persistence Support", "python-core, python-codecs, python-io, python-re",
274     "pickle.* shelve.* lib-dynload/cPickle.so" )
275
276     m.addPackage( 0, "python-pprint", "Python Pretty-Print Support", "python-core",
277     "pprint.*" )
278
279     m.addPackage( 0, "python-profile", "Python Basic Profiling Support", "python-core",
280     "profile.* pstats.*" )
281
282     m.addPackage( 0, "python-re", "Python Regular Expression APIs", "python-core",
283     "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin
284
285     m.addPackage( 0, "python-readline", "Python Readline Support", "python-core",
286     "lib-dynload/readline.so rlcompleter.*" )
287
288     m.addPackage( 0, "python-resource", "Python Resource Control Interface", "python-core",
289     "lib-dynload/resource.so" )
290
291     m.addPackage( 0, "python-shell", "Python Shell-Like Functionality", "python-core, python-re",
292     "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shutil.*" )
293
294     m.addPackage( 0, "python-robotparser", "Python robots.txt parser", "python-core, python-netclient",
295     "robotparser.*")
296
297     m.addPackage( 0, "python-subprocess", "Python Subprocess Support", "python-core, python-io, python-re, python-fcntl, python-pickle",
298     "subprocess.*" )
299
300     m.addPackage( 0, "python-stringold", "Python String APIs [deprecated]", "python-core, python-re",
301     "lib-dynload/strop.so string.*" )
302
303     m.addPackage( 0, "python-syslog", "Python's syslog Interface", "python-core",
304     "lib-dynload/syslog.so" )
305
306     m.addPackage( 0, "python-terminal", "Python Terminal Controlling Support", "python-core, python-io",
307     "pty.* tty.*" )
308
309     m.addPackage( 0, "python-tests", "Python Tests", "python-core",
310     "test" ) # package
311
312     m.addPackage( 0, "python-threading", "Python Threading & Synchronization Support", "python-core, python-lang",
313     "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" )
314
315     m.addPackage( 0, "python-unittest", "Python Unit Testing Framework", "python-core, python-stringold, python-lang",
316     "unittest.*" )
317
318     m.addPackage( 0, "python-xml", "Python basic XML support.", "python-core, python-re",
319     "lib-dynload/pyexpat.so xml xmllib.*" ) # package
320
321     m.addPackage( 0, "python-xmlrpc", "Python XMLRPC Support", "python-core, python-xml, python-netserver, python-lang",
322     "xmlrpclib.* SimpleXMLRPCServer.*" )
323
324     m.addPackage( 0, "python-zlib", "Python zlib Support.", "python-core",
325     "lib-dynload/zlib.so" )
326
327     m.addPackage( 0, "python-mailbox", "Python Mailbox Format Support", "python-core, python-mime",
328     "mailbox.*" )
329
330     m.make()