install-dev-deps 557 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python
  2. import os
  3. from contextlib import contextmanager
  4. from subprocess import check_call
  5. _dname = os.path.dirname
  6. REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
  7. @contextmanager
  8. def cd(path):
  9. """Change directory while inside context manager."""
  10. cwd = os.getcwd()
  11. try:
  12. os.chdir(path)
  13. yield
  14. finally:
  15. os.chdir(cwd)
  16. def run(command):
  17. return check_call(command, shell=True)
  18. if __name__ == "__main__":
  19. with cd(REPO_ROOT):
  20. run("pip install -r requirements-dev-lock.txt")