##// END OF EJS Templates
alternate interpretation of mathjax install dir...
MinRK -
Show More
@@ -21,7 +21,9 b' From the command line:'
21
21
22 To a specific location:
22 To a specific location:
23
23
24 $ python -m IPython.external.mathjax -i /usr/share/mathjax
24 $ python -m IPython.external.mathjax -i /usr/share/
25
26 will install mathjax to /usr/share/mathjax
25
27
26 To install MathJax from a file you have already downloaded:
28 To install MathJax from a file you have already downloaded:
27
29
@@ -39,7 +41,7 b' To find the directory where IPython would like MathJax installed:'
39
41
40
42
41 #-----------------------------------------------------------------------------
43 #-----------------------------------------------------------------------------
42 # Copyright (C) 2008-2011 The IPython Development Team
44 # Copyright (C) 2011 The IPython Development Team
43 #
45 #
44 # Distributed under the terms of the BSD License. The full license is in
46 # Distributed under the terms of the BSD License. The full license is in
45 # the file COPYING, distributed as part of this software.
47 # the file COPYING, distributed as part of this software.
@@ -66,7 +68,8 b' from IPython.utils.path import get_ipython_dir'
66
68
67 # Where mathjax will be installed
69 # Where mathjax will be installed
68
70
69 default_dest = os.path.join(get_ipython_dir(), 'nbextensions', 'mathjax')
71 nbextensions = os.path.join(get_ipython_dir(), 'nbextensions')
72 default_dest = os.path.join(nbextensions, 'mathjax')
70
73
71 # Test for access to install mathjax
74 # Test for access to install mathjax
72
75
@@ -80,14 +83,17 b' def prepare_dest(dest, replace=False):'
80 parent = os.path.abspath(os.path.join(dest, os.path.pardir))
83 parent = os.path.abspath(os.path.join(dest, os.path.pardir))
81 if not os.path.exists(parent):
84 if not os.path.exists(parent):
82 os.makedirs(parent)
85 os.makedirs(parent)
83
86
84 if os.path.exists(dest):
87 if os.path.exists(dest):
85 if replace:
88 if replace:
86 print "removing existing MathJax at %s" % dest
89 print "removing existing MathJax at %s" % dest
87 shutil.rmtree(dest)
90 shutil.rmtree(dest)
88 return True
91 return True
89 else:
92 else:
90 print "MathJax apparently already installed at %s" % dest
93 mathjax_js = os.path.join(dest, 'MathJax.js')
94 if not os.path.exists(mathjax_js):
95 raise IOError("%s exists, but does not contain MathJax.js" % dest)
96 print "%s already exists" % mathjax_js
91 return False
97 return False
92 else:
98 else:
93 return True
99 return True
@@ -137,8 +143,8 b" def install_mathjax(tag='v2.2', dest=default_dest, replace=False, file=None, ext"
137
143
138 replace : bool [False]
144 replace : bool [False]
139 Whether to remove and replace an existing install.
145 Whether to remove and replace an existing install.
140 dest : str [IPYTHONDIR/nbextensions]
146 dest : str [IPYTHONDIR/nbextensions/mathjax]
141 Where to locally install mathjax
147 Where to install mathjax
142 tag : str ['v2.2']
148 tag : str ['v2.2']
143 Which tag to download. Default is 'v2.2', the current stable release,
149 Which tag to download. Default is 'v2.2', the current stable release,
144 but alternatives include 'v1.1a' and 'master'.
150 but alternatives include 'v1.1a' and 'master'.
@@ -176,8 +182,8 b' def main():'
176 parser.add_argument(
182 parser.add_argument(
177 '-i',
183 '-i',
178 '--install-dir',
184 '--install-dir',
179 default=default_dest,
185 default=nbextensions,
180 help='custom installation directory')
186 help='custom installation directory. Mathjax will be installed in here/mathjax')
181
187
182 parser.add_argument(
188 parser.add_argument(
183 '-d',
189 '-d',
@@ -196,7 +202,7 b' def main():'
196
202
197 pargs = parser.parse_args()
203 pargs = parser.parse_args()
198
204
199 dest = pargs.install_dir
205 dest = os.path.join(pargs.install_dir, 'mathjax')
200
206
201 if pargs.print_dest:
207 if pargs.print_dest:
202 print dest
208 print dest
General Comments 0
You need to be logged in to leave comments. Login now