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.

37 lines
725B

  1. import time
  2. import pip
  3. from pip._internal import main as pipmain
  4. from common.log import _reset_logger, logger
  5. def install(package):
  6. pipmain(["install", package])
  7. def install_requirements(file):
  8. pipmain(["install", "-r", file, "--upgrade"])
  9. _reset_logger(logger)
  10. def check_dulwich():
  11. needwait = False
  12. for i in range(2):
  13. if needwait:
  14. time.sleep(3)
  15. needwait = False
  16. try:
  17. import dulwich
  18. return
  19. except ImportError:
  20. try:
  21. install("dulwich")
  22. except:
  23. needwait = True
  24. try:
  25. import dulwich
  26. except ImportError:
  27. raise ImportError("Unable to import dulwich")