diff options
Diffstat (limited to 'meta-extras/packages/python/python-2.5.2/sitecustomize.py')
-rw-r--r-- | meta-extras/packages/python/python-2.5.2/sitecustomize.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/meta-extras/packages/python/python-2.5.2/sitecustomize.py b/meta-extras/packages/python/python-2.5.2/sitecustomize.py new file mode 100644 index 0000000000..ec626b4b63 --- /dev/null +++ b/meta-extras/packages/python/python-2.5.2/sitecustomize.py | |||
@@ -0,0 +1,44 @@ | |||
1 | # OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de> | ||
2 | # GPLv2 or later | ||
3 | # Version: 20082201 | ||
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 | |||
10 | import os | ||
11 | |||
12 | def __exithandler(): | ||
13 | try: | ||
14 | readline.write_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) ) | ||
15 | except IOError: | ||
16 | pass | ||
17 | |||
18 | def __registerExitHandler(): | ||
19 | import atexit | ||
20 | atexit.register( __exithandler ) | ||
21 | |||
22 | def __enableReadlineSupport(): | ||
23 | readline.parse_and_bind("tab: complete") | ||
24 | try: | ||
25 | readline.read_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) ) | ||
26 | except IOError: | ||
27 | pass | ||
28 | |||
29 | def __enableDefaultEncoding(): | ||
30 | import sys | ||
31 | try: | ||
32 | sys.setdefaultencoding('utf8') | ||
33 | except LookupError: | ||
34 | pass | ||
35 | |||
36 | import sys | ||
37 | try: | ||
38 | import rlcompleter, readline | ||
39 | except ImportError: | ||
40 | pass | ||
41 | else: | ||
42 | __enableDefaultEncoding() | ||
43 | __registerExitHandler() | ||
44 | __enableReadlineSupport() | ||