Show More
@@ -25,6 +25,8 b' from IPython.utils.path import get_ipython_dir, ensure_dir_exists' | |||
|
25 | 25 | from IPython.utils.py3compat import string_types, cast_unicode_py2 |
|
26 | 26 | from IPython.utils.tempdir import TemporaryDirectory |
|
27 | 27 | |
|
28 | class ArgumentConflict(ValueError): | |
|
29 | pass | |
|
28 | 30 | |
|
29 | 31 | # Packagers: modify the next block if you store system-installed nbextensions elsewhere (unlikely) |
|
30 | 32 | SYSTEM_NBEXTENSIONS_DIRS = [] |
@@ -140,7 +142,7 b' def install_nbextension(files, overwrite=False, symlink=False, user=False, prefi' | |||
|
140 | 142 | set verbose=2 for more output, or verbose=0 for silence. |
|
141 | 143 | """ |
|
142 | 144 | if sum(map(bool, [user, prefix, nbextensions_dir])) > 1: |
|
143 |
raise |
|
|
145 | raise ArgumentConflict("Cannot specify more than one of user, prefix, or nbextensions_dir.") | |
|
144 | 146 | if user: |
|
145 | 147 | nbext = pjoin(get_ipython_dir(), u'nbextensions') |
|
146 | 148 | else: |
@@ -296,10 +298,6 b' class NBExtensionApp(BaseIPythonApplication):' | |||
|
296 | 298 | help="Verbosity level" |
|
297 | 299 | ) |
|
298 | 300 | |
|
299 | def check_install(): | |
|
300 | if sum(map(bool, [user, prefix, nbextensions_dir])) > 1: | |
|
301 | raise TraitError("Cannot specify more than one of user, prefix, or nbextensions_dir.") | |
|
302 | ||
|
303 | 301 | def install_extensions(self): |
|
304 | 302 | install_nbextension(self.extra_args, |
|
305 | 303 | overwrite=self.overwrite, |
@@ -318,8 +316,11 b' class NBExtensionApp(BaseIPythonApplication):' | |||
|
318 | 316 | for ext in os.listdir(nbext): |
|
319 | 317 | print(u" %s" % ext) |
|
320 | 318 | else: |
|
321 | self.check_install() | |
|
319 | try: | |
|
322 | 320 | self.install_extensions() |
|
321 | except ArgumentConflict as e: | |
|
322 | print(str(e), file=sys.stderr) | |
|
323 | self.exit(1) | |
|
323 | 324 | |
|
324 | 325 | |
|
325 | 326 | if __name__ == '__main__': |
General Comments 0
You need to be logged in to leave comments.
Login now