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.

27 satır
607B

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