nbd: Recipe for 2.9.11
[openembedded/mini2440.git] / contrib / python / generate-manifest-2.4.py
blob730c883bd3bc9e0b2a32db36d37cf816a767b470
1 #!/usr/bin/env python
3 # generate Python Manifest for the OpenEmbedded build system
4 # (C) 2002-2007 Michael 'Mickey' Lauer <mickey@Vanille.de>
5 # MIT license
7 import os
8 import sys
9 import time
11 VERSION = "2.4.4"
12 # increase when touching python-core
13 BASEREV = 2
15 __author__ = "Michael 'Mickey' Lauer <mickey@Vanille.de>"
16 __version__ = "20070721"
18 class MakefileMaker:
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 )
35 # helper functions
38 def out( self, data ):
39 """print a line to the output file"""
40 print >> self.output, data
42 def setPrefix( self, sourcePrefix, targetPrefix ):
43 """set a file prefix for addPackage files"""
44 self.sourcePrefix = sourcePrefix
45 self.targetPrefix = targetPrefix
47 def doProlog( self ):
48 self.out( """ """ )
49 self.out( "" )
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
63 def doBody( self ):
64 """generate body of Makefile"""
66 global VERSION
69 # generate provides line
72 provideLine = 'PROVIDES+="'
73 for name in self.packages:
74 provideLine += "%s " % name
75 provideLine += '"'
77 self.out( provideLine )
78 self.out( "" )
81 # generate package line
84 packageLine = 'PACKAGES="'
85 for name in self.packages:
86 packageLine += "%s " % name
87 packageLine += '"'
89 self.out( packageLine )
90 self.out( "" )
93 # generate package variables
96 for name, data in self.packages.iteritems():
97 rev, desc, deps, files = data
100 # write out the description, revision and dependencies
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( ",", "" ) ) )
106 line = 'FILES_%s="' % name
109 # check which directories to make in the temporary directory
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
117 # generate which files to copy for the target (-dfR because whole directories are also allowed)
120 for source, target in files:
121 line += "%s " % target
123 line += '"'
124 self.out( line )
125 self.out( "" )
127 def doEpilog( self ):
128 self.out( """""" )
129 self.out( "" )
131 def make( self ):
132 self.doProlog()
133 self.doBody()
134 self.doEpilog()
136 if __name__ == "__main__":
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
144 m = MakefileMaker( outfile )
146 # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies!
147 # Parameters: revision, name, description, dependencies, filenames
150 m.setPrefix( "/", "/usr/" )
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*" )
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" )
164 m.addPackage( 0, "python-devel", "Python Development Package", "python-core",
165 "include lib/python2.4/config" ) # package
167 m.addPackage( 0, "python-idle", "Python Integrated Development Environment", "python-core, python-tkinter",
168 "bin/idle lib/python2.4/idlelib" ) # package
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.*" )
173 m.addPackage( 0, "python-smtpd", "Python Simple Mail Transport Daemon", "python-core python-netserver python-email python-mime",
174 "bin/smtpd.*" )
176 m.setPrefix( "/lib/python2.4/", "${libdir}/python2.4/" )
178 m.addPackage( 0, "python-audio", "Python Audio Handling", "python-core",
179 "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.so lib-dynload/audioop.so" )
181 m.addPackage( 0, "python-bsddb", "Python Berkeley Database Bindings", "python-core",
182 "bsddb" ) # package
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.*" )
187 m.addPackage( 0, "python-compile", "Python Bytecode Compilation Support", "python-core",
188 "py_compile.* compileall.*" )
190 m.addPackage( 0, "python-compiler", "Python Compiler Support", "python-core",
191 "compiler" ) # package
193 m.addPackage( 0, "python-compression", "Python High Level Compression Support", "python-core, python-zlib",
194 "gzip.* zipfile.*" )
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" )
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.*" )
202 m.addPackage( 0, "python-curses", "Python Curses Support", "python-core",
203 "curses lib-dynload/_curses.so lib-dynload/_curses_panel.so" ) # package
205 m.addPackage( 0, "python-datetime", "Python Calendar and Time support", "python-core, python-codecs",
206 "_strptime.* calendar.* lib-dynload/datetime.so" )
208 m.addPackage( 0, "python-db", "Python File-Based Database Support", "python-core",
209 "anydbm.* dumbdbm.* whichdb.* " )
211 m.addPackage( 0, "python-debugger", "Python Debugger", "python-core, python-io, python-lang, python-re, python-stringold, python-shell",
212 "bdb.* pdb.*" )
214 m.addPackage( 0, "python-distutils", "Python Distribution Utilities", "python-core",
215 "config distutils" ) # package
217 m.addPackage( 0, "python-email", "Python Email Support", "python-core, python-io, python-re, python-mime, python-audio python-image",
218 "email" ) # package
220 m.addPackage( 0, "python-fcntl", "Python's fcntl Interface", "python-core",
221 "lib-dynload/fcntl.so" )
223 m.addPackage( 0, "python-hotshot", "Python Hotshot Profiler", "python-core",
224 "hotshot lib-dynload/_hotshot.so" )
226 m.addPackage( 0, "python-html", "Python HTML Processing", "python-core",
227 "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* " )
229 m.addPackage( 0, "python-gdbm", "Python GNU Database Support", "python-core",
230 "lib-dynload/gdbm.so" )
232 m.addPackage( 0, "python-image", "Python Graphical Image Handling", "python-core",
233 "colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" )
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.* " )
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.*" )
245 m.addPackage( 0, "python-logging", "Python Logging Support", "python-core",
246 "logging" ) # package
248 m.addPackage( 0, "python-lib-old-and-deprecated", "Python Deprecated Libraries", "python-core",
249 "lib-old" ) # package
251 m.addPackage( 0, "python-tkinter", "Python Tcl/Tk Bindings", "python-core",
252 "lib-dynload/_tkinter.so lib-tk" ) # package
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.*" )
257 m.addPackage( 0, "python-mime", "Python MIME Handling APIs", "python-core, python-io",
258 "mimetools.* uu.* quopri.* rfc822.*" )
260 m.addPackage( 0, "python-mmap", "Python Memory-Mapped-File Support", "python-core, python-io",
261 "lib-dynload/mmap.so " )
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.*" )
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.*" )
270 m.addPackage( 0, "python-netserver", "Python Internet Protocol Servers", "python-core, python-netclient",
271 "cgi.* BaseHTTPServer.* SimpleHTTPServer.* SocketServer.*" )
273 m.addPackage( 0, "python-pickle", "Python Persistence Support", "python-core, python-codecs, python-io, python-re",
274 "pickle.* shelve.* lib-dynload/cPickle.so" )
276 m.addPackage( 0, "python-pprint", "Python Pretty-Print Support", "python-core",
277 "pprint.*" )
279 m.addPackage( 0, "python-profile", "Python Basic Profiling Support", "python-core",
280 "profile.* pstats.*" )
282 m.addPackage( 0, "python-re", "Python Regular Expression APIs", "python-core",
283 "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin
285 m.addPackage( 0, "python-readline", "Python Readline Support", "python-core",
286 "lib-dynload/readline.so rlcompleter.*" )
288 m.addPackage( 0, "python-resource", "Python Resource Control Interface", "python-core",
289 "lib-dynload/resource.so" )
291 m.addPackage( 0, "python-shell", "Python Shell-Like Functionality", "python-core, python-re",
292 "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shutil.*" )
294 m.addPackage( 0, "python-robotparser", "Python robots.txt parser", "python-core, python-netclient",
295 "robotparser.*")
297 m.addPackage( 0, "python-subprocess", "Python Subprocess Support", "python-core, python-io, python-re, python-fcntl, python-pickle",
298 "subprocess.*" )
300 m.addPackage( 0, "python-stringold", "Python String APIs [deprecated]", "python-core, python-re",
301 "lib-dynload/strop.so string.*" )
303 m.addPackage( 0, "python-syslog", "Python's syslog Interface", "python-core",
304 "lib-dynload/syslog.so" )
306 m.addPackage( 0, "python-terminal", "Python Terminal Controlling Support", "python-core, python-io",
307 "pty.* tty.*" )
309 m.addPackage( 0, "python-tests", "Python Tests", "python-core",
310 "test" ) # package
312 m.addPackage( 0, "python-threading", "Python Threading & Synchronization Support", "python-core, python-lang",
313 "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" )
315 m.addPackage( 0, "python-unittest", "Python Unit Testing Framework", "python-core, python-stringold, python-lang",
316 "unittest.*" )
318 m.addPackage( 0, "python-xml", "Python basic XML support.", "python-core, python-re",
319 "lib-dynload/pyexpat.so xml xmllib.*" ) # package
321 m.addPackage( 0, "python-xmlrpc", "Python XMLRPC Support", "python-core, python-xml, python-netserver, python-lang",
322 "xmlrpclib.* SimpleXMLRPCServer.*" )
324 m.addPackage( 0, "python-zlib", "Python zlib Support.", "python-core",
325 "lib-dynload/zlib.so" )
327 m.addPackage( 0, "python-mailbox", "Python Mailbox Format Support", "python-core, python-mime",
328 "mailbox.*" )
330 m.make()