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

87 行
2.3KB

  1. # __init__.py
  2. # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
  3. #
  4. # This module is part of GitPython and is released under
  5. # the BSD License: http://www.opensource.org/licenses/bsd-license.php
  6. # flake8: noqa
  7. #@PydevCodeAnalysisIgnore
  8. import inspect
  9. import os
  10. import sys
  11. import os.path as osp
  12. __version__ = '3.0.1'
  13. #{ Initialization
  14. def _init_externals():
  15. """Initialize external projects by putting them into the path"""
  16. if __version__ == '3.0.1':
  17. sys.path.insert(0, osp.join(osp.dirname(__file__), 'ext', 'gitdb'))
  18. try:
  19. import gitdb
  20. except ImportError:
  21. raise ImportError("'gitdb' could not be found in your PYTHONPATH")
  22. # END verify import
  23. #} END initialization
  24. #################
  25. _init_externals()
  26. #################
  27. #{ Imports
  28. from git.exc import * # @NoMove @IgnorePep8
  29. try:
  30. from git.config import GitConfigParser # @NoMove @IgnorePep8
  31. from git.objects import * # @NoMove @IgnorePep8
  32. from git.refs import * # @NoMove @IgnorePep8
  33. from git.diff import * # @NoMove @IgnorePep8
  34. from git.db import * # @NoMove @IgnorePep8
  35. from git.cmd import Git # @NoMove @IgnorePep8
  36. from git.repo import Repo # @NoMove @IgnorePep8
  37. from git.remote import * # @NoMove @IgnorePep8
  38. from git.index import * # @NoMove @IgnorePep8
  39. from git.util import ( # @NoMove @IgnorePep8
  40. LockFile,
  41. BlockingLockFile,
  42. Stats,
  43. Actor,
  44. rmtree,
  45. )
  46. except GitError as exc:
  47. raise ImportError('%s: %s' % (exc.__class__.__name__, exc))
  48. #} END imports
  49. __all__ = [name for name, obj in locals().items()
  50. if not (name.startswith('_') or inspect.ismodule(obj))]
  51. #{ Initialize git executable path
  52. GIT_OK = None
  53. def refresh(path=None):
  54. """Convenience method for setting the git executable path."""
  55. global GIT_OK
  56. GIT_OK = False
  57. if not Git.refresh(path=path):
  58. return
  59. if not FetchInfo.refresh():
  60. return
  61. GIT_OK = True
  62. #} END initialize git executable path
  63. #################
  64. try:
  65. refresh()
  66. except Exception as exc:
  67. raise ImportError('Failed to initialize: {0}'.format(exc))
  68. #################