Start packaging the bz2 python module as it is needed for building Qt5
[profile/ivi/python.git] / packaging / pythonstart
1 # startup script for python to enable saving of interpreter history and
2 # enabling name completion
3
4 # import needed modules
5 import atexit
6 import os
7 import readline
8 import rlcompleter
9
10 # where is history saved
11 historyPath = os.path.expanduser("~/.pyhistory")
12
13 # handler for saving history
14 def save_history(historyPath=historyPath):
15     import readline
16     readline.write_history_file(historyPath)
17
18 # read history, if it exists
19 if os.path.exists(historyPath):
20     readline.set_history_length(10000)
21     readline.read_history_file(historyPath)
22
23 # register saving handler
24 atexit.register(save_history)
25
26 # enable completion
27 readline.parse_and_bind('tab: complete')
28
29 # cleanup
30 del os, atexit, readline, rlcompleter, save_history, historyPath