##// END OF EJS Templates
Brian Granger -
Show More
@@ -1007,7 +1007,17 b' def get_security_dir():'
1007 1007 else:
1008 1008 os.chmod(security_dir, 0700)
1009 1009 return security_dir
1010
1010
1011 def get_log_dir():
1012 """Get the IPython log directory.
1013
1014 If the log directory does not exist, it is created.
1015 """
1016 log_dir = os.path.join(get_ipython_dir(), 'log')
1017 if not os.path.isdir(log_dir):
1018 os.mkdir(log_dir, 0777)
1019 return log_dir
1020
1011 1021 #****************************************************************************
1012 1022 # strings and text
1013 1023
@@ -15,10 +15,9 b' if they need blocking clients or in `asyncclient.py` if they want asynchronous,'
15 15 deferred/Twisted using clients.
16 16 """
17 17 __docformat__ = "restructuredtext en"
18 #-------------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19 19 # Copyright (C) 2008 The IPython Development Team
20 20 #
21 21 # Distributed under the terms of the BSD License. The full license is in
22 22 # the file COPYING, distributed as part of this software.
23 #-------------------------------------------------------------------------------
24 No newline at end of file
23 #----------------------------------------------------------------------------- No newline at end of file
@@ -15,6 +15,7 b' __docformat__ = "restructuredtext en"'
15 15 # Imports
16 16 #-------------------------------------------------------------------------------
17 17
18 import os, sys
18 19 from os.path import join as pjoin
19 20
20 21 from IPython.external.configobj import ConfigObj
@@ -23,6 +24,7 b' from IPython.genutils import get_ipython_dir, get_security_dir'
23 24
24 25 default_kernel_config = ConfigObj()
25 26
27 # This will raise OSError if ipythondir doesn't exist.
26 28 security_dir = get_security_dir()
27 29
28 30 #-------------------------------------------------------------------------------
@@ -29,8 +29,21 b' from twisted.python import failure, log'
29 29
30 30 from IPython.external import argparse
31 31 from IPython.external import Itpl
32 from IPython.genutils import get_ipython_dir, num_cpus
32 from IPython.genutils import get_ipython_dir, get_log_dir, get_security_dir
33 from IPython.genutils import num_cpus
33 34 from IPython.kernel.fcutil import have_crypto
35
36 # Create various ipython directories if they don't exist.
37 # This must be done before IPython.kernel.config is imported.
38 from IPython.iplib import user_setup
39 if os.name == 'posix':
40 rc_suffix = ''
41 else:
42 rc_suffix = '.ini'
43 user_setup(get_ipython_dir(), rc_suffix, mode='install', interactive=False)
44 get_log_dir()
45 get_security_dir()
46
34 47 from IPython.kernel.config import config_manager as kernel_config_manager
35 48 from IPython.kernel.error import SecurityError, FileTimeoutError
36 49 from IPython.kernel.fcutil import have_crypto
@@ -38,6 +38,18 b' from IPython.kernel.error import SecurityError'
38 38 from IPython.kernel import controllerservice
39 39 from IPython.kernel.fcutil import check_furl_file_security
40 40
41 # Create various ipython directories if they don't exist.
42 # This must be done before IPython.kernel.config is imported.
43 from IPython.iplib import user_setup
44 from IPython.genutils import get_ipython_dir, get_log_dir, get_security_dir
45 if os.name == 'posix':
46 rc_suffix = ''
47 else:
48 rc_suffix = '.ini'
49 user_setup(get_ipython_dir(), rc_suffix, mode='install', interactive=False)
50 get_log_dir()
51 get_security_dir()
52
41 53 from IPython.kernel.config import config_manager as kernel_config_manager
42 54 from IPython.config.cutils import import_item
43 55
@@ -116,7 +128,6 b' def make_client_service(controller_service, config):'
116 128 # appears to other processes, the buffer has the flushed
117 129 # and the file has been closed
118 130 temp_furl_file = get_temp_furlfile(furl_file)
119 log.msg(temp_furl_file)
120 131 client_tub.registerReference(ref, furlFile=temp_furl_file)
121 132 os.rename(temp_furl_file, furl_file)
122 133
@@ -169,7 +180,6 b' def make_engine_service(controller_service, config):'
169 180 # appears to other processes, the buffer has the flushed
170 181 # and the file has been closed
171 182 temp_furl_file = get_temp_furlfile(furl_file)
172 log.msg(temp_furl_file)
173 183 engine_tub.registerReference(ref, furlFile=temp_furl_file)
174 184 os.rename(temp_furl_file, furl_file)
175 185
@@ -342,12 +352,6 b' def init_config():'
342 352 help="log file name (default is stdout)"
343 353 )
344 354 parser.add_option(
345 "--ipythondir",
346 type="string",
347 dest="ipythondir",
348 help="look for config files and profiles in this directory"
349 )
350 parser.add_option(
351 355 "-r",
352 356 action="store_true",
353 357 dest="reuse_furls",
@@ -356,7 +360,6 b' def init_config():'
356 360
357 361 (options, args) = parser.parse_args()
358 362
359 kernel_config_manager.update_config_obj_from_default_file(options.ipythondir)
360 363 config = kernel_config_manager.get_config_obj()
361 364
362 365 # Update with command line options
@@ -33,6 +33,19 b' from IPython.kernel.fcutil import Tub, UnauthenticatedTub'
33 33 from IPython.kernel.core.config import config_manager as core_config_manager
34 34 from IPython.config.cutils import import_item
35 35 from IPython.kernel.engineservice import EngineService
36
37 # Create various ipython directories if they don't exist.
38 # This must be done before IPython.kernel.config is imported.
39 from IPython.iplib import user_setup
40 from IPython.genutils import get_ipython_dir, get_log_dir, get_security_dir
41 if os.name == 'posix':
42 rc_suffix = ''
43 else:
44 rc_suffix = '.ini'
45 user_setup(get_ipython_dir(), rc_suffix, mode='install', interactive=False)
46 get_log_dir()
47 get_security_dir()
48
36 49 from IPython.kernel.config import config_manager as kernel_config_manager
37 50 from IPython.kernel.engineconnector import EngineConnector
38 51
@@ -148,18 +161,9 b' def init_config():'
148 161 dest="logfile",
149 162 help="log file name (default is stdout)"
150 163 )
151 parser.add_option(
152 "--ipythondir",
153 type="string",
154 dest="ipythondir",
155 help="look for config files and profiles in this directory"
156 )
157 164
158 165 (options, args) = parser.parse_args()
159 166
160 kernel_config_manager.update_config_obj_from_default_file(options.ipythondir)
161 core_config_manager.update_config_obj_from_default_file(options.ipythondir)
162
163 167 kernel_config = kernel_config_manager.get_config_obj()
164 168 # Now override with command line options
165 169 if options.furl_file is not None:
@@ -210,7 +210,6 b' def test_get_home_dir_7():'
210 210 home_dir = genutils.get_home_dir()
211 211 nt.assert_equal(home_dir, abspath(HOME_TEST_DIR))
212 212
213
214 213 #
215 214 # Tests for get_ipython_dir
216 215 #
@@ -239,7 +238,6 b' def test_get_ipython_dir_3():'
239 238 ipdir = genutils.get_ipython_dir()
240 239 nt.assert_equal(ipdir, os.path.abspath(os.path.join("someplace", "_ipython")))
241 240
242
243 241 #
244 242 # Tests for get_security_dir
245 243 #
@@ -249,6 +247,14 b' def test_get_security_dir():'
249 247 """Testcase to see if we can call get_security_dir without Exceptions."""
250 248 sdir = genutils.get_security_dir()
251 249
250 #
251 # Tests for get_log_dir
252 #
253
254 @with_enivronment
255 def test_get_log_dir():
256 """Testcase to see if we can call get_log_dir without Exceptions."""
257 sdir = genutils.get_log_dir()
252 258
253 259 #
254 260 # Tests for popkey
General Comments 0
You need to be logged in to leave comments. Login now