clean.py 560 B

123456789101112131415161718
  1. import os
  2. import subprocess
  3. here = os.path.abspath(os.path.dirname(__file__))
  4. # Workaround for https://github.com/git-for-windows/git/issues/607
  5. if os.name == 'nt':
  6. for (root, dnames, files) in os.walk(here):
  7. if 'node_modules' in dnames:
  8. subprocess.check_call(['rmdir', '/s', '/q', 'node_modules'],
  9. cwd=root, shell=True)
  10. dnames.remove('node_modules')
  11. subprocess.check_call(['git', 'clean', '-dfx'], cwd=here)
  12. subprocess.call('python -m pip uninstall -y jupyterlab'.split(), cwd=here)