File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -1735,7 +1735,8 @@ def do_resize(caller):
17351735# The list win resizes itself every time it appears so no need to do it here.
17361736
17371737def migrate_rc (path ):
1738- """Use the shlex module to convert the old configuration file to the new format"""
1738+ """Use the shlex module to convert the old configuration file to the new format.
1739+ The old configuration file is renamed but not removed by now."""
17391740 import shlex
17401741 f = open (path )
17411742 parser = shlex .shlex (f )
@@ -1775,6 +1776,12 @@ def migrate_rc(path):
17751776 f = open (os .path .expanduser ('~/.bpython.ini' ), 'w' )
17761777 config .write (f )
17771778 f .close ()
1779+ os .rename (path , os .path .expanduser ('~/.bpythonrc.bak' ))
1780+ print "The configuration file for bpython has been changed. A new .bpython.ini file has been created in your home directory."
1781+ print "The existing .bpythonrc file has been renamed to .bpythonrc.bak and it can be removed."
1782+ print "Press enter to continue."
1783+ raw_input ()
1784+
17781785
17791786
17801787def loadini ():
@@ -1834,11 +1841,10 @@ def main_curses(scr):
18341841 global stdscr
18351842 global DO_RESIZE
18361843 DO_RESIZE = False
1837- signal .signal (signal .SIGWINCH , lambda * _ : sigwinch (scr ))
1838-
1839- path = os .path .expanduser ('~/.bpythonrc' ) # migrating old configuration file
18401844 if os .path .isfile (path ):
18411845 migrate_rc (path )
1846+ signal .signal (signal .SIGWINCH , lambda * _ : sigwinch (scr ))
1847+
18421848 loadini ()
18431849 stdscr = scr
18441850 try :
@@ -1881,6 +1887,10 @@ def main():
18811887
18821888 tb = None
18831889
1890+ path = os .path .expanduser ('~/.bpythonrc' ) # migrating old configuration file
1891+ if os .path .isfile (path ):
1892+ migrate_rc (path )
1893+
18841894 try :
18851895 o = curses .wrapper (main_curses )
18861896 except :
You can’t perform that action at this time.
0 commit comments