##// END OF EJS Templates
Select default profile according to Python version.
Thomas Kluyver -
Show More
@@ -40,6 +40,7 b' from IPython.core import release, crashhandler'
40 from IPython.core.profiledir import ProfileDir, ProfileDirError
40 from IPython.core.profiledir import ProfileDir, ProfileDirError
41 from IPython.utils.path import get_ipython_dir, get_ipython_package_dir
41 from IPython.utils.path import get_ipython_dir, get_ipython_package_dir
42 from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict
42 from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict
43 from IPython.utils import py3compat
43
44
44 #-----------------------------------------------------------------------------
45 #-----------------------------------------------------------------------------
45 # Classes and functions
46 # Classes and functions
@@ -102,9 +103,12 b' class BaseIPythonApplication(Application):'
102 def _config_file_paths_default(self):
103 def _config_file_paths_default(self):
103 return [os.getcwdu()]
104 return [os.getcwdu()]
104
105
105 profile = Unicode(u'default', config=True,
106 profile = Unicode(u'', config=True,
106 help="""The IPython profile to use."""
107 help="""The IPython profile to use."""
107 )
108 )
109 def _profile_default(self):
110 return "python3" if py3compat.PY3 else "default"
111
108 def _profile_changed(self, name, old, new):
112 def _profile_changed(self, name, old, new):
109 self.builtin_profile_dir = os.path.join(
113 self.builtin_profile_dir = os.path.join(
110 get_ipython_package_dir(), u'config', u'profile', new
114 get_ipython_package_dir(), u'config', u'profile', new
@@ -222,7 +226,7 b' class BaseIPythonApplication(Application):'
222 p = ProfileDir.find_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
226 p = ProfileDir.find_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
223 except ProfileDirError:
227 except ProfileDirError:
224 # not found, maybe create it (always create default profile)
228 # not found, maybe create it (always create default profile)
225 if self.auto_create or self.profile=='default':
229 if self.auto_create or self.profile==self._profile_default():
226 try:
230 try:
227 p = ProfileDir.create_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
231 p = ProfileDir.create_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
228 except ProfileDirError:
232 except ProfileDirError:
General Comments 0
You need to be logged in to leave comments. Login now