Create .pyhistory if it doesn't exist
svn: r22974
This commit is contained in:
parent
64d3a217f1
commit
0b0d0c5c05
@ -28,7 +28,33 @@
|
|||||||
import os
|
import os
|
||||||
os.environ['GRAMPS_RESOURCES'] = os.path.dirname(os.path.abspath(".."))
|
os.environ['GRAMPS_RESOURCES'] = os.path.dirname(os.path.abspath(".."))
|
||||||
pystartup = os.path.expanduser("~/.pystartup")
|
pystartup = os.path.expanduser("~/.pystartup")
|
||||||
if os.path.exists(pystartup):
|
if not os.path.exists(pystartup):
|
||||||
|
fp = file(pystartup, "w")
|
||||||
|
fp.write("""
|
||||||
|
import atexit
|
||||||
|
import os
|
||||||
|
import readline
|
||||||
|
import rlcompleter
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# change autocomplete to tab
|
||||||
|
readline.parse_and_bind("tab: complete")
|
||||||
|
|
||||||
|
historyPath = os.path.expanduser("~/.pyhistory")
|
||||||
|
|
||||||
|
def save_history(historyPath=historyPath):
|
||||||
|
import readline
|
||||||
|
readline.write_history_file(historyPath)
|
||||||
|
|
||||||
|
if os.path.exists(historyPath):
|
||||||
|
readline.read_history_file(historyPath)
|
||||||
|
|
||||||
|
atexit.register(save_history)
|
||||||
|
|
||||||
|
# anything not deleted (sys and os) will remain in the interpreter session
|
||||||
|
del atexit, readline, rlcompleter, save_history, historyPath""")
|
||||||
|
fp.close()
|
||||||
|
|
||||||
execfile(pystartup)
|
execfile(pystartup)
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import gramps.webapp.settings as default_settings
|
import gramps.webapp.settings as default_settings
|
||||||
|
Loading…
Reference in New Issue
Block a user