aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/generate-manifest-2.4.py
blob: 730c883bd3bc9e0b2a32db36d37cf816a767b470 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#!/usr/bin/env python

# generate Python Manifest for the OpenEmbedded build system
# (C) 2002-2007 Michael 'Mickey' Lauer <mickey@Vanille.de>
# MIT license

import os
import sys
import time

VERSION = "2.4.4"
# increase when touching python-core
BASEREV = 2

__author__ = "Michael 'Mickey' Lauer <mickey@Vanille.de>"
__version__ = "20070721"

class MakefileMaker:

    def __init__( self, outfile ):
        """initialize"""
        self.packages = {}
        self.sourcePrefix = "/lib/python%s/" % VERSION[:3]
        self.targetPrefix = "${libdir}/python%s" % VERSION[:3]
        self.output = outfile
        self.out( "#" * 120 )
        self.out( "### AUTO-GENERATED by '%s' [(C) 2002-2007 Michael 'Mickey' Lauer <mickey@Vanille.de>] on %s" % ( sys.argv[0], time.asctime() ) )
        self.out( "###" )
        self.out( "### Visit THE Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy" )
        self.out( "###" )
        self.out( "### Warning: Manual edits will be lost!" )
        self.out( "###" )
        self.out( "#" * 120 )
    #
    # helper functions
    #

    def out( self, data ):
        """print a line to the output file"""
        print >> self.output, data

    def setPrefix( self, sourcePrefix, targetPrefix ):
        """set a file prefix for addPackage files"""
        self.sourcePrefix = sourcePrefix
        self.targetPrefix = targetPrefix

    def doProlog( self ):
        self.out( """ """ )
        self.out( "" )

    def addPackage( self, revision, name, description, dependencies, filenames ):
        """add a package to the Makefile"""
        if type( filenames ) == type( "" ):
            filenames = filenames.split()
        fullFilenames = []
        for filename in filenames:
            if filename[0] != "/":
                fullFilenames.append( ( "%s%s" % ( self.sourcePrefix, filename ), "%s%s" % ( self.targetPrefix, filename ) ) )
            else:
                fullFilenames.append( ( filename, filename ) )
        self.packages[name] = revision, description, dependencies, fullFilenames

    def doBody( self ):
        """generate body of Makefile"""

        global VERSION

        #
        # generate provides line
        # 
 
        provideLine = 'PROVIDES+="'
        for name in self.packages:
            provideLine += "%s " % name
        provideLine += '"'

        self.out( provideLine )
        self.out( "" )       

        #
        # generate package line
        #

        packageLine = 'PACKAGES="'
        for name in self.packages:
            packageLine += "%s " % name
        packageLine += '"'

        self.out( packageLine )
        self.out( "" )

        #
        # generate package variables
        #

        for name, data in self.packages.iteritems():
            rev, desc, deps, files = data

            #
            # write out the description, revision and dependencies
            #
            self.out( 'DESCRIPTION_%s="%s"' % ( name, desc ) )
            self.out( 'PR_%s="ml%d"' % ( name, rev + BASEREV ) )
            self.out( 'RDEPENDS_%s="%s"' % ( name, deps.replace( ",", "" ) ) )

            line = 'FILES_%s="' % name

            #
            # check which directories to make in the temporary directory
            #

            dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead.
            for source, target in files:
                dirset[os.path.dirname( target )] = True

            #
            # generate which files to copy for the target (-dfR because whole directories are also allowed)
            #

            for source, target in files:
                line += "%s " % target

            line += '"'
            self.out( line )
            self.out( "" )

    def doEpilog( self ):
        self.out( """""" )
        self.out( "" )

    def make( self ):
        self.doProlog()
        self.doBody()
        self.doEpilog()

if __name__ == "__main__":

    if len( sys.argv ) > 1:
        os.popen( "rm -f ./%s" % sys.argv[1] )
        outfile = file( sys.argv[1], "w" )
    else:
        outfile = sys.stdout

    m = MakefileMaker( outfile )

    # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies!
    # Parameters: revision, name, description, dependencies, filenames
    #

    m.setPrefix( "/", "/usr/" )

    m.addPackage( 2, "python-core", "Python Interpreter and core modules (needed!)", "",
    "lib/python2.4/__future__.* lib/python2.4/copy.* lib/python2.4/copy_reg.* lib/python2.4/ConfigParser.* " +
    "lib/python2.4/getopt.* lib/python2.4/linecache.* lib/python2.4/new.* " +
    "lib/python2.4/os.* lib/python2.4/posixpath.* " +
    "lib/python2.4/warnings.* lib/python2.4/site.* lib/python2.4/stat.* " +
    "lib/python2.4/UserDict.* lib/python2.4/UserList.* lib/python2.4/UserString.* " +
    "lib/python2.4/lib-dynload/binascii.so lib/python2.4/lib-dynload/struct.so lib/python2.4/lib-dynload/time.so " +
    "lib/python2.4/lib-dynload/xreadlines.so lib/python2.4/types.* bin/python*" )

    m.addPackage( 0, "python-core-dbg", "Python core module debug information", "python-core",
    "lib/python2.4/lib-dynload/.debug bin/.debug lib/.debug" )

    m.addPackage( 0, "python-devel", "Python Development Package", "python-core",
    "include lib/python2.4/config" ) # package

    m.addPackage( 0, "python-idle", "Python Integrated Development Environment", "python-core, python-tkinter",
    "bin/idle lib/python2.4/idlelib" ) # package

    m.addPackage( 0, "python-pydoc", "Python Interactive Help Support", "python-core, python-lang, python-stringold, python-re",
    "bin/pydoc lib/python2.4/pydoc.*" )

    m.addPackage( 0, "python-smtpd", "Python Simple Mail Transport Daemon", "python-core python-netserver python-email python-mime",
    "bin/smtpd.*" )

    m.setPrefix( "/lib/python2.4/", "${libdir}/python2.4/" )

    m.addPackage( 0, "python-audio", "Python Audio Handling", "python-core",
    "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.so lib-dynload/audioop.so" )

    m.addPackage( 0, "python-bsddb", "Python Berkeley Database Bindings", "python-core",
    "bsddb" ) # package

    m.addPackage( 0, "python-codecs", "Python Codecs, Encodings & i18n Support", "python-core",
    "codecs.* encodings gettext.* locale.* lib-dynload/_locale.so lib-dynload/unicodedata.so stringprep.* xdrlib.*" )

    m.addPackage( 0, "python-compile", "Python Bytecode Compilation Support", "python-core",
    "py_compile.* compileall.*" )

    m.addPackage( 0, "python-compiler", "Python Compiler Support", "python-core",
    "compiler" ) # package

    m.addPackage( 0, "python-compression", "Python High Level Compression Support", "python-core, python-zlib",
    "gzip.* zipfile.*" )

    m.addPackage( 0, "python-crypt", "Python Basic Cryptographic and Hashing Support", "python-core",
    "lib-dynload/crypt.so lib-dynload/md5.so lib-dynload/rotor.so lib-dynload/sha.so" )

    m.addPackage( 0, "python-textutils", "Python Option Parsing, Text Wrapping and Comma-Separated-Value Support", "python-core, python-io, python-re, python-stringold",
    "lib-dynload/_csv.so csv.* optparse.* textwrap.*" )

    m.addPackage( 0, "python-curses", "Python Curses Support", "python-core",
    "curses lib-dynload/_curses.so lib-dynload/_curses_panel.so" ) # package

    m.addPackage( 0, "python-datetime", "Python Calendar and Time support", "python-core, python-codecs",
    "_strptime.* calendar.* lib-dynload/datetime.so" )

    m.addPackage( 0, "python-db", "Python File-Based Database Support", "python-core",
    "anydbm.* dumbdbm.* whichdb.* " )

    m.addPackage( 0, "python-debugger", "Python Debugger", "python-core, python-io, python-lang, python-re, python-stringold, python-shell",
    "bdb.* pdb.*" )

    m.addPackage( 0, "python-distutils", "Python Distribution Utilities", "python-core",
    "config distutils" ) # package

    m.addPackage( 0, "python-email", "Python Email Support", "python-core, python-io, python-re, python-mime, python-audio python-image",
    "email" ) # package

    m.addPackage( 0, "python-fcntl", "Python's fcntl Interface", "python-core",
    "lib-dynload/fcntl.so" )

    m.addPackage( 0, "python-hotshot", "Python Hotshot Profiler", "python-core",
    "hotshot lib-dynload/_hotshot.so" )

    m.addPackage( 0, "python-html", "Python HTML Processing", "python-core",
    "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* " )

    m.addPackage( 0, "python-gdbm", "Python GNU Database Support", "python-core",
    "lib-dynload/gdbm.so" )

    m.addPackage( 0, "python-image", "Python Graphical Image Handling", "python-core",
    "colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" )

    m.addPackage( 0, "python-io", "Python Low-Level I/O", "python-core, python-math",
    "lib-dynload/_socket.so lib-dynload/_ssl.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so "
    "pipes.* socket.* tempfile.* StringIO.* " )

    m.addPackage( 0, "python-lang", "Python Low-Level Language Support", "python-core",
    "lib-dynload/array.so lib-dynload/parser.so lib-dynload/operator.so lib-dynload/_weakref.so " +
    "lib-dynload/itertools.so lib-dynload/collections.so lib-dynload/_bisect.so lib-dynload/_heapq.so " +
    "atexit.* bisect.* code.* codeop.* dis.* heapq.* inspect.* keyword.* opcode.* repr.* token.* tokenize.* " + 
    "traceback.* linecache.* weakref.*" )

    m.addPackage( 0, "python-logging", "Python Logging Support", "python-core",
    "logging" ) # package

    m.addPackage( 0, "python-lib-old-and-deprecated", "Python Deprecated Libraries", "python-core",
    "lib-old" ) # package

    m.addPackage( 0, "python-tkinter", "Python Tcl/Tk Bindings", "python-core",
    "lib-dynload/_tkinter.so lib-tk" ) # package

    m.addPackage( 0, "python-math", "Python Math Support", "python-core",
    "lib-dynload/cmath.so lib-dynload/math.so lib-dynload/_random.so random.* sets.*" )

    m.addPackage( 0, "python-mime", "Python MIME Handling APIs", "python-core, python-io",
    "mimetools.* uu.* quopri.* rfc822.*" )

    m.addPackage( 0, "python-mmap", "Python Memory-Mapped-File Support", "python-core, python-io",
    "lib-dynload/mmap.so " )

    m.addPackage( 0, "python-unixadmin", "Python Unix Administration Support", "python-core",
    "lib-dynload/nis.so lib-dynload/grp.so lib-dynload/pwd.so getpass.*" )

    m.addPackage( 0, "python-netclient", "Python Internet Protocol Clients", "python-core, python-datetime, python-io, python-lang, python-logging, python-mime",
    "*Cookie*.* " + 
    "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.*" )

    m.addPackage( 0, "python-netserver", "Python Internet Protocol Servers", "python-core, python-netclient",
    "cgi.* BaseHTTPServer.* SimpleHTTPServer.* SocketServer.*" )

    m.addPackage( 0, "python-pickle", "Python Persistence Support", "python-core, python-codecs, python-io, python-re",
    "pickle.* shelve.* lib-dynload/cPickle.so" )

    m.addPackage( 0, "python-pprint", "Python Pretty-Print Support", "python-core",
    "pprint.*" )

    m.addPackage( 0, "python-profile", "Python Basic Profiling Support", "python-core",
    "profile.* pstats.*" )

    m.addPackage( 0, "python-re", "Python Regular Expression APIs", "python-core",
    "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin

    m.addPackage( 0, "python-readline", "Python Readline Support", "python-core",
    "lib-dynload/readline.so rlcompleter.*" )

    m.addPackage( 0, "python-resource", "Python Resource Control Interface", "python-core",
    "lib-dynload/resource.so" )

    m.addPackage( 0, "python-shell", "Python Shell-Like Functionality", "python-core, python-re",
    "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shutil.*" )

    m.addPackage( 0, "python-robotparser", "Python robots.txt parser", "python-core, python-netclient",
    "robotparser.*")

    m.addPackage( 0, "python-subprocess", "Python Subprocess Support", "python-core, python-io, python-re, python-fcntl, python-pickle",
    "subprocess.*" )

    m.addPackage( 0, "python-stringold", "Python String APIs [deprecated]", "python-core, python-re",
    "lib-dynload/strop.so string.*" )

    m.addPackage( 0, "python-syslog", "Python's syslog Interface", "python-core",
    "lib-dynload/syslog.so" )

    m.addPackage( 0, "python-terminal", "Python Terminal Controlling Support", "python-core, python-io",
    "pty.* tty.*" )

    m.addPackage( 0, "python-tests", "Python Tests", "python-core",
    "test" ) # package

    m.addPackage( 0, "python-threading", "Python Threading & Synchronization Support", "python-core, python-lang",
    "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" )

    m.addPackage( 0, "python-unittest", "Python Unit Testing Framework", "python-core, python-stringold, python-lang",
    "unittest.*" )

    m.addPackage( 0, "python-xml", "Python basic XML support.", "python-core, python-re",
    "lib-dynload/pyexpat.so xml xmllib.*" ) # package

    m.addPackage( 0, "python-xmlrpc", "Python XMLRPC Support", "python-core, python-xml, python-netserver, python-lang",
    "xmlrpclib.* SimpleXMLRPCServer.*" )

    m.addPackage( 0, "python-zlib", "Python zlib Support.", "python-core",
    "lib-dynload/zlib.so" )

    m.addPackage( 0, "python-mailbox", "Python Mailbox Format Support", "python-core, python-mime",
    "mailbox.*" )

    m.make()