##// END OF EJS Templates
Adding new magics to install config files and profiles....
Brian Granger -
Show More
@@ -13,7 +13,7 b' c = get_config()'
13
13
14 # Set this to determine the detail of what is logged at startup.
14 # Set this to determine the detail of what is logged at startup.
15 # The default is 30 and possible values are 0,10,20,30,40,50.
15 # The default is 30 and possible values are 0,10,20,30,40,50.
16 c.Global.log_level = 20
16 # c.Global.log_level = 20
17
17
18 # This should be a list of importable Python modules that have an
18 # This should be a list of importable Python modules that have an
19 # load_in_ipython(ip) method. This method gets called when the extension
19 # load_in_ipython(ip) method. This method gets called when the extension
1 NO CONTENT: file renamed from IPython/config/profile/__init_.py to IPython/config/profile/__init__.py
NO CONTENT: file renamed from IPython/config/profile/__init_.py to IPython/config/profile/__init__.py
@@ -21,6 +21,7 b' import os'
21 import pdb
21 import pdb
22 import pydoc
22 import pydoc
23 import sys
23 import sys
24 import shutil
24 import re
25 import re
25 import tempfile
26 import tempfile
26 import time
27 import time
@@ -3549,4 +3550,59 b' Defaulting color scheme to \'NoColor\'"""'
3549 """Reload an IPython extension by its module name."""
3550 """Reload an IPython extension by its module name."""
3550 self.reload_extension(module_str)
3551 self.reload_extension(module_str)
3551
3552
3553 def magic_install_profiles(self, s):
3554 """Install the default IPython profiles into the .ipython dir.
3555
3556 If the default profiles have already been installed, they will not
3557 be overwritten. You can force overwriting them by using the ``-o``
3558 option::
3559
3560 In [1]: %install_profiles -o
3561 """
3562 if '-o' in s:
3563 overwrite = True
3564 else:
3565 overwrite = False
3566 from IPython.config import profile
3567 profile_dir = os.path.split(profile.__file__)[0]
3568 ipythondir = self.ipythondir
3569 files = os.listdir(profile_dir)
3570
3571 to_install = []
3572 for f in files:
3573 if f.startswith('ipython_config'):
3574 src = os.path.join(profile_dir, f)
3575 dst = os.path.join(ipythondir, f)
3576 if (not os.path.isfile(dst)) or overwrite:
3577 to_install.append((f, src, dst))
3578 if len(to_install)>0:
3579 print "Installing profiles to: ", ipythondir
3580 for (f, src, dst) in to_install:
3581 shutil.copy(src, dst)
3582 print " %s" % f
3583
3584 def magic_install_default_config(self, s):
3585 """Install IPython's default config file into the .ipython dir.
3586
3587 If the default config file (:file:`ipython_config.py`) is already
3588 installed, it will not be overwritten. You can force overwriting
3589 by using the ``-o`` option::
3590
3591 In [1]: %install_default_config
3592 """
3593 if '-o' in s:
3594 overwrite = True
3595 else:
3596 overwrite = False
3597 from IPython.config import default
3598 config_dir = os.path.split(default.__file__)[0]
3599 ipythondir = self.ipythondir
3600 default_config_file_name = 'ipython_config.py'
3601 src = os.path.join(config_dir, default_config_file_name)
3602 dst = os.path.join(ipythondir, default_config_file_name)
3603 if (not os.path.isfile(dst)) or overwrite:
3604 shutil.copy(src, dst)
3605 print "Installing default config file: %s" % dst
3606
3607
3552 # end Magic
3608 # end Magic
General Comments 0
You need to be logged in to leave comments. Login now