summaryrefslogtreecommitdiffstats
path: root/scripts/contrib/python
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2012-10-08 13:51:11 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-02 22:37:38 +0000
commit31a48f4845d6a806391bade38f9272aca80bf053 (patch)
tree63df25175dfb3f2583856b1945cfb3b3b792d5e9 /scripts/contrib/python
parent358dd840c53e2e69e668a6d5da04eb3da3769ba3 (diff)
downloadpoky-31a48f4845d6a806391bade38f9272aca80bf053.tar.gz
generate-manifest-3.3.py: Add script to generate python 3.3 manifests
Bases on python 2.7.x generator Package collections/ in python-core (From OE-Core rev: 468115573275d6c32924e56bff660b9f6d38de84) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/python')
-rwxr-xr-xscripts/contrib/python/generate-manifest-3.3.py380
1 files changed, 380 insertions, 0 deletions
diff --git a/scripts/contrib/python/generate-manifest-3.3.py b/scripts/contrib/python/generate-manifest-3.3.py
new file mode 100755
index 0000000000..74498670c2
--- /dev/null
+++ b/scripts/contrib/python/generate-manifest-3.3.py
@@ -0,0 +1,380 @@
1#!/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#
13# 2014 Khem Raj <raj.khem@gmail.com>
14# Added python3 support
15#
16import os
17import sys
18import time
19
20VERSION = "3.3.3"
21
22__author__ = "Michael 'Mickey' Lauer <mlauer@vanille-media.de>"
23__version__ = "20140131"
24
25class MakefileMaker:
26
27 def __init__( self, outfile ):
28 """initialize"""
29 self.packages = {}
30 self.targetPrefix = "${libdir}/python%s/" % VERSION[:3]
31 self.output = outfile
32 self.out( """
33# WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file.
34# Generator: '%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
35# Visit the Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy
36""" % ( sys.argv[0], __version__ ) )
37
38 #
39 # helper functions
40 #
41
42 def out( self, data ):
43 """print a line to the output file"""
44 self.output.write( "%s\n" % data )
45
46 def setPrefix( self, targetPrefix ):
47 """set a file prefix for addPackage files"""
48 self.targetPrefix = targetPrefix
49
50 def doProlog( self ):
51 self.out( """ """ )
52 self.out( "" )
53
54 def addPackage( self, name, description, dependencies, filenames ):
55 """add a package to the Makefile"""
56 if type( filenames ) == type( "" ):
57 filenames = filenames.split()
58 fullFilenames = []
59 for filename in filenames:
60 if filename[0] != "$":
61 fullFilenames.append( "%s%s" % ( self.targetPrefix, filename ) )
62 else:
63 fullFilenames.append( filename )
64 self.packages[name] = description, dependencies, fullFilenames
65
66 def doBody( self ):
67 """generate body of Makefile"""
68
69 global VERSION
70
71 #
72 # generate provides line
73 #
74
75 provideLine = 'PROVIDES+="'
76 for name in sorted(self.packages):
77 provideLine += "%s " % name
78 provideLine += '"'
79
80 self.out( provideLine )
81 self.out( "" )
82
83 #
84 # generate package line
85 #
86
87 packageLine = 'PACKAGES="${PN}-dbg '
88 for name in sorted(self.packages):
89 if name.startswith("${PN}-distutils"):
90 if name == "${PN}-distutils":
91 packageLine += "%s-staticdev %s " % (name, name)
92 elif name != '${PN}-dbg':
93 packageLine += "%s " % name
94 packageLine += '${PN}-modules"'
95
96 self.out( packageLine )
97 self.out( "" )
98
99 #
100 # generate package variables
101 #
102
103 for name, data in sorted(self.packages.iteritems()):
104 desc, deps, files = data
105
106 #
107 # write out the description, revision and dependencies
108 #
109 self.out( 'DESCRIPTION_%s="%s"' % ( name, desc ) )
110 self.out( 'RDEPENDS_%s="%s"' % ( name, deps ) )
111
112 line = 'FILES_%s="' % name
113
114 #
115 # check which directories to make in the temporary directory
116 #
117
118 dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead.
119 for target in files:
120 dirset[os.path.dirname( target )] = True
121
122 #
123 # generate which files to copy for the target (-dfR because whole directories are also allowed)
124 #
125
126 for target in files:
127 line += "%s " % target
128
129 line += '"'
130 self.out( line )
131 self.out( "" )
132
133 self.out( 'DESCRIPTION_${PN}-modules="All Python modules"' )
134 line = 'RDEPENDS_${PN}-modules="'
135
136 for name, data in sorted(self.packages.iteritems()):
137 if name not in ['${PN}-dev', '${PN}-distutils-staticdev']:
138 line += "%s " % name
139
140 self.out( "%s \"" % line )
141 self.out( 'ALLOW_EMPTY_${PN}-modules = "1"' )
142
143 def doEpilog( self ):
144 self.out( """""" )
145 self.out( "" )
146
147 def make( self ):
148 self.doProlog()
149 self.doBody()
150 self.doEpilog()
151
152if __name__ == "__main__":
153
154 if len( sys.argv ) > 1:
155 try:
156 os.unlink(sys.argv[1])
157 except Exception:
158 sys.exc_clear()
159 outfile = file( sys.argv[1], "w" )
160 else:
161 outfile = sys.stdout
162
163 m = MakefileMaker( outfile )
164
165 # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies!
166 # Parameters: revision, name, description, dependencies, filenames
167 #
168
169 m.addPackage( "${PN}-core", "Python Interpreter and core modules (needed!)", "${PN}-lang ${PN}-re",
170 "__future__.* _abcoll.* abc.* copy.* copy_reg.* ConfigParser.* " +
171 "genericpath.* getopt.* linecache.* new.* " +
172 "os.* posixpath.* struct.* " +
173 "warnings.* site.* stat.* " +
174 "UserDict.* UserList.* UserString.* " +
175 "lib-dynload/binascii.*.so lib-dynload/_struct.*.so lib-dynload/time.*.so " +
176 "lib-dynload/xreadlines.*.so types.* platform.* ${bindir}/python* " +
177 "_weakrefset.* sysconfig.* config/Makefile " +
178 "${includedir}/python${PYTHON_MAJMIN}/pyconfig*.h " +
179 "${libdir}/python${PYTHON_MAJMIN}/collections " +
180 "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py ")
181
182 m.addPackage( "${PN}-dev", "Python Development Package", "${PN}-core",
183 "${includedir} " +
184 "${libdir}/lib*${SOLIBSDEV} " +
185 "${libdir}/*.la " +
186 "${libdir}/*.a " +
187 "${libdir}/*.o " +
188 "${libdir}/pkgconfig " +
189 "${base_libdir}/*.a " +
190 "${base_libdir}/*.o " +
191 "${datadir}/aclocal " +
192 "${datadir}/pkgconfig " )
193
194 m.addPackage( "${PN}-2to3", "Python Automated Python 2 to 3 code translation", "${PN}-core",
195 "${bindir}/2to3 lib2to3" ) # package
196
197 m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter",
198 "${bindir}/idle idlelib" ) # package
199
200 m.addPackage( "${PN}-pydoc", "Python Interactive Help Support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re",
201 "${bindir}/pydoc pydoc.* pydoc_data" )
202
203 m.addPackage( "${PN}-smtpd", "Python Simple Mail Transport Daemon", "${PN}-core ${PN}-netserver ${PN}-email ${PN}-mime",
204 "${bindir}/smtpd.* smtpd.*" )
205
206 m.addPackage( "${PN}-audio", "Python Audio Handling", "${PN}-core",
207 "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.*.so lib-dynload/audioop.*.so audiodev.* sunaudio.* sunau.* toaiff.*" )
208
209 m.addPackage( "${PN}-codecs", "Python Codecs, Encodings & i18n Support", "${PN}-core ${PN}-lang",
210 "codecs.* encodings gettext.* locale.* lib-dynload/_locale.*.so lib-dynload/_codecs* lib-dynload/_multibytecodec.*.so lib-dynload/unicodedata.*.so stringprep.* xdrlib.*" )
211
212 m.addPackage( "${PN}-compile", "Python Bytecode Compilation Support", "${PN}-core",
213 "py_compile.* compileall.*" )
214
215 m.addPackage( "${PN}-compression", "Python High Level Compression Support", "${PN}-core ${PN}-codecs",
216 "gzip.* zipfile.* tarfile.* lib-dynload/bz2.*.so" )
217
218 m.addPackage( "${PN}-crypt", "Python Basic Cryptographic and Hashing Support", "${PN}-core",
219 "hashlib.* md5.* sha.* lib-dynload/crypt.*.so lib-dynload/_hashlib.*.so lib-dynload/_sha256.*.so lib-dynload/_sha512.*.so" )
220
221 m.addPackage( "${PN}-textutils", "Python Option Parsing, Text Wrapping and Comma-Separated-Value Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold",
222 "lib-dynload/_csv.*.so csv.* optparse.* textwrap.*" )
223
224 m.addPackage( "${PN}-curses", "Python Curses Support", "${PN}-core",
225 "curses lib-dynload/_curses.*.so lib-dynload/_curses_panel.*.so" ) # directory + low level module
226
227 m.addPackage( "${PN}-ctypes", "Python C Types Support", "${PN}-core",
228 "ctypes lib-dynload/_ctypes.*.so lib-dynload/_ctypes_test.*.so" ) # directory + low level module
229
230 m.addPackage( "${PN}-datetime", "Python Calendar and Time support", "${PN}-core ${PN}-codecs",
231 "_strptime.* calendar.* lib-dynload/datetime.*.so" )
232
233 m.addPackage( "${PN}-db", "Python File-Based Database Support", "${PN}-core",
234 "anydbm.* dumbdbm.* whichdb.* dbm lib-dynload/_dbm.*.so" )
235
236 m.addPackage( "${PN}-debugger", "Python Debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint",
237 "bdb.* pdb.*" )
238
239 m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects.", "${PN}-lang ${PN}-re",
240 "difflib.*" )
241
242 m.addPackage( "${PN}-distutils-staticdev", "Python Distribution Utilities (Static Libraries)", "${PN}-distutils",
243 "config/lib*.a" ) # package
244
245 m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core",
246 "config distutils" ) # package
247
248 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",
249 "doctest.*" )
250
251 # FIXME consider adding to some higher level package
252 m.addPackage( "${PN}-elementtree", "Python elementree", "${PN}-core",
253 "lib-dynload/_elementtree.*.so" )
254
255 m.addPackage( "${PN}-email", "Python Email Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient",
256 "imaplib.* email" ) # package
257
258 m.addPackage( "${PN}-fcntl", "Python's fcntl Interface", "${PN}-core",
259 "lib-dynload/fcntl.*.so" )
260
261 m.addPackage( "${PN}-html", "Python HTML Processing", "${PN}-core",
262 "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* HTMLParser.* " )
263
264 m.addPackage( "${PN}-gdbm", "Python GNU Database Support", "${PN}-core",
265 "lib-dynload/_gdbm.*.so" )
266
267 m.addPackage( "${PN}-image", "Python Graphical Image Handling", "${PN}-core",
268 "colorsys.* imghdr.* lib-dynload/imageop.*.so lib-dynload/rgbimg.*.so" )
269
270 m.addPackage( "${PN}-io", "Python Low-Level I/O", "${PN}-core ${PN}-math",
271 "lib-dynload/_socket.*.so lib-dynload/_io.*.so lib-dynload/_ssl.*.so lib-dynload/select.*.so lib-dynload/termios.*.so lib-dynload/cStringIO.*.so " +
272 "pipes.* socket.* ssl.* tempfile.* StringIO.* io.* _pyio.*" )
273
274 m.addPackage( "${PN}-json", "Python JSON Support", "${PN}-core ${PN}-math ${PN}-re",
275 "json lib-dynload/_json.*.so" ) # package
276
277 m.addPackage( "${PN}-lang", "Python Low-Level Language Support", "${PN}-core",
278 "lib-dynload/_bisect.*.so lib-dynload/_collections.*.so lib-dynload/_heapq.*.so lib-dynload/_weakref.*.so lib-dynload/_functools.*.so " +
279 "lib-dynload/array.*.so lib-dynload/itertools.*.so lib-dynload/operator.*.so lib-dynload/parser.*.so " +
280 "atexit.* bisect.* code.* codeop.* collections.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* symbol.* repr.* token.* " +
281 "tokenize.* traceback.* weakref.*" )
282
283 m.addPackage( "${PN}-logging", "Python Logging Support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold",
284 "logging" ) # package
285
286 m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime",
287 "mailbox.*" )
288
289 m.addPackage( "${PN}-math", "Python Math Support", "${PN}-core",
290 "lib-dynload/cmath.*.so lib-dynload/math.*.so lib-dynload/_random.*.so random.* sets.*" )
291
292 m.addPackage( "${PN}-mime", "Python MIME Handling APIs", "${PN}-core ${PN}-io",
293 "mimetools.* uu.* quopri.* rfc822.* MimeWriter.*" )
294
295 m.addPackage( "${PN}-mmap", "Python Memory-Mapped-File Support", "${PN}-core ${PN}-io",
296 "lib-dynload/mmap.*.so " )
297
298 m.addPackage( "${PN}-multiprocessing", "Python Multiprocessing Support", "${PN}-core ${PN}-io ${PN}-lang",
299 "lib-dynload/_multiprocessing.*.so multiprocessing" ) # package
300
301 m.addPackage( "${PN}-netclient", "Python Internet Protocol Clients", "${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime",
302 "*Cookie*.* " +
303 "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.* uuid.* rfc822.* mimetools.*" )
304
305 m.addPackage( "${PN}-netserver", "Python Internet Protocol Servers", "${PN}-core ${PN}-netclient",
306 "cgi.* *HTTPServer.* SocketServer.*" )
307
308 m.addPackage( "${PN}-numbers", "Python Number APIs", "${PN}-core ${PN}-lang ${PN}-re",
309 "decimal.* numbers.*" )
310
311 m.addPackage( "${PN}-pickle", "Python Persistence Support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re",
312 "pickle.* shelve.* lib-dynload/cPickle.*.so pickletools.*" )
313
314 m.addPackage( "${PN}-pkgutil", "Python Package Extension Utility Support", "${PN}-core",
315 "pkgutil.*")
316
317 m.addPackage( "${PN}-pprint", "Python Pretty-Print Support", "${PN}-core",
318 "pprint.*" )
319
320 m.addPackage( "${PN}-profile", "Python Basic Profiling Support", "${PN}-core ${PN}-textutils",
321 "profile.* pstats.* cProfile.* lib-dynload/_lsprof.*.so" )
322
323 m.addPackage( "${PN}-re", "Python Regular Expression APIs", "${PN}-core",
324 "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin
325
326 m.addPackage( "${PN}-readline", "Python Readline Support", "${PN}-core",
327 "lib-dynload/readline.*.so rlcompleter.*" )
328
329 m.addPackage( "${PN}-resource", "Python Resource Control Interface", "${PN}-core",
330 "lib-dynload/resource.*.so" )
331
332 m.addPackage( "${PN}-shell", "Python Shell-Like Functionality", "${PN}-core ${PN}-re",
333 "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shlex.* shutil.*" )
334
335 m.addPackage( "${PN}-robotparser", "Python robots.txt parser", "${PN}-core ${PN}-netclient",
336 "urllib/robotparser.*")
337
338 m.addPackage( "${PN}-subprocess", "Python Subprocess Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle",
339 "subprocess.*" )
340
341 m.addPackage( "${PN}-sqlite3", "Python Sqlite3 Database Support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading",
342 "lib-dynload/_sqlite3.*.so sqlite3/dbapi2.* sqlite3/__init__.* sqlite3/dump.*" )
343
344 m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 Database Support Tests", "${PN}-core ${PN}-sqlite3",
345 "sqlite3/test" )
346
347 m.addPackage( "${PN}-stringold", "Python String APIs [deprecated]", "${PN}-core ${PN}-re",
348 "lib-dynload/strop.*.so string.* stringold.*" )
349
350 m.addPackage( "${PN}-syslog", "Python Syslog Interface", "${PN}-core",
351 "lib-dynload/syslog.*.so" )
352
353 m.addPackage( "${PN}-terminal", "Python Terminal Controlling Support", "${PN}-core ${PN}-io",
354 "pty.* tty.*" )
355
356 m.addPackage( "${PN}-tests", "Python Tests", "${PN}-core",
357 "test" ) # package
358
359 m.addPackage( "${PN}-threading", "Python Threading & Synchronization Support", "${PN}-core ${PN}-lang",
360 "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" )
361
362 m.addPackage( "${PN}-tkinter", "Python Tcl/Tk Bindings", "${PN}-core",
363 "lib-dynload/_tkinter.*.so lib-tk tkinter" ) # package
364
365 m.addPackage( "${PN}-unittest", "Python Unit Testing Framework", "${PN}-core ${PN}-stringold ${PN}-lang",
366 "unittest/" )
367
368 m.addPackage( "${PN}-unixadmin", "Python Unix Administration Support", "${PN}-core",
369 "lib-dynload/nis.*.so lib-dynload/grp.*.so lib-dynload/pwd.*.so getpass.*" )
370
371 m.addPackage( "${PN}-xml", "Python basic XML support.", "${PN}-core ${PN}-elementtree ${PN}-re",
372 "lib-dynload/pyexpat.*.so xml xmllib.*" ) # package
373
374 m.addPackage( "${PN}-xmlrpc", "Python XMLRPC Support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang",
375 "xmlrpclib.* SimpleXMLRPCServer.* DocXMLRPCServer.* xmlrpc" )
376
377 m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime",
378 "mailbox.*" )
379
380 m.make()