generate-manifest-2.6.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. #!/usr/bin/env python
  2. # generate Python Manifest for the OpenEmbedded build system
  3. # (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
  4. # (C) 2007 Jeremy Laine
  5. # licensed under MIT, see COPYING.MIT
  6. import os
  7. import sys
  8. import time
  9. VERSION = "2.6.6"
  10. __author__ = "Michael 'Mickey' Lauer <mlauer@vanille-media.de>"
  11. __version__ = "20110222"
  12. class MakefileMaker:
  13. def __init__( self, outfile ):
  14. """initialize"""
  15. self.packages = {}
  16. self.targetPrefix = "${libdir}/python%s/" % VERSION[:3]
  17. self.output = outfile
  18. self.out( """
  19. # WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file.
  20. # Generator: '%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
  21. # Visit the Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy
  22. """ % ( sys.argv[0], __version__ ) )
  23. #
  24. # helper functions
  25. #
  26. def out( self, data ):
  27. """print a line to the output file"""
  28. self.output.write( "%s\n" % data )
  29. def setPrefix( self, targetPrefix ):
  30. """set a file prefix for addPackage files"""
  31. self.targetPrefix = targetPrefix
  32. def doProlog( self ):
  33. self.out( """ """ )
  34. self.out( "" )
  35. def addPackage( self, name, description, dependencies, filenames ):
  36. """add a package to the Makefile"""
  37. if type( filenames ) == type( "" ):
  38. filenames = filenames.split()
  39. fullFilenames = []
  40. for filename in filenames:
  41. if filename[0] != "$":
  42. fullFilenames.append( "%s%s" % ( self.targetPrefix, filename ) )
  43. else:
  44. fullFilenames.append( filename )
  45. self.packages[name] = description, dependencies, fullFilenames
  46. def doBody( self ):
  47. """generate body of Makefile"""
  48. global VERSION
  49. #
  50. # generate provides line
  51. #
  52. provideLine = 'PROVIDES+="'
  53. for name in sorted(self.packages):
  54. provideLine += "%s " % name
  55. provideLine += '"'
  56. self.out( provideLine )
  57. self.out( "" )
  58. #
  59. # generate package line
  60. #
  61. packageLine = 'PACKAGES="${PN}-core-dbg '
  62. for name in sorted(self.packages):
  63. if name != '${PN}-core-dbg':
  64. packageLine += "%s " % name
  65. packageLine += '${PN}-modules"'
  66. self.out( packageLine )
  67. self.out( "" )
  68. #
  69. # generate package variables
  70. #
  71. for name, data in sorted(self.packages.iteritems()):
  72. desc, deps, files = data
  73. #
  74. # write out the description, revision and dependencies
  75. #
  76. self.out( 'DESCRIPTION_%s="%s"' % ( name, desc ) )
  77. self.out( 'RDEPENDS_%s="%s"' % ( name, deps ) )
  78. line = 'FILES_%s="' % name
  79. #
  80. # check which directories to make in the temporary directory
  81. #
  82. dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead.
  83. for target in files:
  84. dirset[os.path.dirname( target )] = True
  85. #
  86. # generate which files to copy for the target (-dfR because whole directories are also allowed)
  87. #
  88. for target in files:
  89. line += "%s " % target
  90. line += '"'
  91. self.out( line )
  92. self.out( "" )
  93. self.out( 'DESCRIPTION_${PN}-modules="All Python modules"' )
  94. line = 'RDEPENDS_${PN}-modules="'
  95. for name, data in sorted(self.packages.iteritems()):
  96. if name not in ['${PN}-core-dbg', '${PN}-dev']:
  97. line += "%s " % name
  98. self.out( "%s \"" % line )
  99. self.out( 'ALLOW_EMPTY_${PN}-modules = "1"' )
  100. def doEpilog( self ):
  101. self.out( """""" )
  102. self.out( "" )
  103. def make( self ):
  104. self.doProlog()
  105. self.doBody()
  106. self.doEpilog()
  107. if __name__ == "__main__":
  108. if len( sys.argv ) > 1:
  109. os.popen( "rm -f ./%s" % sys.argv[1] )
  110. outfile = file( sys.argv[1], "w" )
  111. else:
  112. outfile = sys.stdout
  113. m = MakefileMaker( outfile )
  114. # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies!
  115. # Parameters: revision, name, description, dependencies, filenames
  116. #
  117. m.addPackage( "${PN}-core", "Python Interpreter and core modules (needed!)", "",
  118. "__future__.* _abcoll.* abc.* copy.* copy_reg.* ConfigParser.* " +
  119. "genericpath.* getopt.* linecache.* new.* " +
  120. "os.* posixpath.* struct.* " +
  121. "warnings.* site.* stat.* " +
  122. "UserDict.* UserList.* UserString.* " +
  123. "lib-dynload/binascii.so lib-dynload/_struct.so lib-dynload/time.so " +
  124. "lib-dynload/xreadlines.so types.* platform.* ${bindir}/python*" )
  125. m.addPackage( "${PN}-core-dbg", "Python core module debug information", "${PN}-core",
  126. "config/.debug lib-dynload/.debug ${bindir}/.debug ${libdir}/.debug" )
  127. m.addPackage( "${PN}-dev", "Python Development Package", "${PN}-core",
  128. "${includedir} ${libdir}/libpython2.6.so" ) # package
  129. m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter",
  130. "${bindir}/idle idlelib" ) # package
  131. m.addPackage( "${PN}-pydoc", "Python Interactive Help Support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re",
  132. "${bindir}/pydoc pydoc.*" )
  133. m.addPackage( "${PN}-smtpd", "Python Simple Mail Transport Daemon", "${PN}-core ${PN}-netserver ${PN}-email ${PN}-mime",
  134. "${bindir}/smtpd.*" )
  135. m.addPackage( "${PN}-audio", "Python Audio Handling", "${PN}-core",
  136. "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.so lib-dynload/audioop.so" )
  137. m.addPackage( "${PN}-bsddb", "Python Berkeley Database Bindings", "${PN}-core",
  138. "bsddb lib-dynload/_bsddb.so" ) # package
  139. m.addPackage( "${PN}-codecs", "Python Codecs, Encodings & i18n Support", "${PN}-core ${PN}-lang",
  140. "codecs.* encodings gettext.* locale.* lib-dynload/_locale.so lib-dynload/unicodedata.so stringprep.* xdrlib.*" )
  141. m.addPackage( "${PN}-compile", "Python Bytecode Compilation Support", "${PN}-core",
  142. "py_compile.* compileall.*" )
  143. m.addPackage( "${PN}-compiler", "Python Compiler Support", "${PN}-core",
  144. "compiler" ) # package
  145. m.addPackage( "${PN}-compression", "Python High Level Compression Support", "${PN}-core ${PN}-zlib",
  146. "gzip.* zipfile.* tarfile.* lib-dynload/bz2.so" )
  147. m.addPackage( "${PN}-crypt", "Python Basic Cryptographic and Hashing Support", "${PN}-core",
  148. "hashlib.* md5.* sha.* lib-dynload/crypt.so lib-dynload/_hashlib.so lib-dynload/_sha256.so lib-dynload/_sha512.so" )
  149. m.addPackage( "${PN}-textutils", "Python Option Parsing, Text Wrapping and Comma-Separated-Value Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold",
  150. "lib-dynload/_csv.so csv.* optparse.* textwrap.*" )
  151. m.addPackage( "${PN}-curses", "Python Curses Support", "${PN}-core",
  152. "curses lib-dynload/_curses.so lib-dynload/_curses_panel.so" ) # directory + low level module
  153. m.addPackage( "${PN}-ctypes", "Python C Types Support", "${PN}-core",
  154. "ctypes lib-dynload/_ctypes.so" ) # directory + low level module
  155. m.addPackage( "${PN}-datetime", "Python Calendar and Time support", "${PN}-core ${PN}-codecs",
  156. "_strptime.* calendar.* lib-dynload/datetime.so" )
  157. m.addPackage( "${PN}-db", "Python File-Based Database Support", "${PN}-core",
  158. "anydbm.* dumbdbm.* whichdb.* " )
  159. m.addPackage( "${PN}-debugger", "Python Debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint",
  160. "bdb.* pdb.*" )
  161. m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects.", "${PN}-lang ${PN}-re",
  162. "difflib.*" )
  163. m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core",
  164. "config distutils" ) # package
  165. 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",
  166. "doctest.*" )
  167. # FIXME consider adding to some higher level package
  168. m.addPackage( "${PN}-elementtree", "Python elementree", "${PN}-core",
  169. "lib-dynload/_elementtree.so" )
  170. m.addPackage( "${PN}-email", "Python Email Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient",
  171. "imaplib.* email" ) # package
  172. m.addPackage( "${PN}-fcntl", "Python's fcntl Interface", "${PN}-core",
  173. "lib-dynload/fcntl.so" )
  174. m.addPackage( "${PN}-hotshot", "Python Hotshot Profiler", "${PN}-core",
  175. "hotshot lib-dynload/_hotshot.so" )
  176. m.addPackage( "${PN}-html", "Python HTML Processing", "${PN}-core",
  177. "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* " )
  178. m.addPackage( "${PN}-gdbm", "Python GNU Database Support", "${PN}-core",
  179. "lib-dynload/gdbm.so" )
  180. m.addPackage( "${PN}-image", "Python Graphical Image Handling", "${PN}-core",
  181. "colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" )
  182. m.addPackage( "${PN}-io", "Python Low-Level I/O", "${PN}-core ${PN}-math",
  183. "lib-dynload/_socket.so lib-dynload/_ssl.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so " +
  184. "pipes.* socket.* ssl.* tempfile.* StringIO.* " )
  185. m.addPackage( "${PN}-json", "Python JSON Support", "${PN}-core ${PN}-math ${PN}-re",
  186. "json" ) # package
  187. m.addPackage( "${PN}-lang", "Python Low-Level Language Support", "${PN}-core",
  188. "lib-dynload/_bisect.so lib-dynload/_collections.so lib-dynload/_heapq.so lib-dynload/_weakref.so lib-dynload/_functools.so " +
  189. "lib-dynload/array.so lib-dynload/itertools.so lib-dynload/operator.so lib-dynload/parser.so " +
  190. "atexit.* bisect.* code.* codeop.* collections.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* symbol.* repr.* token.* " +
  191. "tokenize.* traceback.* weakref.*" )
  192. m.addPackage( "${PN}-logging", "Python Logging Support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold",
  193. "logging" ) # package
  194. m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime",
  195. "mailbox.*" )
  196. m.addPackage( "${PN}-math", "Python Math Support", "${PN}-core",
  197. "lib-dynload/cmath.so lib-dynload/math.so lib-dynload/_random.so random.* sets.*" )
  198. m.addPackage( "${PN}-mime", "Python MIME Handling APIs", "${PN}-core ${PN}-io",
  199. "mimetools.* uu.* quopri.* rfc822.*" )
  200. m.addPackage( "${PN}-mmap", "Python Memory-Mapped-File Support", "${PN}-core ${PN}-io",
  201. "lib-dynload/mmap.so " )
  202. m.addPackage( "${PN}-multiprocessing", "Python Multiprocessing Support", "${PN}-core ${PN}-io ${PN}-lang",
  203. "lib-dynload/_multiprocessing.so multiprocessing" ) # package
  204. m.addPackage( "${PN}-netclient", "Python Internet Protocol Clients", "${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime",
  205. "*Cookie*.* " +
  206. "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.* uuid.* rfc822.* mimetools.*" )
  207. m.addPackage( "${PN}-netserver", "Python Internet Protocol Servers", "${PN}-core ${PN}-netclient",
  208. "cgi.* *HTTPServer.* SocketServer.*" )
  209. m.addPackage( "${PN}-numbers", "Python Number APIs", "${PN}-core ${PN}-lang ${PN}-re",
  210. "decimal.* numbers.*" )
  211. m.addPackage( "${PN}-pickle", "Python Persistence Support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re",
  212. "pickle.* shelve.* lib-dynload/cPickle.so" )
  213. m.addPackage( "${PN}-pkgutil", "Python Package Extension Utility Support", "${PN}-core",
  214. "pkgutil.*")
  215. m.addPackage( "${PN}-pprint", "Python Pretty-Print Support", "${PN}-core",
  216. "pprint.*" )
  217. m.addPackage( "${PN}-profile", "Python Basic Profiling Support", "${PN}-core ${PN}-textutils",
  218. "profile.* pstats.* cProfile.* lib-dynload/_lsprof.so" )
  219. m.addPackage( "${PN}-re", "Python Regular Expression APIs", "${PN}-core",
  220. "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin
  221. m.addPackage( "${PN}-readline", "Python Readline Support", "${PN}-core",
  222. "lib-dynload/readline.so rlcompleter.*" )
  223. m.addPackage( "${PN}-resource", "Python Resource Control Interface", "${PN}-core",
  224. "lib-dynload/resource.so" )
  225. m.addPackage( "${PN}-shell", "Python Shell-Like Functionality", "${PN}-core ${PN}-re",
  226. "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shlex.* shutil.*" )
  227. m.addPackage( "${PN}-robotparser", "Python robots.txt parser", "${PN}-core ${PN}-netclient",
  228. "robotparser.*")
  229. m.addPackage( "${PN}-subprocess", "Python Subprocess Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle",
  230. "subprocess.*" )
  231. m.addPackage( "${PN}-sqlite3", "Python Sqlite3 Database Support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading ${PN}-zlib",
  232. "lib-dynload/_sqlite3.so sqlite3/dbapi2.* sqlite3/__init__.* sqlite3/dump.*" )
  233. m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 Database Support Tests", "${PN}-core ${PN}-sqlite3",
  234. "sqlite3/test" )
  235. m.addPackage( "${PN}-stringold", "Python String APIs [deprecated]", "${PN}-core ${PN}-re",
  236. "lib-dynload/strop.so string.*" )
  237. m.addPackage( "${PN}-syslog", "Python Syslog Interface", "${PN}-core",
  238. "lib-dynload/syslog.so" )
  239. m.addPackage( "${PN}-terminal", "Python Terminal Controlling Support", "${PN}-core ${PN}-io",
  240. "pty.* tty.*" )
  241. m.addPackage( "${PN}-tests", "Python Tests", "${PN}-core",
  242. "test" ) # package
  243. m.addPackage( "${PN}-threading", "Python Threading & Synchronization Support", "${PN}-core ${PN}-lang",
  244. "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" )
  245. m.addPackage( "${PN}-tkinter", "Python Tcl/Tk Bindings", "${PN}-core",
  246. "lib-dynload/_tkinter.so lib-tk" ) # package
  247. m.addPackage( "${PN}-unittest", "Python Unit Testing Framework", "${PN}-core ${PN}-stringold ${PN}-lang",
  248. "unittest.*" )
  249. m.addPackage( "${PN}-unixadmin", "Python Unix Administration Support", "${PN}-core",
  250. "lib-dynload/nis.so lib-dynload/grp.so lib-dynload/pwd.so getpass.*" )
  251. m.addPackage( "${PN}-xml", "Python basic XML support.", "${PN}-core ${PN}-elementtree ${PN}-re",
  252. "lib-dynload/pyexpat.so xml xmllib.*" ) # package
  253. m.addPackage( "${PN}-xmlrpc", "Python XMLRPC Support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang",
  254. "xmlrpclib.* SimpleXMLRPCServer.*" )
  255. m.addPackage( "${PN}-zlib", "Python zlib Support.", "${PN}-core",
  256. "lib-dynload/zlib.so" )
  257. m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime",
  258. "mailbox.*" )
  259. m.make()