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