blob: f2ecf8d3f5a6d88e2e69fde3e29d1ee51053b1be [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
12
13import os
14import sys
15import time
16
17VERSION = "2.7.2"
18
19__author__ = "Michael 'Mickey' Lauer <mlauer@vanille-media.de>"
20__version__ = "20110222.2"
21
22class MakefileMaker:
23
24 def __init__( self, outfile ):
25 """initialize"""
26 self.packages = {}
27 self.targetPrefix = "${libdir}/python%s/" % VERSION[:3]
28 self.output = outfile
29 self.out( """
30# WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file.
31# Generator: '%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
32# Visit the Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy
33""" % ( sys.argv[0], __version__ ) )
34
35 #
36 # helper functions
37 #
38
39 def out( self, data ):
40 """print a line to the output file"""
41 self.output.write( "%s\n" % data )
42
43 def setPrefix( self, targetPrefix ):
44 """set a file prefix for addPackage files"""
45 self.targetPrefix = targetPrefix
46
47 def doProlog( self ):
48 self.out( """ """ )
49 self.out( "" )
50
51 def addPackage( self, 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.targetPrefix, filename ) )
59 else:
60 fullFilenames.append( filename )
61 self.packages[name] = 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 sorted(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="${PN}-dbg '
85 for name in sorted(self.packages):
86 if name.startswith("${PN}-distutils"):
87 if name == "${PN}-distutils":
88 packageLine += "%s-staticdev %s " % (name, name)
89 elif name != '${PN}-dbg':
90 packageLine += "%s " % name
91 packageLine += '${PN}-modules"'
92
93 self.out( packageLine )
94 self.out( "" )
95
96 #
97 # generate package variables
98 #
99
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600100 for name, data in sorted(self.packages.items()):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500101 desc, deps, files = data
102
103 #
104 # write out the description, revision and dependencies
105 #
106 self.out( 'SUMMARY_%s="%s"' % ( name, desc ) )
107 self.out( 'RDEPENDS_%s="%s"' % ( name, deps ) )
108
109 line = 'FILES_%s="' % name
110
111 #
112 # check which directories to make in the temporary directory
113 #
114
115 dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead.
116 for target in files:
117 dirset[os.path.dirname( target )] = True
118
119 #
120 # generate which files to copy for the target (-dfR because whole directories are also allowed)
121 #
122
123 for target in files:
124 line += "%s " % target
125
126 line += '"'
127 self.out( line )
128 self.out( "" )
129
130 self.out( 'SUMMARY_${PN}-modules="All Python modules"' )
131 line = 'RDEPENDS_${PN}-modules="'
132
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600133 for name, data in sorted(self.packages.items()):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500134 if name not in ['${PN}-dev', '${PN}-distutils-staticdev']:
135 line += "%s " % name
136
137 self.out( "%s \"" % line )
138 self.out( 'ALLOW_EMPTY_${PN}-modules = "1"' )
139
140 def doEpilog( self ):
141 self.out( """""" )
142 self.out( "" )
143
144 def make( self ):
145 self.doProlog()
146 self.doBody()
147 self.doEpilog()
148
149if __name__ == "__main__":
150
151 if len( sys.argv ) > 1:
152 try:
153 os.unlink(sys.argv[1])
154 except Exception:
155 sys.exc_clear()
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600156 outfile = open( sys.argv[1], "w" )
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500157 else:
158 outfile = sys.stdout
159
160 m = MakefileMaker( outfile )
161
162 # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies!
163 # Parameters: revision, name, description, dependencies, filenames
164 #
165
166 m.addPackage( "${PN}-core", "Python interpreter and core modules", "${PN}-lang ${PN}-re",
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500167 "__future__.* _abcoll.* abc.* ast.* copy.* copy_reg.* ConfigParser.* " +
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500168 "genericpath.* getopt.* linecache.* new.* " +
169 "os.* posixpath.* struct.* " +
170 "warnings.* site.* stat.* " +
171 "UserDict.* UserList.* UserString.* " +
172 "lib-dynload/binascii.so lib-dynload/_struct.so lib-dynload/time.so " +
173 "lib-dynload/xreadlines.so types.* platform.* ${bindir}/python* " +
174 "_weakrefset.* sysconfig.* _sysconfigdata.* config/Makefile " +
175 "${includedir}/python${PYTHON_MAJMIN}/pyconfig*.h " +
176 "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py ")
177
178 m.addPackage( "${PN}-dev", "Python development package", "${PN}-core",
179 "${includedir} " +
180 "${libdir}/lib*${SOLIBSDEV} " +
181 "${libdir}/*.la " +
182 "${libdir}/*.a " +
183 "${libdir}/*.o " +
184 "${libdir}/pkgconfig " +
185 "${base_libdir}/*.a " +
186 "${base_libdir}/*.o " +
187 "${datadir}/aclocal " +
188 "${datadir}/pkgconfig " )
189
190 m.addPackage( "${PN}-2to3", "Python automated Python 2 to 3 code translator", "${PN}-core",
191 "${bindir}/2to3 lib2to3" ) # package
192
193 m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter",
194 "${bindir}/idle idlelib" ) # package
195
196 m.addPackage( "${PN}-pydoc", "Python interactive help support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re",
197 "${bindir}/pydoc pydoc.* pydoc_data" )
198
199 m.addPackage( "${PN}-smtpd", "Python Simple Mail Transport Daemon", "${PN}-core ${PN}-netserver ${PN}-email ${PN}-mime",
200 "${bindir}/smtpd.* smtpd.*" )
201
202 m.addPackage( "${PN}-audio", "Python Audio Handling", "${PN}-core",
203 "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.so lib-dynload/audioop.so audiodev.* sunaudio.* sunau.* toaiff.*" )
204
205 m.addPackage( "${PN}-bsddb", "Python bindings for the Berkeley Database", "${PN}-core",
206 "bsddb lib-dynload/_bsddb.so" ) # package
207
208 m.addPackage( "${PN}-codecs", "Python codecs, encodings & i18n support", "${PN}-core ${PN}-lang",
209 "codecs.* encodings gettext.* locale.* lib-dynload/_locale.so lib-dynload/_codecs* lib-dynload/_multibytecodec.so lib-dynload/unicodedata.so stringprep.* xdrlib.*" )
210
211 m.addPackage( "${PN}-compile", "Python bytecode compilation support", "${PN}-core",
212 "py_compile.* compileall.*" )
213
214 m.addPackage( "${PN}-compiler", "Python compiler support", "${PN}-core",
215 "compiler" ) # package
216
217 m.addPackage( "${PN}-compression", "Python high-level compression support", "${PN}-core ${PN}-zlib",
218 "gzip.* zipfile.* tarfile.* lib-dynload/bz2.so" )
219
220 m.addPackage( "${PN}-crypt", "Python basic cryptographic and hashing support", "${PN}-core",
221 "hashlib.* md5.* sha.* lib-dynload/crypt.so lib-dynload/_hashlib.so lib-dynload/_sha256.so lib-dynload/_sha512.so" )
222
223 m.addPackage( "${PN}-textutils", "Python option parsing, text wrapping and CSV support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold",
224 "lib-dynload/_csv.so csv.* optparse.* textwrap.*" )
225
226 m.addPackage( "${PN}-curses", "Python curses support", "${PN}-core",
227 "curses lib-dynload/_curses.so lib-dynload/_curses_panel.so" ) # directory + low level module
228
229 m.addPackage( "${PN}-ctypes", "Python C types support", "${PN}-core",
230 "ctypes lib-dynload/_ctypes.so lib-dynload/_ctypes_test.so" ) # directory + low level module
231
232 m.addPackage( "${PN}-datetime", "Python calendar and time support", "${PN}-core ${PN}-codecs",
233 "_strptime.* calendar.* lib-dynload/datetime.so" )
234
235 m.addPackage( "${PN}-db", "Python file-based database support", "${PN}-core",
236 "anydbm.* dumbdbm.* whichdb.* " )
237
238 m.addPackage( "${PN}-debugger", "Python debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint",
239 "bdb.* pdb.*" )
240
241 m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects", "${PN}-lang ${PN}-re",
242 "difflib.*" )
243
244 m.addPackage( "${PN}-distutils-staticdev", "Python distribution utilities (static libraries)", "${PN}-distutils",
245 "config/lib*.a" ) # package
246
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500247 m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core ${PN}-email",
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500248 "config distutils" ) # package
249
250 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",
251 "doctest.*" )
252
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500253 m.addPackage( "${PN}-email", "Python email support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient",
254 "imaplib.* email" ) # package
255
256 m.addPackage( "${PN}-fcntl", "Python's fcntl interface", "${PN}-core",
257 "lib-dynload/fcntl.so" )
258
259 m.addPackage( "${PN}-hotshot", "Python hotshot performance profiler", "${PN}-core",
260 "hotshot lib-dynload/_hotshot.so" )
261
262 m.addPackage( "${PN}-html", "Python HTML processing support", "${PN}-core",
263 "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* HTMLParser.* " )
264
265 m.addPackage( "${PN}-importlib", "Python import implementation library", "${PN}-core",
266 "importlib" )
267
268 m.addPackage( "${PN}-gdbm", "Python GNU database support", "${PN}-core",
269 "lib-dynload/gdbm.so" )
270
271 m.addPackage( "${PN}-image", "Python graphical image handling", "${PN}-core",
272 "colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" )
273
274 m.addPackage( "${PN}-io", "Python low-level I/O", "${PN}-core ${PN}-math ${PN}-textutils ${PN}-netclient ${PN}-contextlib",
275 "lib-dynload/_socket.so lib-dynload/_io.so lib-dynload/_ssl.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so " +
276 "pipes.* socket.* ssl.* tempfile.* StringIO.* io.* _pyio.*" )
277
278 m.addPackage( "${PN}-json", "Python JSON support", "${PN}-core ${PN}-math ${PN}-re ${PN}-codecs",
279 "json lib-dynload/_json.so" ) # package
280
281 m.addPackage( "${PN}-lang", "Python low-level language support", "${PN}-core",
282 "lib-dynload/_bisect.so lib-dynload/_collections.so lib-dynload/_heapq.so lib-dynload/_weakref.so lib-dynload/_functools.so " +
283 "lib-dynload/array.so lib-dynload/itertools.so lib-dynload/operator.so lib-dynload/parser.so " +
284 "atexit.* bisect.* code.* codeop.* collections.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* symbol.* repr.* token.* " +
285 "tokenize.* traceback.* weakref.*" )
286
287 m.addPackage( "${PN}-logging", "Python logging support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold",
288 "logging" ) # package
289
290 m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime",
291 "mailbox.*" )
292
293 m.addPackage( "${PN}-math", "Python math support", "${PN}-core ${PN}-crypt",
294 "lib-dynload/cmath.so lib-dynload/math.so lib-dynload/_random.so random.* sets.*" )
295
296 m.addPackage( "${PN}-mime", "Python MIME handling APIs", "${PN}-core ${PN}-io",
297 "mimetools.* uu.* quopri.* rfc822.* MimeWriter.*" )
298
299 m.addPackage( "${PN}-mmap", "Python memory-mapped file support", "${PN}-core ${PN}-io",
300 "lib-dynload/mmap.so " )
301
302 m.addPackage( "${PN}-multiprocessing", "Python multiprocessing support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-threading ${PN}-ctypes ${PN}-mmap",
303 "lib-dynload/_multiprocessing.so multiprocessing" ) # package
304
305 m.addPackage( "${PN}-netclient", "Python Internet Protocol clients", "${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime",
306 "*Cookie*.* " +
307 "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.* uuid.* rfc822.* mimetools.*" )
308
309 m.addPackage( "${PN}-netserver", "Python Internet Protocol servers", "${PN}-core ${PN}-netclient ${PN}-shell ${PN}-threading",
310 "cgi.* *HTTPServer.* SocketServer.*" )
311
312 m.addPackage( "${PN}-numbers", "Python number APIs", "${PN}-core ${PN}-lang ${PN}-re",
313 "decimal.* fractions.* numbers.*" )
314
315 m.addPackage( "${PN}-pickle", "Python serialisation/persistence support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re",
316 "pickle.* shelve.* lib-dynload/cPickle.so pickletools.*" )
317
318 m.addPackage( "${PN}-pkgutil", "Python package extension utility support", "${PN}-core",
319 "pkgutil.*")
320
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500321 m.addPackage( "${PN}-plistlib", "Generate and parse Mac OS X .plist files", "${PN}-core ${PN}-datetime ${PN}-io",
322 "plistlib.*")
323
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500324 m.addPackage( "${PN}-pprint", "Python pretty-print support", "${PN}-core ${PN}-io",
325 "pprint.*" )
326
327 m.addPackage( "${PN}-profile", "Python basic performance profiling support", "${PN}-core ${PN}-textutils",
328 "profile.* pstats.* cProfile.* lib-dynload/_lsprof.so" )
329
330 m.addPackage( "${PN}-re", "Python Regular Expression APIs", "${PN}-core",
331 "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin
332
333 m.addPackage( "${PN}-readline", "Python readline support", "${PN}-core",
334 "lib-dynload/readline.so rlcompleter.*" )
335
336 m.addPackage( "${PN}-resource", "Python resource control interface", "${PN}-core",
337 "lib-dynload/resource.so" )
338
339 m.addPackage( "${PN}-shell", "Python shell-like functionality", "${PN}-core ${PN}-re",
340 "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shlex.* shutil.*" )
341
342 m.addPackage( "${PN}-robotparser", "Python robots.txt parser", "${PN}-core ${PN}-netclient",
343 "robotparser.*")
344
345 m.addPackage( "${PN}-subprocess", "Python subprocess support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle",
346 "subprocess.*" )
347
348 m.addPackage( "${PN}-sqlite3", "Python Sqlite3 database support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading ${PN}-zlib",
349 "lib-dynload/_sqlite3.so sqlite3/dbapi2.* sqlite3/__init__.* sqlite3/dump.*" )
350
351 m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 database support tests", "${PN}-core ${PN}-sqlite3",
352 "sqlite3/test" )
353
354 m.addPackage( "${PN}-stringold", "Python string APIs [deprecated]", "${PN}-core ${PN}-re",
355 "lib-dynload/strop.so string.* stringold.*" )
356
357 m.addPackage( "${PN}-syslog", "Python syslog interface", "${PN}-core",
358 "lib-dynload/syslog.so" )
359
360 m.addPackage( "${PN}-terminal", "Python terminal controlling support", "${PN}-core ${PN}-io",
361 "pty.* tty.*" )
362
363 m.addPackage( "${PN}-tests", "Python tests", "${PN}-core",
364 "test" ) # package
365
366 m.addPackage( "${PN}-threading", "Python threading & synchronization support", "${PN}-core ${PN}-lang",
367 "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" )
368
369 m.addPackage( "${PN}-tkinter", "Python Tcl/Tk bindings", "${PN}-core",
370 "lib-dynload/_tkinter.so lib-tk" ) # package
371
372 m.addPackage( "${PN}-unittest", "Python unit testing framework", "${PN}-core ${PN}-stringold ${PN}-lang ${PN}-io ${PN}-difflib ${PN}-pprint ${PN}-shell",
373 "unittest/" )
374
375 m.addPackage( "${PN}-unixadmin", "Python Unix administration support", "${PN}-core",
376 "lib-dynload/nis.so lib-dynload/grp.so lib-dynload/pwd.so getpass.*" )
377
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500378 m.addPackage( "${PN}-xml", "Python basic XML support", "${PN}-core ${PN}-re",
379 "lib-dynload/_elementtree.so lib-dynload/pyexpat.so xml xmllib.*" ) # package
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500380
381 m.addPackage( "${PN}-xmlrpc", "Python XML-RPC support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang",
382 "xmlrpclib.* SimpleXMLRPCServer.* DocXMLRPCServer.*" )
383
384 m.addPackage( "${PN}-zlib", "Python zlib compression support", "${PN}-core",
385 "lib-dynload/zlib.so" )
386
387 m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime",
388 "mailbox.*" )
389
390 m.addPackage( "${PN}-argparse", "Python command line argument parser", "${PN}-core ${PN}-codecs ${PN}-textutils",
391 "argparse.*" )
392
393 m.addPackage( "${PN}-contextlib", "Python utilities for with-statement" +
394 "contexts.", "${PN}-core",
395 "${libdir}/python${PYTHON_MAJMIN}/contextlib.*" )
396
397 m.make()