您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

30 行
717B

  1. import time
  2. import pip
  3. from pip._internal import main as pipmain
  4. from common.log import logger,_reset_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")