Python standard lib: provide a new package for SSL support (lib-dynload/_ssl.so)
Hello,
I'm using Python on a target where RAM is quite limited. I've noticed that "import socket" module will dynload libcrypto.so.0.9.8 and libssl.so.0.9.8, which are quite big.
Currently, Python SSL support is provided through the package "python-io". I propose to remove "${libdir}/python2.5/lib-dynload/_ssl.so" from FILES_python-io and to put it in a new package called, for example, "python-ssl".
This way, you can selectively enable/disable SSL support by installing removing python-ssl package. This allows to save memory in situations where you need Python socket module without SSL support.
Here is an example of memory usage (using pmap), resp. without and with python-ssl installed. A Python interpreter is started and the module socket is imported.
==================================================================
import-socket-with-ssl.txt renamed from import-socket-without-ssl.txt +17 -4
@@ -1,8 +1,8 @@ -1961: python +1977: python Address Kbytes RSS Anon Locked Mode Mapping 00008000 4 - - - r-x-- python 00010000 4 - - - rw--- python -00011000 524 - - - rwx-- [ anon ] +00011000 536 - - - rwx-- [ anon ] 40000000 112 - - - r-x-- ld-2.6.1.so 4001c000 12 - - - rw--- [ anon ] 40023000 8 - - - rw--- ld-2.6.1.so
@@ -36,6 +36,19 @@ 403d4000 48 - - - r-x-- _socket.so 403e0000 32 - - - ----- _socket.so 403e8000 12 - - - rw--- _socket.so -bef97000 84 - - - rwx-- [ stack ] +403eb000 16 - - - r-x-- _ssl.so +403ef000 28 - - - ----- _ssl.so +403f6000 4 - - - rw--- _ssl.so +403f7000 224 - - - r-x-- libssl.so.0.9.8 +4042f000 28 - - - ----- libssl.so.0.9.8 +40436000 16 - - - rw--- libssl.so.0.9.8 +4043a000 1108 - - - r-x-- libcrypto.so.0.9.8 +4054f000 28 - - - ----- libcrypto.so.0.9.8 +40556000 84 - - - rw--- libcrypto.so.0.9.8 +4056b000 12 - - - rw--- [ anon ] +4056e000 40 - - - r-x-- libgcc_s.so.1 +40578000 28 - - - ----- libgcc_s.so.1 +4057f000 4 - - - rw--- libgcc_s.so.1 +be91d000 84 - - - rwx-- [ stack ] -------- ------- ------- ------- ------- -total kB 4612 - - - +total kB 6244 - - -
=======================================================================
The attached patch contains the modifications to generate-manifest-2.5.py in order to move SSL support into a new package called "python-ssl". In this case, other Python package dependency list should of course be adjusted accordingly when SSL support is needed:
s/RDEPENDS="python-io"/RDEPENDS="python-io python-ssl"/
Best Regards,
Signature · 1 line
Cyril
From 6f55a737439f8e21919a50c4d81801bbc95e5d4c Mon Sep 17 00:00:00 2001
From: Cyril Humbert <[email protected]>
Date: Thu, 6 Nov 2008 17:11:09 +0100
Subject: [PATCH] Python-2.5: provide lib-dynload/_ssl.so in a new package: python-ssl
--- meta/packages/python/python-2.5-manifest.inc | 54 ++++++++++++++------------ scripts/generate-manifest-2.5.py | 21 +++++++--- 2 files changed, 43 insertions(+), 32 deletions(-)
meta/packages/python/python-2.5-manifest.inc +29 -25
85 lines not on this page · raw message
scripts/generate-manifest-2.5.py +14 -7
@@ -22,10 +22,14 @@ class MakefileMaker: self.packages = {} self.targetPrefix = "${libdir}/python%s/" % VERSION[:3] self.output = outfile - self.out( """ \ + self.out( """\ # WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file. # Generator: '%s' Version %s (C) 2002-2008 Michael 'Mickey' Lauer <[email protected]> # Visit the Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy +# +# See also: +# * <OE_basedir>/contrib/python/generate-manifest-2.5.py +# * <poky_basedir>/scripts/generate-manifest-2.5.py """ % ( sys.argv[0], __version__ ) ) #
@@ -63,15 +67,15 @@ class MakefileMaker: # # generate provides line - # - + # + provideLine = 'PROVIDES+="' for name in self.packages: provideLine += "%s " % name provideLine += '"' self.out( provideLine ) - self.out( "" ) + self.out( "" ) # # generate package line
@@ -233,8 +237,8 @@ if __name__ == "__main__": m.addPackage( 0, "python-image", "Python Graphical Image Handling", "python-core", "colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" ) - m.addPackage( 0, "python-io", "Python Low-Level I/O", "python-core python-math", - "lib-dynload/_socket.so lib-dynload/_ssl.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so " + m.addPackage( 1, "python-io", "Python Low-Level I/O", "python-core python-math", + "lib-dynload/_socket.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so " "pipes.* socket.* tempfile.* StringIO.* " ) m.addPackage( 0, "python-lang", "Python Low-Level Language Support", "python-core",
@@ -262,7 +266,7 @@ if __name__ == "__main__": "lib-dynload/nis.so lib-dynload/grp.so lib-dynload/pwd.so getpass.*" ) m.addPackage( 0, "python-netclient", "Python Internet Protocol Clients", "python-core python-crypt python-datetime python-io python-lang python-logging python-mime", - "*Cookie*.* " + + "*Cookie*.* " + "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.*" ) m.addPackage( 0, "python-netserver", "Python Internet Protocol Servers", "python-core python-netclient",
@@ -304,6 +308,9 @@ if __name__ == "__main__": m.addPackage( 0, "python-sqlite3-tests", "Python Sqlite3 Database Support Tests", "python-core python-sqlite3", "sqlite3/test" ) + + m.addPackage( 0, "python-ssl", "Python SSL Support", "python-core", "lib-dynload/_ssl.so" ) + m.addPackage( 0, "python-stringold", "Python String APIs [deprecated]", "python-core python-re", "lib-dynload/strop.so string.*" )
Signature · 1 line
1.5.6.5