From 4d0023adf6b1f76028b40d9edf313f94c831cc90 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Thu, 28 Jan 2010 12:51:22 +0000 Subject: python: add version 2.6.4 Signed-off-by: Martin Jansa Acked-by: Michael 'Mickey' Lauer --- recipes/python/python-2.6.4/sitecustomize.py | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 recipes/python/python-2.6.4/sitecustomize.py (limited to 'recipes/python/python-2.6.4/sitecustomize.py') diff --git a/recipes/python/python-2.6.4/sitecustomize.py b/recipes/python/python-2.6.4/sitecustomize.py new file mode 100644 index 0000000000..273901898a --- /dev/null +++ b/recipes/python/python-2.6.4/sitecustomize.py @@ -0,0 +1,45 @@ +# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer +# GPLv2 or later +# Version: 20081123 +# Features: +# * set proper default encoding +# * enable readline completion in the interactive interpreter +# * load command line history on startup +# * save command line history on exit + +import os + +def __exithandler(): + try: + readline.write_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) ) + except IOError: + pass + +def __registerExitHandler(): + import atexit + atexit.register( __exithandler ) + +def __enableReadlineSupport(): + readline.set_history_length( 1000 ) + readline.parse_and_bind( "tab: complete" ) + try: + readline.read_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) ) + except IOError: + pass + +def __enableDefaultEncoding(): + import sys + try: + sys.setdefaultencoding( "utf8" ) + except LookupError: + pass + +import sys +try: + import rlcompleter, readline +except ImportError: + pass +else: + __enableDefaultEncoding() + __registerExitHandler() + __enableReadlineSupport() -- cgit v1.2.3