blob: 8c3655d395aecd44fef99c0c16a0ae9bc3ea4b94 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#!/usr/bin/env python
2
3# generate Python Manifest for the OpenEmbedded build system
4# (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
5# (C) 2007 Jeremy Laine
6# licensed under MIT, see COPYING.MIT
7#
8# June 22, 2011 -- Mark Hatle <mark.hatle@windriver.com>
9# * Updated to no longer generate special -dbg package, instead use the
10# single system -dbg
11# * Update version with ".1" to indicate this change
Brad Bishop6e60e8b2018-02-01 10:27:11 -050012#
13# February 26, 2017 -- Ming Liu <peter.x.liu@external.atlascopco.com>
14# * Updated to support generating manifest for native python
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015
16import os
17import sys
18import time
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019import argparse
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020
21VERSION = "2.7.2"
22
23__author__ = "Michael 'Mickey' Lauer <mlauer@vanille-media.de>"
24__version__ = "20110222.2"
25
26class MakefileMaker:
27
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028 def __init__( self, outfile, isNative ):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029 """initialize"""
30 self.packages = {}
31 self.targetPrefix = "${libdir}/python%s/" % VERSION[:3]
Brad Bishop6e60e8b2018-02-01 10:27:11 -050032 self.isNative = isNative
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033 self.output = outfile
34 self.out( """
35# WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036# Generator: '%s%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
37""" % ( sys.argv[0], ' --native' if isNative else '', __version__ ) )
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038
39 #
40 # helper functions
41 #
42
43 def out( self, data ):
44 """print a line to the output file"""
45 self.output.write( "%s\n" % data )
46
47 def setPrefix( self, targetPrefix ):
48 """set a file prefix for addPackage files"""
49 self.targetPrefix = targetPrefix
50
51 def doProlog( self ):
52 self.out( """ """ )
53 self.out( "" )
54
55 def addPackage( self, name, description, dependencies, filenames ):
56 """add a package to the Makefile"""
57 if type( filenames ) == type( "" ):
58 filenames = filenames.split()
59 fullFilenames = []
60 for filename in filenames:
61 if filename[0] != "$":
62 fullFilenames.append( "%s%s" % ( self.targetPrefix, filename ) )
63 else:
64 fullFilenames.append( filename )
65 self.packages[name] = description, dependencies, fullFilenames
66
67 def doBody( self ):
68 """generate body of Makefile"""
69
70 global VERSION
71
72 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -050073 # generate rprovides line for native
74 #
75
76 if self.isNative:
77 rprovideLine = 'RPROVIDES+="'
78 for name in sorted(self.packages):
79 rprovideLine += "%s-native " % name.replace( '${PN}', 'python' )
80 rprovideLine += '"'
81
82 self.out( rprovideLine )
83 self.out( "" )
84 return
85
86 #
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087 # generate provides line
88 #
89
90 provideLine = 'PROVIDES+="'
91 for name in sorted(self.packages):
92 provideLine += "%s " % name
93 provideLine += '"'
94
95 self.out( provideLine )
96 self.out( "" )
97
98 #
99 # generate package line
100 #
101
102 packageLine = 'PACKAGES="${PN}-dbg '
103 for name in sorted(self.packages):
104 if name.startswith("${PN}-distutils"):
105 if name == "${PN}-distutils":
106 packageLine += "%s-staticdev %s " % (name, name)
107 elif name != '${PN}-dbg':
108 packageLine += "%s " % name
109 packageLine += '${PN}-modules"'
110
111 self.out( packageLine )
112 self.out( "" )
113
114 #
115 # generate package variables
116 #
117
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600118 for name, data in sorted(self.packages.items()):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500119 desc, deps, files = data
120
121 #
122 # write out the description, revision and dependencies
123 #
124 self.out( 'SUMMARY_%s="%s"' % ( name, desc ) )
125 self.out( 'RDEPENDS_%s="%s"' % ( name, deps ) )
126
127 line = 'FILES_%s="' % name
128
129 #
130 # check which directories to make in the temporary directory
131 #
132
133 dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead.
134 for target in files:
135 dirset[os.path.dirname( target )] = True
136
137 #
138 # generate which files to copy for the target (-dfR because whole directories are also allowed)
139 #
140
141 for target in files:
142 line += "%s " % target
143
144 line += '"'
145 self.out( line )
146 self.out( "" )
147
148 self.out( 'SUMMARY_${PN}-modules="All Python modules"' )
149 line = 'RDEPENDS_${PN}-modules="'
150
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600151 for name, data in sorted(self.packages.items()):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500152 if name not in ['${PN}-dev', '${PN}-distutils-staticdev']:
153 line += "%s " % name
154
155 self.out( "%s \"" % line )
156 self.out( 'ALLOW_EMPTY_${PN}-modules = "1"' )
157
158 def doEpilog( self ):
159 self.out( """""" )
160 self.out( "" )
161
162 def make( self ):
163 self.doProlog()
164 self.doBody()
165 self.doEpilog()
166
167if __name__ == "__main__":
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500168 parser = argparse.ArgumentParser( description='generate python manifest' )
169 parser.add_argument( '-n', '--native', help='generate manifest for native python', action='store_true' )
170 parser.add_argument( 'outfile', metavar='OUTPUT_FILE', nargs='?', default='', help='Output file (defaults to stdout)' )
171 args = parser.parse_args()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500172
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500173 if args.outfile:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500174 try:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500175 os.unlink( args.outfile )
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500176 except Exception:
177 sys.exc_clear()
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500178 outfile = open( args.outfile, "w" )
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500179 else:
180 outfile = sys.stdout
181
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500182 m = MakefileMaker( outfile, args.native )
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500183
184 # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies!
185 # Parameters: revision, name, description, dependencies, filenames
186 #
187
188 m.addPackage( "${PN}-core", "Python interpreter and core modules", "${PN}-lang ${PN}-re",
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500189 "__future__.* _abcoll.* abc.* ast.* copy.* copy_reg.* ConfigParser.* " +
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500190 "genericpath.* getopt.* linecache.* new.* " +
191 "os.* posixpath.* struct.* " +
192 "warnings.* site.* stat.* " +
193 "UserDict.* UserList.* UserString.* " +
194 "lib-dynload/binascii.so lib-dynload/_struct.so lib-dynload/time.so " +
195 "lib-dynload/xreadlines.so types.* platform.* ${bindir}/python* " +
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500196 "_weakrefset.* sysconfig.* _sysconfigdata.* " +
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500197 "${includedir}/python${PYTHON_MAJMIN}/pyconfig*.h " +
198 "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py ")
199
200 m.addPackage( "${PN}-dev", "Python development package", "${PN}-core",
201 "${includedir} " +
202 "${libdir}/lib*${SOLIBSDEV} " +
203 "${libdir}/*.la " +
204 "${libdir}/*.a " +
205 "${libdir}/*.o " +
206 "${libdir}/pkgconfig " +
207 "${base_libdir}/*.a " +
208 "${base_libdir}/*.o " +
209 "${datadir}/aclocal " +
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500210 "${datadir}/pkgconfig " +
211 "config/Makefile ")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500212
213 m.addPackage( "${PN}-2to3", "Python automated Python 2 to 3 code translator", "${PN}-core",
214 "${bindir}/2to3 lib2to3" ) # package
215
216 m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter",
217 "${bindir}/idle idlelib" ) # package
218
219 m.addPackage( "${PN}-pydoc", "Python interactive help support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re",
220 "${bindir}/pydoc pydoc.* pydoc_data" )
221
222 m.addPackage( "${PN}-smtpd", "Python Simple Mail Transport Daemon", "${PN}-core ${PN}-netserver ${PN}-email ${PN}-mime",
223 "${bindir}/smtpd.* smtpd.*" )
224
225 m.addPackage( "${PN}-audio", "Python Audio Handling", "${PN}-core",
226 "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.so lib-dynload/audioop.so audiodev.* sunaudio.* sunau.* toaiff.*" )
227
228 m.addPackage( "${PN}-bsddb", "Python bindings for the Berkeley Database", "${PN}-core",
229 "bsddb lib-dynload/_bsddb.so" ) # package
230
231 m.addPackage( "${PN}-codecs", "Python codecs, encodings & i18n support", "${PN}-core ${PN}-lang",
232 "codecs.* encodings gettext.* locale.* lib-dynload/_locale.so lib-dynload/_codecs* lib-dynload/_multibytecodec.so lib-dynload/unicodedata.so stringprep.* xdrlib.*" )
233
234 m.addPackage( "${PN}-compile", "Python bytecode compilation support", "${PN}-core",
235 "py_compile.* compileall.*" )
236
237 m.addPackage( "${PN}-compiler", "Python compiler support", "${PN}-core",
238 "compiler" ) # package
239
240 m.addPackage( "${PN}-compression", "Python high-level compression support", "${PN}-core ${PN}-zlib",
241 "gzip.* zipfile.* tarfile.* lib-dynload/bz2.so" )
242
243 m.addPackage( "${PN}-crypt", "Python basic cryptographic and hashing support", "${PN}-core",
244 "hashlib.* md5.* sha.* lib-dynload/crypt.so lib-dynload/_hashlib.so lib-dynload/_sha256.so lib-dynload/_sha512.so" )
245
246 m.addPackage( "${PN}-textutils", "Python option parsing, text wrapping and CSV support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold",
247 "lib-dynload/_csv.so csv.* optparse.* textwrap.*" )
248
249 m.addPackage( "${PN}-curses", "Python curses support", "${PN}-core",
250 "curses lib-dynload/_curses.so lib-dynload/_curses_panel.so" ) # directory + low level module
251
252 m.addPackage( "${PN}-ctypes", "Python C types support", "${PN}-core",
253 "ctypes lib-dynload/_ctypes.so lib-dynload/_ctypes_test.so" ) # directory + low level module
254
255 m.addPackage( "${PN}-datetime", "Python calendar and time support", "${PN}-core ${PN}-codecs",
256 "_strptime.* calendar.* lib-dynload/datetime.so" )
257
258 m.addPackage( "${PN}-db", "Python file-based database support", "${PN}-core",
259 "anydbm.* dumbdbm.* whichdb.* " )
260
261 m.addPackage( "${PN}-debugger", "Python debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint",
262 "bdb.* pdb.*" )
263
264 m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects", "${PN}-lang ${PN}-re",
265 "difflib.*" )
266
267 m.addPackage( "${PN}-distutils-staticdev", "Python distribution utilities (static libraries)", "${PN}-distutils",
268 "config/lib*.a" ) # package
269
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500270 m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core ${PN}-email",
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500271 "config distutils" ) # package
272
273 m.addPackage( "${PN}-doctest", "Python framework for running examples in docstrings", "${PN}-core ${PN}-lang ${PN}-io ${PN}-re ${PN}-unittest ${PN}-debugger ${PN}-difflib",
274 "doctest.*" )
275
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500276 m.addPackage( "${PN}-email", "Python email support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient",
277 "imaplib.* email" ) # package
278
279 m.addPackage( "${PN}-fcntl", "Python's fcntl interface", "${PN}-core",
280 "lib-dynload/fcntl.so" )
281
282 m.addPackage( "${PN}-hotshot", "Python hotshot performance profiler", "${PN}-core",
283 "hotshot lib-dynload/_hotshot.so" )
284
285 m.addPackage( "${PN}-html", "Python HTML processing support", "${PN}-core",
286 "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* HTMLParser.* " )
287
288 m.addPackage( "${PN}-importlib", "Python import implementation library", "${PN}-core",
289 "importlib" )
290
291 m.addPackage( "${PN}-gdbm", "Python GNU database support", "${PN}-core",
292 "lib-dynload/gdbm.so" )
293
294 m.addPackage( "${PN}-image", "Python graphical image handling", "${PN}-core",
295 "colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" )
296
297 m.addPackage( "${PN}-io", "Python low-level I/O", "${PN}-core ${PN}-math ${PN}-textutils ${PN}-netclient ${PN}-contextlib",
298 "lib-dynload/_socket.so lib-dynload/_io.so lib-dynload/_ssl.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so " +
299 "pipes.* socket.* ssl.* tempfile.* StringIO.* io.* _pyio.*" )
300
301 m.addPackage( "${PN}-json", "Python JSON support", "${PN}-core ${PN}-math ${PN}-re ${PN}-codecs",
302 "json lib-dynload/_json.so" ) # package
303
304 m.addPackage( "${PN}-lang", "Python low-level language support", "${PN}-core",
305 "lib-dynload/_bisect.so lib-dynload/_collections.so lib-dynload/_heapq.so lib-dynload/_weakref.so lib-dynload/_functools.so " +
306 "lib-dynload/array.so lib-dynload/itertools.so lib-dynload/operator.so lib-dynload/parser.so " +
307 "atexit.* bisect.* code.* codeop.* collections.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* symbol.* repr.* token.* " +
308 "tokenize.* traceback.* weakref.*" )
309
310 m.addPackage( "${PN}-logging", "Python logging support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold",
311 "logging" ) # package
312
313 m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime",
314 "mailbox.*" )
315
316 m.addPackage( "${PN}-math", "Python math support", "${PN}-core ${PN}-crypt",
317 "lib-dynload/cmath.so lib-dynload/math.so lib-dynload/_random.so random.* sets.*" )
318
319 m.addPackage( "${PN}-mime", "Python MIME handling APIs", "${PN}-core ${PN}-io",
320 "mimetools.* uu.* quopri.* rfc822.* MimeWriter.*" )
321
322 m.addPackage( "${PN}-mmap", "Python memory-mapped file support", "${PN}-core ${PN}-io",
323 "lib-dynload/mmap.so " )
324
325 m.addPackage( "${PN}-multiprocessing", "Python multiprocessing support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-threading ${PN}-ctypes ${PN}-mmap",
326 "lib-dynload/_multiprocessing.so multiprocessing" ) # package
327
328 m.addPackage( "${PN}-netclient", "Python Internet Protocol clients", "${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime",
329 "*Cookie*.* " +
330 "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.* uuid.* rfc822.* mimetools.*" )
331
332 m.addPackage( "${PN}-netserver", "Python Internet Protocol servers", "${PN}-core ${PN}-netclient ${PN}-shell ${PN}-threading",
333 "cgi.* *HTTPServer.* SocketServer.*" )
334
335 m.addPackage( "${PN}-numbers", "Python number APIs", "${PN}-core ${PN}-lang ${PN}-re",
336 "decimal.* fractions.* numbers.*" )
337
338 m.addPackage( "${PN}-pickle", "Python serialisation/persistence support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re",
339 "pickle.* shelve.* lib-dynload/cPickle.so pickletools.*" )
340
341 m.addPackage( "${PN}-pkgutil", "Python package extension utility support", "${PN}-core",
342 "pkgutil.*")
343
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500344 m.addPackage( "${PN}-plistlib", "Generate and parse Mac OS X .plist files", "${PN}-core ${PN}-datetime ${PN}-io",
345 "plistlib.*")
346
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500347 m.addPackage( "${PN}-pprint", "Python pretty-print support", "${PN}-core ${PN}-io",
348 "pprint.*" )
349
350 m.addPackage( "${PN}-profile", "Python basic performance profiling support", "${PN}-core ${PN}-textutils",
351 "profile.* pstats.* cProfile.* lib-dynload/_lsprof.so" )
352
353 m.addPackage( "${PN}-re", "Python Regular Expression APIs", "${PN}-core",
354 "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin
355
356 m.addPackage( "${PN}-readline", "Python readline support", "${PN}-core",
357 "lib-dynload/readline.so rlcompleter.*" )
358
359 m.addPackage( "${PN}-resource", "Python resource control interface", "${PN}-core",
360 "lib-dynload/resource.so" )
361
362 m.addPackage( "${PN}-shell", "Python shell-like functionality", "${PN}-core ${PN}-re",
363 "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shlex.* shutil.*" )
364
365 m.addPackage( "${PN}-robotparser", "Python robots.txt parser", "${PN}-core ${PN}-netclient",
366 "robotparser.*")
367
368 m.addPackage( "${PN}-subprocess", "Python subprocess support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle",
369 "subprocess.*" )
370
371 m.addPackage( "${PN}-sqlite3", "Python Sqlite3 database support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading ${PN}-zlib",
372 "lib-dynload/_sqlite3.so sqlite3/dbapi2.* sqlite3/__init__.* sqlite3/dump.*" )
373
374 m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 database support tests", "${PN}-core ${PN}-sqlite3",
375 "sqlite3/test" )
376
377 m.addPackage( "${PN}-stringold", "Python string APIs [deprecated]", "${PN}-core ${PN}-re",
378 "lib-dynload/strop.so string.* stringold.*" )
379
380 m.addPackage( "${PN}-syslog", "Python syslog interface", "${PN}-core",
381 "lib-dynload/syslog.so" )
382
383 m.addPackage( "${PN}-terminal", "Python terminal controlling support", "${PN}-core ${PN}-io",
384 "pty.* tty.*" )
385
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500386 m.addPackage( "${PN}-tests", "Python tests", "${PN}-core ${PN}-modules",
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500387 "test" ) # package
388
389 m.addPackage( "${PN}-threading", "Python threading & synchronization support", "${PN}-core ${PN}-lang",
390 "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" )
391
392 m.addPackage( "${PN}-tkinter", "Python Tcl/Tk bindings", "${PN}-core",
393 "lib-dynload/_tkinter.so lib-tk" ) # package
394
395 m.addPackage( "${PN}-unittest", "Python unit testing framework", "${PN}-core ${PN}-stringold ${PN}-lang ${PN}-io ${PN}-difflib ${PN}-pprint ${PN}-shell",
396 "unittest/" )
397
398 m.addPackage( "${PN}-unixadmin", "Python Unix administration support", "${PN}-core",
399 "lib-dynload/nis.so lib-dynload/grp.so lib-dynload/pwd.so getpass.*" )
400
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500401 m.addPackage( "${PN}-xml", "Python basic XML support", "${PN}-core ${PN}-re",
402 "lib-dynload/_elementtree.so lib-dynload/pyexpat.so xml xmllib.*" ) # package
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500403
404 m.addPackage( "${PN}-xmlrpc", "Python XML-RPC support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang",
405 "xmlrpclib.* SimpleXMLRPCServer.* DocXMLRPCServer.*" )
406
407 m.addPackage( "${PN}-zlib", "Python zlib compression support", "${PN}-core",
408 "lib-dynload/zlib.so" )
409
410 m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime",
411 "mailbox.*" )
412
413 m.addPackage( "${PN}-argparse", "Python command line argument parser", "${PN}-core ${PN}-codecs ${PN}-textutils",
414 "argparse.*" )
415
416 m.addPackage( "${PN}-contextlib", "Python utilities for with-statement" +
417 "contexts.", "${PN}-core",
418 "${libdir}/python${PYTHON_MAJMIN}/contextlib.*" )
419
420 m.make()