From ec9e134cc3c036199975aa658677841e84480415 2009-10-29 23:09:39 From: Brian Granger Date: 2009-10-29 23:09:39 Subject: [PATCH] Removing old config directories that used the old config system. --- diff --git a/IPython/config/api.py b/IPython/config/api.py deleted file mode 100644 index 14b4b6a..0000000 --- a/IPython/config/api.py +++ /dev/null @@ -1,102 +0,0 @@ -# encoding: utf-8 - -"""This is the official entry point to IPython's configuration system. """ - -__docformat__ = "restructuredtext en" - -#------------------------------------------------------------------------------- -# Copyright (C) 2008 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# Imports -#------------------------------------------------------------------------------- - -import os -from os.path import join as pjoin - -from IPython.utils.genutils import get_home_dir, get_ipython_dir -from IPython.external.configobj import ConfigObj - - -class ConfigObjManager(object): - - def __init__(self, configObj, filename): - self.current = configObj - self.current.indent_type = ' ' - self.filename = filename - # self.write_default_config_file() - - def get_config_obj(self): - return self.current - - def update_config_obj(self, newConfig): - self.current.merge(newConfig) - - def update_config_obj_from_file(self, filename): - newConfig = ConfigObj(filename, file_error=False) - self.current.merge(newConfig) - - def update_config_obj_from_default_file(self, ipythondir=None): - fname = self.resolve_file_path(self.filename, ipythondir) - self.update_config_obj_from_file(fname) - - def write_config_obj_to_file(self, filename): - f = open(filename, 'w') - self.current.write(f) - f.close() - - def write_default_config_file(self): - ipdir = get_ipython_dir() - fname = pjoin(ipdir, self.filename) - if not os.path.isfile(fname): - print "Writing the configuration file to: " + fname - self.write_config_obj_to_file(fname) - - def _import(self, key): - package = '.'.join(key.split('.')[0:-1]) - obj = key.split('.')[-1] - execString = 'from %s import %s' % (package, obj) - exec execString - exec 'temp = %s' % obj - return temp - - def resolve_file_path(self, filename, ipythondir = None): - """Resolve filenames into absolute paths. - - This function looks in the following directories in order: - - 1. In the current working directory or by absolute path with ~ expanded - 2. In ipythondir if that is set - 3. In the IPYTHONDIR environment variable if it exists - 4. In the ~/.ipython directory - - Note: The IPYTHONDIR is also used by the trunk version of IPython so - changing it will also affect it was well. - """ - - # In cwd or by absolute path with ~ expanded - trythis = os.path.expanduser(filename) - if os.path.isfile(trythis): - return trythis - - # In ipythondir if it is set - if ipythondir is not None: - trythis = pjoin(ipythondir, filename) - if os.path.isfile(trythis): - return trythis - - trythis = pjoin(get_ipython_dir(), filename) - if os.path.isfile(trythis): - return trythis - - return None - - - - - - diff --git a/IPython/kernel/config/__init__.py b/IPython/kernel/config/__init__.py deleted file mode 100644 index 2326446..0000000 --- a/IPython/kernel/config/__init__.py +++ /dev/null @@ -1,126 +0,0 @@ -# encoding: utf-8 - -"""Default kernel configuration.""" - -__docformat__ = "restructuredtext en" - -#------------------------------------------------------------------------------- -# Copyright (C) 2008 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# Imports -#------------------------------------------------------------------------------- - -import os, sys -from os.path import join as pjoin - -from IPython.external.configobj import ConfigObj -from IPython.config.api import ConfigObjManager -from IPython.utils.genutils import get_ipython_dir, get_security_dir - -default_kernel_config = ConfigObj() - -# This will raise OSError if ipythondir doesn't exist. -security_dir = get_security_dir() - -#------------------------------------------------------------------------------- -# Engine Configuration -#------------------------------------------------------------------------------- - -engine_config = dict( - logfile = '', # Empty means log to stdout - furl_file = pjoin(security_dir, 'ipcontroller-engine.furl') -) - -#------------------------------------------------------------------------------- -# MPI Configuration -#------------------------------------------------------------------------------- - -mpi_config = dict( - mpi4py = """from mpi4py import MPI as mpi -mpi.size = mpi.COMM_WORLD.Get_size() -mpi.rank = mpi.COMM_WORLD.Get_rank() -""", - pytrilinos = """from PyTrilinos import Epetra -class SimpleStruct: - pass -mpi = SimpleStruct() -mpi.rank = 0 -mpi.size = 0 -""", - default = '' -) - -#------------------------------------------------------------------------------- -# Controller Configuration -#------------------------------------------------------------------------------- - -controller_config = dict( - - logfile = '', # Empty means log to stdout - import_statement = '', - reuse_furls = False, # If False, old furl files are deleted - - engine_tub = dict( - ip = '', # Empty string means all interfaces - port = 0, # 0 means pick a port for me - location = '', # Empty string means try to set automatically - secure = True, - cert_file = pjoin(security_dir, 'ipcontroller-engine.pem'), - ), - engine_fc_interface = 'IPython.kernel.enginefc.IFCControllerBase', - engine_furl_file = pjoin(security_dir, 'ipcontroller-engine.furl'), - - controller_interfaces = dict( - # multiengine = dict( - # controller_interface = 'IPython.kernel.multiengine.IMultiEngine', - # fc_interface = 'IPython.kernel.multienginefc.IFCMultiEngine', - # furl_file = 'ipcontroller-mec.furl' - # ), - task = dict( - controller_interface = 'IPython.kernel.task.ITaskController', - fc_interface = 'IPython.kernel.taskfc.IFCTaskController', - furl_file = pjoin(security_dir, 'ipcontroller-tc.furl') - ), - multiengine = dict( - controller_interface = 'IPython.kernel.multiengine.IMultiEngine', - fc_interface = 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine', - furl_file = pjoin(security_dir, 'ipcontroller-mec.furl') - ) - ), - - client_tub = dict( - ip = '', # Empty string means all interfaces - port = 0, # 0 means pick a port for me - location = '', # Empty string means try to set automatically - secure = True, - cert_file = pjoin(security_dir, 'ipcontroller-client.pem') - ) -) - -#------------------------------------------------------------------------------- -# Client Configuration -#------------------------------------------------------------------------------- - -client_config = dict( - client_interfaces = dict( - task = dict( - furl_file = pjoin(security_dir, 'ipcontroller-tc.furl') - ), - multiengine = dict( - furl_file = pjoin(security_dir, 'ipcontroller-mec.furl') - ) - ) -) - -default_kernel_config['engine'] = engine_config -default_kernel_config['mpi'] = mpi_config -default_kernel_config['controller'] = controller_config -default_kernel_config['client'] = client_config - - -config_manager = ConfigObjManager(default_kernel_config, 'IPython.kernel.ini') \ No newline at end of file diff --git a/IPython/kernel/core/config/__init__.py b/IPython/kernel/core/config/__init__.py deleted file mode 100644 index 6f60906..0000000 --- a/IPython/kernel/core/config/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# encoding: utf-8 - -__docformat__ = "restructuredtext en" - -#------------------------------------------------------------------------------- -# Copyright (C) 2008 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# Imports -#------------------------------------------------------------------------------- - -from IPython.external.configobj import ConfigObj -from IPython.config.api import ConfigObjManager - -default_core_config = ConfigObj() -default_core_config['shell'] = dict( - shell_class = 'IPython.kernel.core.interpreter.Interpreter', - import_statement = '' -) - -config_manager = ConfigObjManager(default_core_config, 'IPython.kernel.core.ini') \ No newline at end of file