generate-manifest-3.5.py 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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. #
  7. # June 22, 2011 -- Mark Hatle <mark.hatle@windriver.com>
  8. # * Updated to no longer generate special -dbg package, instead use the
  9. # single system -dbg
  10. # * Update version with ".1" to indicate this change
  11. #
  12. # 2014 Khem Raj <raj.khem@gmail.com>
  13. # Added python3 support
  14. #
  15. import os
  16. import sys
  17. import time
  18. VERSION = "3.5.0"
  19. __author__ = "Michael 'Mickey' Lauer <mlauer@vanille-media.de>"
  20. __version__ = "20140131"
  21. class MakefileMaker:
  22. def __init__( self, outfile ):
  23. """initialize"""
  24. self.packages = {}
  25. self.targetPrefix = "${libdir}/python%s/" % VERSION[:3]
  26. self.output = outfile
  27. self.out( """
  28. # WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file.
  29. # Generator: '%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
  30. # Visit the Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy
  31. """ % ( sys.argv[0], __version__ ) )
  32. #
  33. # helper functions
  34. #
  35. def out( self, data ):
  36. """print a line to the output file"""
  37. self.output.write( "%s\n" % data )
  38. def setPrefix( self, targetPrefix ):
  39. """set a file prefix for addPackage files"""
  40. self.targetPrefix = targetPrefix
  41. def doProlog( self ):
  42. self.out( """ """ )
  43. self.out( "" )
  44. def addPackage( self, name, description, dependencies, filenames ):
  45. """add a package to the Makefile"""
  46. if type( filenames ) == type( "" ):
  47. filenames = filenames.split()
  48. fullFilenames = []
  49. for filename in filenames:
  50. if filename[0] != "$":
  51. fullFilenames.append( "%s%s" % ( self.targetPrefix, filename ) )
  52. else:
  53. fullFilenames.append( filename )
  54. self.packages[name] = description, dependencies, fullFilenames
  55. def doBody( self ):
  56. """generate body of Makefile"""
  57. global VERSION
  58. #
  59. # generate provides line
  60. #
  61. provideLine = 'PROVIDES+="'
  62. for name in sorted(self.packages):
  63. provideLine += "%s " % name
  64. provideLine += '"'
  65. self.out( provideLine )
  66. self.out( "" )
  67. #
  68. # generate package line
  69. #
  70. packageLine = 'PACKAGES="${PN}-dbg '
  71. for name in sorted(self.packages):
  72. if name.startswith("${PN}-distutils"):
  73. if name == "${PN}-distutils":
  74. packageLine += "%s-staticdev %s " % (name, name)
  75. elif name != '${PN}-dbg':
  76. packageLine += "%s " % name
  77. packageLine += '${PN}-modules"'
  78. self.out( packageLine )
  79. self.out( "" )
  80. #
  81. # generate package variables
  82. #
  83. for name, data in sorted(self.packages.items()):
  84. desc, deps, files = data
  85. #
  86. # write out the description, revision and dependencies
  87. #
  88. self.out( 'SUMMARY_%s="%s"' % ( name, desc ) )
  89. self.out( 'RDEPENDS_%s="%s"' % ( name, deps ) )
  90. line = 'FILES_%s="' % name
  91. #
  92. # check which directories to make in the temporary directory
  93. #
  94. dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead.
  95. for target in files:
  96. dirset[os.path.dirname( target )] = True
  97. #
  98. # generate which files to copy for the target (-dfR because whole directories are also allowed)
  99. #
  100. for target in files:
  101. line += "%s " % target
  102. line += '"'
  103. self.out( line )
  104. self.out( "" )
  105. self.out( 'SUMMARY_${PN}-modules="All Python modules"' )
  106. line = 'RDEPENDS_${PN}-modules="'
  107. for name, data in sorted(self.packages.items()):
  108. if name not in ['${PN}-dev', '${PN}-distutils-staticdev']:
  109. line += "%s " % name
  110. self.out( "%s \"" % line )
  111. self.out( 'ALLOW_EMPTY_${PN}-modules = "1"' )
  112. def doEpilog( self ):
  113. self.out( """""" )
  114. self.out( "" )
  115. def make( self ):
  116. self.doProlog()
  117. self.doBody()
  118. self.doEpilog()
  119. if __name__ == "__main__":
  120. if len( sys.argv ) > 1:
  121. try:
  122. os.unlink(sys.argv[1])
  123. except Exception:
  124. sys.exc_clear()
  125. outfile = open( sys.argv[1], "w" )
  126. else:
  127. outfile = sys.stdout
  128. m = MakefileMaker( outfile )
  129. # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies!
  130. # Parameters: revision, name, description, dependencies, filenames
  131. #
  132. m.addPackage( "${PN}-core", "Python interpreter and core modules", "${PN}-lang ${PN}-re ${PN}-reprlib ${PN}-codecs ${PN}-io ${PN}-math",
  133. "__future__.* _abcoll.* abc.* ast.* copy.* copyreg.* configparser.* " +
  134. "genericpath.* getopt.* linecache.* new.* " +
  135. "os.* posixpath.* struct.* " +
  136. "warnings.* site.* stat.* " +
  137. "UserDict.* UserList.* UserString.* " +
  138. "lib-dynload/binascii.*.so lib-dynload/_struct.*.so lib-dynload/time.*.so " +
  139. "lib-dynload/xreadlines.*.so types.* platform.* ${bindir}/python* " +
  140. "_weakrefset.* sysconfig.* _sysconfigdata.* config/Makefile " +
  141. "${includedir}/python${PYTHON_BINABI}/pyconfig*.h " +
  142. "${libdir}/python${PYTHON_MAJMIN}/collections " +
  143. "${libdir}/python${PYTHON_MAJMIN}/_collections_abc.* " +
  144. "${libdir}/python${PYTHON_MAJMIN}/_sitebuiltins.* " +
  145. "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py ")
  146. m.addPackage( "${PN}-dev", "Python development package", "${PN}-core",
  147. "${includedir} " +
  148. "${libdir}/lib*${SOLIBSDEV} " +
  149. "${libdir}/*.la " +
  150. "${libdir}/*.a " +
  151. "${libdir}/*.o " +
  152. "${libdir}/pkgconfig " +
  153. "${base_libdir}/*.a " +
  154. "${base_libdir}/*.o " +
  155. "${datadir}/aclocal " +
  156. "${datadir}/pkgconfig " )
  157. m.addPackage( "${PN}-2to3", "Python automated Python 2 to 3 code translator", "${PN}-core",
  158. "lib2to3" ) # package
  159. m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter",
  160. "${bindir}/idle idlelib" ) # package
  161. m.addPackage( "${PN}-pydoc", "Python interactive help support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re",
  162. "${bindir}/pydoc pydoc.* pydoc_data" )
  163. m.addPackage( "${PN}-smtpd", "Python Simple Mail Transport Daemon", "${PN}-core ${PN}-netserver ${PN}-email ${PN}-mime",
  164. "${bindir}/smtpd.* smtpd.*" )
  165. m.addPackage( "${PN}-audio", "Python Audio Handling", "${PN}-core",
  166. "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.*.so lib-dynload/audioop.*.so audiodev.* sunaudio.* sunau.* toaiff.*" )
  167. m.addPackage( "${PN}-argparse", "Python command line argument parser", "${PN}-core ${PN}-codecs ${PN}-textutils",
  168. "argparse.*" )
  169. m.addPackage( "${PN}-asyncio", "Python Asynchronous I/O, event loop, coroutines and tasks", "${PN}-core",
  170. "asyncio" )
  171. m.addPackage( "${PN}-codecs", "Python codecs, encodings & i18n support", "${PN}-core ${PN}-lang",
  172. "codecs.* encodings gettext.* locale.* lib-dynload/_locale.*.so lib-dynload/_codecs* lib-dynload/_multibytecodec.*.so lib-dynload/unicodedata.*.so stringprep.* xdrlib.*" )
  173. m.addPackage( "${PN}-compile", "Python bytecode compilation support", "${PN}-core",
  174. "py_compile.* compileall.*" )
  175. m.addPackage( "${PN}-compression", "Python high-level compression support", "${PN}-core ${PN}-codecs ${PN}-importlib ${PN}-threading ${PN}-shell",
  176. "gzip.* zipfile.* tarfile.* lib-dynload/bz2.*.so lib-dynload/zlib.*.so" )
  177. m.addPackage( "${PN}-crypt", "Python basic cryptographic and hashing support", "${PN}-core",
  178. "hashlib.* md5.* sha.* lib-dynload/crypt.*.so lib-dynload/_hashlib.*.so lib-dynload/_sha256.*.so lib-dynload/_sha512.*.so" )
  179. m.addPackage( "${PN}-textutils", "Python option parsing, text wrapping and CSV support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold",
  180. "lib-dynload/_csv.*.so csv.* optparse.* textwrap.*" )
  181. m.addPackage( "${PN}-curses", "Python curses support", "${PN}-core",
  182. "curses lib-dynload/_curses.*.so lib-dynload/_curses_panel.*.so" ) # directory + low level module
  183. m.addPackage( "${PN}-ctypes", "Python C types support", "${PN}-core ${PN}-subprocess",
  184. "ctypes lib-dynload/_ctypes.*.so lib-dynload/_ctypes_test.*.so" ) # directory + low level module
  185. m.addPackage( "${PN}-datetime", "Python calendar and time support", "${PN}-core ${PN}-codecs",
  186. "_strptime.* calendar.* datetime.* lib-dynload/_datetime.*.so" )
  187. m.addPackage( "${PN}-db", "Python file-based database support", "${PN}-core",
  188. "anydbm.* dumbdbm.* whichdb.* dbm lib-dynload/_dbm.*.so" )
  189. m.addPackage( "${PN}-debugger", "Python debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint ${PN}-importlib ${PN}-pkgutil",
  190. "bdb.* pdb.*" )
  191. m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects", "${PN}-lang ${PN}-re",
  192. "difflib.*" )
  193. m.addPackage( "${PN}-distutils-staticdev", "Python distribution utilities (static libraries)", "${PN}-distutils",
  194. "config/lib*.a" ) # package
  195. m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core ${PN}-email",
  196. "config distutils" ) # package
  197. 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",
  198. "doctest.*" )
  199. m.addPackage( "${PN}-email", "Python email support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient",
  200. "imaplib.* email" ) # package
  201. m.addPackage( "${PN}-enum", "Python support for enumerations", "${PN}-core",
  202. "enum.*" )
  203. m.addPackage( "${PN}-fcntl", "Python's fcntl interface", "${PN}-core",
  204. "lib-dynload/fcntl.*.so" )
  205. m.addPackage( "${PN}-html", "Python HTML processing support", "${PN}-core",
  206. "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* HTMLParser.* " )
  207. m.addPackage( "${PN}-importlib", "Python import implementation library", "${PN}-core ${PN}-lang",
  208. "importlib imp.*" )
  209. m.addPackage( "${PN}-gdbm", "Python GNU database support", "${PN}-core",
  210. "lib-dynload/_gdbm.*.so" )
  211. m.addPackage( "${PN}-image", "Python graphical image handling", "${PN}-core",
  212. "colorsys.* imghdr.* lib-dynload/imageop.*.so lib-dynload/rgbimg.*.so" )
  213. m.addPackage( "${PN}-io", "Python low-level I/O", "${PN}-core ${PN}-math",
  214. "lib-dynload/_socket.*.so lib-dynload/_io.*.so lib-dynload/_ssl.*.so lib-dynload/select.*.so lib-dynload/termios.*.so lib-dynload/cStringIO.*.so " +
  215. "pipes.* socket.* ssl.* tempfile.* StringIO.* io.* _pyio.*" )
  216. m.addPackage( "${PN}-json", "Python JSON support", "${PN}-core ${PN}-math ${PN}-re",
  217. "json lib-dynload/_json.*.so" ) # package
  218. m.addPackage( "${PN}-lang", "Python low-level language support", "${PN}-core ${PN}-importlib",
  219. "lib-dynload/_bisect.*.so lib-dynload/_collections.*.so lib-dynload/_heapq.*.so lib-dynload/_weakref.*.so lib-dynload/_functools.*.so " +
  220. "lib-dynload/array.*.so lib-dynload/itertools.*.so lib-dynload/operator.*.so lib-dynload/parser.*.so " +
  221. "atexit.* bisect.* code.* codeop.* collections.* _collections_abc.* contextlib.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* operator.* symbol.* repr.* token.* " +
  222. "tokenize.* traceback.* weakref.*" )
  223. m.addPackage( "${PN}-logging", "Python logging support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold",
  224. "logging" ) # package
  225. m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime",
  226. "mailbox.*" )
  227. m.addPackage( "${PN}-math", "Python math support", "${PN}-core ${PN}-crypt",
  228. "lib-dynload/cmath.*.so lib-dynload/math.*.so lib-dynload/_random.*.so random.* sets.*" )
  229. m.addPackage( "${PN}-mime", "Python MIME handling APIs", "${PN}-core ${PN}-io",
  230. "mimetools.* uu.* quopri.* rfc822.* MimeWriter.*" )
  231. m.addPackage( "${PN}-mmap", "Python memory-mapped file support", "${PN}-core ${PN}-io",
  232. "lib-dynload/mmap.*.so " )
  233. m.addPackage( "${PN}-multiprocessing", "Python multiprocessing support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-threading ${PN}-ctypes ${PN}-mmap",
  234. "lib-dynload/_multiprocessing.*.so multiprocessing" ) # package
  235. m.addPackage( "${PN}-netclient", "Python Internet Protocol clients", "${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime",
  236. "*Cookie*.* " +
  237. "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib uuid.* rfc822.* mimetools.*" )
  238. m.addPackage( "${PN}-netserver", "Python Internet Protocol servers", "${PN}-core ${PN}-netclient ${PN}-shell ${PN}-threading",
  239. "cgi.* *HTTPServer.* SocketServer.*" )
  240. m.addPackage( "${PN}-numbers", "Python number APIs", "${PN}-core ${PN}-lang ${PN}-re",
  241. "decimal.* fractions.* numbers.*" )
  242. m.addPackage( "${PN}-pickle", "Python serialisation/persistence support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re",
  243. "pickle.* shelve.* lib-dynload/cPickle.*.so pickletools.*" )
  244. m.addPackage( "${PN}-pkgutil", "Python package extension utility support", "${PN}-core",
  245. "pkgutil.*")
  246. m.addPackage( "${PN}-pprint", "Python pretty-print support", "${PN}-core ${PN}-io",
  247. "pprint.*" )
  248. m.addPackage( "${PN}-profile", "Python basic performance profiling support", "${PN}-core ${PN}-textutils",
  249. "profile.* pstats.* cProfile.* lib-dynload/_lsprof.*.so" )
  250. m.addPackage( "${PN}-re", "Python Regular Expression APIs", "${PN}-core",
  251. "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin
  252. m.addPackage( "${PN}-readline", "Python readline support", "${PN}-core",
  253. "lib-dynload/readline.*.so rlcompleter.*" )
  254. m.addPackage( "${PN}-reprlib", "Python alternate repr() implementation", "${PN}-core",
  255. "reprlib.py" )
  256. m.addPackage( "${PN}-resource", "Python resource control interface", "${PN}-core",
  257. "lib-dynload/resource.*.so" )
  258. m.addPackage( "${PN}-selectors", "Python High-level I/O multiplexing", "${PN}-core",
  259. "selectors.*" )
  260. m.addPackage( "${PN}-shell", "Python shell-like functionality", "${PN}-core ${PN}-re ${PN}-compression",
  261. "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shlex.* shutil.*" )
  262. m.addPackage( "${PN}-signal", "Python set handlers for asynchronous events support", "${PN}-core ${PN}-enum",
  263. "signal.*" )
  264. m.addPackage( "${PN}-subprocess", "Python subprocess support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle ${PN}-threading ${PN}-signal ${PN}-selectors",
  265. "subprocess.* lib-dynload/_posixsubprocess.*.so" )
  266. m.addPackage( "${PN}-sqlite3", "Python Sqlite3 database support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading",
  267. "lib-dynload/_sqlite3.*.so sqlite3/dbapi2.* sqlite3/__init__.* sqlite3/dump.*" )
  268. m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 database support tests", "${PN}-core ${PN}-sqlite3",
  269. "sqlite3/test" )
  270. m.addPackage( "${PN}-stringold", "Python string APIs [deprecated]", "${PN}-core ${PN}-re",
  271. "lib-dynload/strop.*.so string.* stringold.*" )
  272. m.addPackage( "${PN}-syslog", "Python syslog interface", "${PN}-core",
  273. "lib-dynload/syslog.*.so" )
  274. m.addPackage( "${PN}-terminal", "Python terminal controlling support", "${PN}-core ${PN}-io",
  275. "pty.* tty.*" )
  276. m.addPackage( "${PN}-tests", "Python tests", "${PN}-core",
  277. "test" ) # package
  278. m.addPackage( "${PN}-threading", "Python threading & synchronization support", "${PN}-core ${PN}-lang",
  279. "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* queue.*" )
  280. m.addPackage( "${PN}-tkinter", "Python Tcl/Tk bindings", "${PN}-core",
  281. "lib-dynload/_tkinter.*.so lib-tk tkinter" ) # package
  282. m.addPackage( "${PN}-unittest", "Python unit testing framework", "${PN}-core ${PN}-stringold ${PN}-lang ${PN}-io ${PN}-difflib ${PN}-pprint ${PN}-shell",
  283. "unittest/" )
  284. m.addPackage( "${PN}-unixadmin", "Python Unix administration support", "${PN}-core",
  285. "lib-dynload/nis.*.so lib-dynload/grp.*.so lib-dynload/pwd.*.so getpass.*" )
  286. m.addPackage( "${PN}-xml", "Python basic XML support", "${PN}-core ${PN}-re",
  287. "lib-dynload/_elementtree.*.so lib-dynload/pyexpat.*.so xml xmllib.*" ) # package
  288. m.addPackage( "${PN}-xmlrpc", "Python XML-RPC support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang",
  289. "xmlrpclib.* SimpleXMLRPCServer.* DocXMLRPCServer.* xmlrpc" )
  290. m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime",
  291. "mailbox.*" )
  292. m.make()