diff --git a/IPython/config/default/ipython_config.py b/IPython/config/default/ipython_config.py index 63c0b54..0582944 100644 --- a/IPython/config/default/ipython_config.py +++ b/IPython/config/default/ipython_config.py @@ -13,7 +13,7 @@ c = get_config() # Set this to determine the detail of what is logged at startup. # The default is 30 and possible values are 0,10,20,30,40,50. -c.Global.log_level = 20 +# c.Global.log_level = 20 # This should be a list of importable Python modules that have an # load_in_ipython(ip) method. This method gets called when the extension diff --git a/IPython/config/profile/__init_.py b/IPython/config/profile/__init__.py similarity index 100% rename from IPython/config/profile/__init_.py rename to IPython/config/profile/__init__.py diff --git a/IPython/core/magic.py b/IPython/core/magic.py index f38207b..a144032 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -21,6 +21,7 @@ import os import pdb import pydoc import sys +import shutil import re import tempfile import time @@ -3549,4 +3550,59 @@ Defaulting color scheme to 'NoColor'""" """Reload an IPython extension by its module name.""" self.reload_extension(module_str) + def magic_install_profiles(self, s): + """Install the default IPython profiles into the .ipython dir. + + If the default profiles have already been installed, they will not + be overwritten. You can force overwriting them by using the ``-o`` + option:: + + In [1]: %install_profiles -o + """ + if '-o' in s: + overwrite = True + else: + overwrite = False + from IPython.config import profile + profile_dir = os.path.split(profile.__file__)[0] + ipythondir = self.ipythondir + files = os.listdir(profile_dir) + + to_install = [] + for f in files: + if f.startswith('ipython_config'): + src = os.path.join(profile_dir, f) + dst = os.path.join(ipythondir, f) + if (not os.path.isfile(dst)) or overwrite: + to_install.append((f, src, dst)) + if len(to_install)>0: + print "Installing profiles to: ", ipythondir + for (f, src, dst) in to_install: + shutil.copy(src, dst) + print " %s" % f + + def magic_install_default_config(self, s): + """Install IPython's default config file into the .ipython dir. + + If the default config file (:file:`ipython_config.py`) is already + installed, it will not be overwritten. You can force overwriting + by using the ``-o`` option:: + + In [1]: %install_default_config + """ + if '-o' in s: + overwrite = True + else: + overwrite = False + from IPython.config import default + config_dir = os.path.split(default.__file__)[0] + ipythondir = self.ipythondir + default_config_file_name = 'ipython_config.py' + src = os.path.join(config_dir, default_config_file_name) + dst = os.path.join(ipythondir, default_config_file_name) + if (not os.path.isfile(dst)) or overwrite: + shutil.copy(src, dst) + print "Installing default config file: %s" % dst + + # end Magic