aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/python/python-2.6.5/sitecustomize.py
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2010-08-16 21:35:34 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2010-08-17 10:34:01 +0200
commitb16899ec9eadd8ccae74e31484fa7161798a6445 (patch)
treeeefab896bd3a34640dce30591f57c8abb10afd7c /recipes/python/python-2.6.5/sitecustomize.py
parenta5052d3889a383cd257b7dbb9bf3dedef8cdd5fe (diff)
downloadopenembedded-b16899ec9eadd8ccae74e31484fa7161798a6445.tar.gz
python: import 2.6.5 from poky
* without legacy staging * fix QA issue libpython2: non -dev package contains symlink .so: libpython2 path * use FILESPATHPKG Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Acked-by: Michael 'Mickey' Lauer <mickey@vanille-media.de>
Diffstat (limited to 'recipes/python/python-2.6.5/sitecustomize.py')
-rw-r--r--recipes/python/python-2.6.5/sitecustomize.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/recipes/python/python-2.6.5/sitecustomize.py b/recipes/python/python-2.6.5/sitecustomize.py
new file mode 100644
index 0000000000..273901898a
--- /dev/null
+++ b/recipes/python/python-2.6.5/sitecustomize.py
@@ -0,0 +1,45 @@
+# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
+# 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()