All of lore.kernel.org
 help / color / mirror / Atom feed
* Python standard lib: provide a new package for SSL support (lib-dynload/_ssl.so)
@ 2008-11-07 10:47 Cyril Humbert
  0 siblings, 0 replies; only message in thread
From: Cyril Humbert @ 2008-11-07 10:47 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 3242 bytes --]

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-without-ssl.txt	Fri Nov  7 09:58:35 2008
+++ import-socket-with-ssl.txt	Fri Nov  7 09:59:12 2008
@@ -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,
-- 
Cyril

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0087-Python-2.5-provide-lib-dynload-_ssl.so-in-a-new-pac.patch --]
[-- Type: text/x-patch; name="0087-Python-2.5-provide-lib-dynload-_ssl.so-in-a-new-pac.patch", Size: 12431 bytes --]

From 6f55a737439f8e21919a50c4d81801bbc95e5d4c Mon Sep 17 00:00:00 2001
From: Cyril Humbert <cyril.humbert@martec.fr>
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(-)

diff --git a/meta/packages/python/python-2.5-manifest.inc b/meta/packages/python/python-2.5-manifest.inc
index b882ac0..9c867ca 100644
--- a/meta/packages/python/python-2.5-manifest.inc
+++ b/meta/packages/python/python-2.5-manifest.inc
@@ -1,18 +1,14 @@
-###############################################################################
-### AUTO-GENERATED by './generate-manifest-2.5.py' 
-### [(C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>]
-###
-### Visit THE Python for Embedded Systems Site 
-### http://www.Vanille.de/projects/python.spy
-###
-### Warning: Manual edits will be lost!
-### Note: The script generate-manifest-2.5.py is in OpenEmbedded tree in
-###       the directory contrib/python/ .
-###############################################################################
- 
-PROVIDES+="python-profile python-threading python-distutils python-doctest python-codecs python-ctypes python-pickle python-bzip2 python-datetime python-core python-io python-compiler python-compression python-re python-xmlrpc python-terminal python-email python-image python-tests python-core-dbg python-resource python-devel python-difflib python-math python-syslog python-hotshot python-unixadmin python-textutils python-tkinter python-gdbm python-elementtree python-fcntl python-netclient python-pprint python-netserver python-curses python-smtpd python-html python-readline python-subprocess python-pydoc python-logging python-mailbox python-xml python-mime python-sqlite3 python-sqlite3-tests python-unittest python-stringold python-robotparser python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-idle python-lang python-audio "
-
-PACKAGES="python-profile python-threading python-distutils python-doctest python-codecs python-ctypes python-pickle python-bzip2 python-datetime python-core python-io python-compiler python-compression python-re python-xmlrpc python-terminal python-email python-image python-tests python-core-dbg python-resource python-devel python-difflib python-math python-syslog python-hotshot python-unixadmin python-textutils python-tkinter python-gdbm python-elementtree python-fcntl python-netclient python-pprint python-netserver python-curses python-smtpd python-html python-readline python-subprocess python-pydoc python-logging python-mailbox python-xml python-mime python-sqlite3 python-sqlite3-tests python-unittest python-stringold python-robotparser python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-idle python-lang python-audio "
+# WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file.
+# Generator: './generate-manifest-2.5.py' Version 20081102 (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
+# 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
+
+PROVIDES+="python-profile python-threading python-distutils python-doctest python-codecs python-ctypes python-pickle python-bzip2 python-datetime python-core python-io python-compiler python-compression python-re python-xmlrpc python-terminal python-email python-image python-tests python-core-dbg python-resource python-devel python-difflib python-math python-syslog python-hotshot python-unixadmin python-textutils python-tkinter python-gdbm python-stringold python-fcntl python-netclient python-pprint python-netserver python-curses python-smtpd python-html python-readline python-subprocess python-pydoc python-logging python-mailbox python-xml python-mime python-sqlite3 python-sqlite3-tests python-unittest python-ssl python-robotparser python-elementtree python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-idle python-lang python-audio "
+
+PACKAGES="python-profile python-threading python-distutils python-doctest python-codecs python-ctypes python-pickle python-bzip2 python-datetime python-core python-io python-compiler python-compression python-re python-xmlrpc python-terminal python-email python-image python-tests python-core-dbg python-resource python-devel python-difflib python-math python-syslog python-hotshot python-unixadmin python-textutils python-tkinter python-gdbm python-stringold python-fcntl python-netclient python-pprint python-netserver python-curses python-smtpd python-html python-readline python-subprocess python-pydoc python-logging python-mailbox python-xml python-mime python-sqlite3 python-sqlite3-tests python-unittest python-ssl python-robotparser python-elementtree python-compile python-debugger python-pkgutil python-shell python-bsddb python-mmap python-zlib python-db python-crypt python-idle python-lang python-audio "
 
 DESCRIPTION_python-profile="Python Basic Profiling Support"
 PR_python-profile="ml0"
@@ -65,9 +61,9 @@ RDEPENDS_python-core=""
 FILES_python-core="${libdir}/python2.5/__future__.* ${libdir}/python2.5/copy.* ${libdir}/python2.5/copy_reg.* ${libdir}/python2.5/ConfigParser.* ${libdir}/python2.5/getopt.* ${libdir}/python2.5/linecache.* ${libdir}/python2.5/new.* ${libdir}/python2.5/os.* ${libdir}/python2.5/posixpath.* ${libdir}/python2.5/struct.* ${libdir}/python2.5/warnings.* ${libdir}/python2.5/site.* ${libdir}/python2.5/stat.* ${libdir}/python2.5/UserDict.* ${libdir}/python2.5/UserList.* ${libdir}/python2.5/UserString.* ${libdir}/python2.5/lib-dynload/binascii.so ${libdir}/python2.5/lib-dynload/_struct.so ${libdir}/python2.5/lib-dynload/time.so ${libdir}/python2.5/lib-dynload/xreadlines.so ${libdir}/python2.5/types.* ${bindir}/python* "
 
 DESCRIPTION_python-io="Python Low-Level I/O"
-PR_python-io="ml0"
+PR_python-io="ml1"
 RDEPENDS_python-io="python-core python-math"
-FILES_python-io="${libdir}/python2.5/lib-dynload/_socket.so ${libdir}/python2.5/lib-dynload/_ssl.so ${libdir}/python2.5/lib-dynload/select.so ${libdir}/python2.5/lib-dynload/termios.so ${libdir}/python2.5/lib-dynload/cStringIO.so ${libdir}/python2.5/pipes.* ${libdir}/python2.5/socket.* ${libdir}/python2.5/tempfile.* ${libdir}/python2.5/StringIO.* "
+FILES_python-io="${libdir}/python2.5/lib-dynload/_socket.so ${libdir}/python2.5/lib-dynload/select.so ${libdir}/python2.5/lib-dynload/termios.so ${libdir}/python2.5/lib-dynload/cStringIO.so ${libdir}/python2.5/pipes.* ${libdir}/python2.5/socket.* ${libdir}/python2.5/tempfile.* ${libdir}/python2.5/StringIO.* "
 
 DESCRIPTION_python-compiler="Python Compiler Support"
 PR_python-compiler="ml0"
@@ -164,10 +160,10 @@ PR_python-gdbm="ml0"
 RDEPENDS_python-gdbm="python-core"
 FILES_python-gdbm="${libdir}/python2.5/lib-dynload/gdbm.so "
 
-DESCRIPTION_python-elementtree="Python elementree"
-PR_python-elementtree="ml0"
-RDEPENDS_python-elementtree="python-core"
-FILES_python-elementtree="${libdir}/python2.5/lib-dynload/_elementtree.so "
+DESCRIPTION_python-stringold="Python String APIs [deprecated]"
+PR_python-stringold="ml0"
+RDEPENDS_python-stringold="python-core python-re"
+FILES_python-stringold="${libdir}/python2.5/lib-dynload/strop.so ${libdir}/python2.5/string.* "
 
 DESCRIPTION_python-fcntl="Python's fcntl Interface"
 PR_python-fcntl="ml0"
@@ -254,16 +250,21 @@ PR_python-unittest="ml0"
 RDEPENDS_python-unittest="python-core python-stringold python-lang"
 FILES_python-unittest="${libdir}/python2.5/unittest.* "
 
-DESCRIPTION_python-stringold="Python String APIs [deprecated]"
-PR_python-stringold="ml0"
-RDEPENDS_python-stringold="python-core python-re"
-FILES_python-stringold="${libdir}/python2.5/lib-dynload/strop.so ${libdir}/python2.5/string.* "
+DESCRIPTION_python-ssl="Python SSL Support"
+PR_python-ssl="ml0"
+RDEPENDS_python-ssl="python-core"
+FILES_python-ssl="${libdir}/python2.5/lib-dynload/_ssl.so "
 
 DESCRIPTION_python-robotparser="Python robots.txt parser"
 PR_python-robotparser="ml0"
 RDEPENDS_python-robotparser="python-core python-netclient"
 FILES_python-robotparser="${libdir}/python2.5/robotparser.* "
 
+DESCRIPTION_python-elementtree="Python elementree"
+PR_python-elementtree="ml0"
+RDEPENDS_python-elementtree="python-core"
+FILES_python-elementtree="${libdir}/python2.5/lib-dynload/_elementtree.so "
+
 DESCRIPTION_python-compile="Python Bytecode Compilation Support"
 PR_python-compile="ml0"
 RDEPENDS_python-compile="python-core"
@@ -323,3 +324,6 @@ DESCRIPTION_python-audio="Python Audio Handling"
 PR_python-audio="ml0"
 RDEPENDS_python-audio="python-core"
 FILES_python-audio="${libdir}/python2.5/wave.* ${libdir}/python2.5/chunk.* ${libdir}/python2.5/sndhdr.* ${libdir}/python2.5/lib-dynload/ossaudiodev.so ${libdir}/python2.5/lib-dynload/audioop.so "
+
+
+
diff --git a/scripts/generate-manifest-2.5.py b/scripts/generate-manifest-2.5.py
index 8054608..1635561 100755
--- a/scripts/generate-manifest-2.5.py
+++ b/scripts/generate-manifest-2.5.py
@@ -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 <mlauer@vanille-media.de>
 # 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.*" )
 
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-07 11:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-07 10:47 Python standard lib: provide a new package for SSL support (lib-dynload/_ssl.so) Cyril Humbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.