clean.py 674 B

1234567891011121314151617181920212223
  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('python -m pip uninstall -y jupyterlab'.split(), cwd=here)
  12. git_clean_exclude = [
  13. '-e',
  14. '/.vscode',
  15. ]
  16. git_clean_command = ['git', 'clean', '-dfx'] + git_clean_exclude
  17. subprocess.check_call(git_clean_command, cwd=here)