Show More
@@ -11,7 +11,7 b' Authors:' | |||
|
11 | 11 | """ |
|
12 | 12 | |
|
13 | 13 | #----------------------------------------------------------------------------- |
|
14 |
# Copyright (C) 20 |
|
|
14 | # Copyright (C) 2011 The IPython Development Team | |
|
15 | 15 | # |
|
16 | 16 | # Distributed under the terms of the BSD License. The full license is in |
|
17 | 17 | # the file COPYING, distributed as part of this software. |
@@ -60,10 +60,12 b' class ProfileDir(LoggingConfigurable):' | |||
|
60 | 60 | log_dir_name = Unicode('log') |
|
61 | 61 | startup_dir_name = Unicode('startup') |
|
62 | 62 | pid_dir_name = Unicode('pid') |
|
63 | static_dir_name = Unicode('static') | |
|
63 | 64 | security_dir = Unicode(u'') |
|
64 | 65 | log_dir = Unicode(u'') |
|
65 | 66 | startup_dir = Unicode(u'') |
|
66 | 67 | pid_dir = Unicode(u'') |
|
68 | static_dir = Unicode(u'') | |
|
67 | 69 | |
|
68 | 70 | location = Unicode(u'', config=True, |
|
69 | 71 | help="""Set the profile location directly. This overrides the logic used by the |
@@ -84,6 +86,7 b' class ProfileDir(LoggingConfigurable):' | |||
|
84 | 86 | self.log_dir = os.path.join(new, self.log_dir_name) |
|
85 | 87 | self.startup_dir = os.path.join(new, self.startup_dir_name) |
|
86 | 88 | self.pid_dir = os.path.join(new, self.pid_dir_name) |
|
89 | self.static_dir = os.path.join(new, self.static_dir_name) | |
|
87 | 90 | self.check_dirs() |
|
88 | 91 | |
|
89 | 92 | def _log_dir_changed(self, name, old, new): |
@@ -153,11 +156,29 b' class ProfileDir(LoggingConfigurable):' | |||
|
153 | 156 | def check_pid_dir(self): |
|
154 | 157 | self._mkdir(self.pid_dir, 0o40700) |
|
155 | 158 | |
|
159 | def _static_dir_changed(self, name, old, new): | |
|
160 | self.check_startup_dir() | |
|
161 | ||
|
162 | def check_static_dir(self): | |
|
163 | self._mkdir(self.static_dir) | |
|
164 | custom = os.path.join(self.static_dir, 'custom') | |
|
165 | self._mkdir(custom) | |
|
166 | from IPython.html import DEFAULT_STATIC_FILES_PATH | |
|
167 | for fname in ('custom.js', 'custom.css'): | |
|
168 | src = os.path.join(DEFAULT_STATIC_FILES_PATH, 'custom', fname) | |
|
169 | dest = os.path.join(custom, fname) | |
|
170 | if not os.path.exists(src): | |
|
171 | self.log.warn("Could not copy default file to static dir. Source file %s does not exist.", src) | |
|
172 | continue | |
|
173 | if not os.path.exists(dest): | |
|
174 | shutil.copy(src, dest) | |
|
175 | ||
|
156 | 176 | def check_dirs(self): |
|
157 | 177 | self.check_security_dir() |
|
158 | 178 | self.check_log_dir() |
|
159 | 179 | self.check_pid_dir() |
|
160 | 180 | self.check_startup_dir() |
|
181 | self.check_static_dir() | |
|
161 | 182 | |
|
162 | 183 | def copy_config_file(self, config_file, path=None, overwrite=False): |
|
163 | 184 | """Copy a default config file into the active profile directory. |
General Comments 0
You need to be logged in to leave comments.
Login now