summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3/sitecustomize.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python3/sitecustomize.py')
-rw-r--r--meta/recipes-devtools/python/python3/sitecustomize.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3/sitecustomize.py b/meta/recipes-devtools/python/python3/sitecustomize.py
new file mode 100644
index 0000000000..4c8b5e2ba3
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/sitecustomize.py
@@ -0,0 +1,37 @@
1# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
2# GPLv2 or later
3# Version: 20081123
4# Features:
5# * set proper default encoding
6# * enable readline completion in the interactive interpreter
7# * load command line history on startup
8# * save command line history on exit
9
10import os
11
12def __exithandler():
13 try:
14 readline.write_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
15 except IOError:
16 pass
17
18def __registerExitHandler():
19 import atexit
20 atexit.register( __exithandler )
21
22def __enableReadlineSupport():
23 readline.set_history_length( 1000 )
24 readline.parse_and_bind( "tab: complete" )
25 try:
26 readline.read_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
27 except IOError:
28 pass
29
30import sys
31try:
32 import rlcompleter, readline
33except ImportError:
34 pass
35else:
36 __registerExitHandler()
37 __enableReadlineSupport()