You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.5 KiB

4 years ago
  1. #!/usr/bin/env python
  2. import argparse
  3. from os.path import dirname, abspath, join
  4. from notebook.nbextensions import install_nbextension
  5. def install(user=False, symlink=False, overwrite=False, **kwargs):
  6. """Install the bqplot nbextension.
  7. Parameters
  8. ----------
  9. user: bool
  10. Install for current user instead of system-wide.
  11. symlink: bool
  12. Symlink instead of copy (for development).
  13. overwrite: bool
  14. Overwrite previously-installed files for this extension
  15. **kwargs: keyword arguments
  16. Other keyword arguments passed to the install_nbextension command
  17. """
  18. directory = join(dirname(abspath(__file__)), 'nbextension')
  19. install_nbextension(directory, destination='bqplot',
  20. symlink=symlink, user=user, overwrite=overwrite,
  21. **kwargs)
  22. if __name__ == '__main__':
  23. parser = argparse.ArgumentParser(description="Installs the bqplot widget")
  24. parser.add_argument("-u", "--user",
  25. help="Install as current user instead of system-wide",
  26. action="store_true")
  27. parser.add_argument("-s", "--symlink",
  28. help="Symlink instead of copying files",
  29. action="store_true")
  30. parser.add_argument("-f", "--force",
  31. help="Overwrite any previously-installed files for this extension",
  32. action="store_true")
  33. args = parser.parse_args()
  34. install(user=args.user, symlink=args.symlink, overwrite=args.force)