Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a68c1b

Browse files
committed
add README to startup dir
1 parent 7c21f7c commit 8a68c1b

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
This is the IPython startup directory
2+
3+
.py and .ipy files in this directory will be run *prior* to any code or files specified
4+
via the exec_lines or exec_files configurables whenever you load this profile.
5+
6+
Files will be run in lexicographical order, so you can control the execution order of files
7+
with a prefix, e.g.::
8+
9+
00-first.py
10+
50-middle.py
11+
99-last.ipy

IPython/core/profiledir.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ def _startup_dir_changed(self, name, old, new):
100100
def check_startup_dir(self):
101101
if not os.path.isdir(self.startup_dir):
102102
os.mkdir(self.startup_dir)
103+
readme = os.path.join(self.startup_dir, 'README')
104+
src = os.path.join(get_ipython_package_dir(), u'config', u'profile', u'README_STARTUP')
105+
if not os.path.exists(readme):
106+
shutil.copy(src, readme)
103107

104108
def _security_dir_changed(self, name, old, new):
105109
self.check_security_dir()
@@ -129,6 +133,7 @@ def check_dirs(self):
129133
self.check_security_dir()
130134
self.check_log_dir()
131135
self.check_pid_dir()
136+
self.check_startup_dir()
132137

133138
def copy_config_file(self, config_file, path=None, overwrite=False):
134139
"""Copy a default config file into the active profile directory.

setupbase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def find_package_data():
132132
static_data.append(os.path.join(parent, f))
133133

134134
package_data = {
135-
'IPython.config.profile' : ['README', '*/*.py'],
135+
'IPython.config.profile' : ['README*', '*/*.py'],
136136
'IPython.testing' : ['*.txt'],
137137
'IPython.frontend.html.notebook' : ['templates/*'] + static_data,
138138
'IPython.frontend.qt.console' : ['resources/icon/*.svg'],

0 commit comments

Comments
 (0)