Skip to content

Commit d70f1b6

Browse files
committed
Never modify sys.path
This removes the logic that, under some circumstances when not using a version from PyPI, would insert the location of the gitdb git-submodule near the front of sys.path. (As noted in gitpython-developers#1717, the specific way this was being done was not causing the git-submodule's version of gitdb to actually be used. But it was still modifying sys.path, which this now prevents.)
1 parent 44102f3 commit d70f1b6

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

git/__init__.py

-28
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,12 @@
77
# @PydevCodeAnalysisIgnore
88
from git.exc import * # @NoMove @IgnorePep8
99
import inspect
10-
import os
11-
import sys
12-
import os.path as osp
1310

1411
from typing import Optional
1512
from git.types import PathLike
1613

1714
__version__ = "git"
1815

19-
20-
# { Initialization
21-
def _init_externals() -> None:
22-
"""Initialize external projects by putting them into the path"""
23-
if __version__ == "git" and "PYOXIDIZER" not in os.environ:
24-
sys.path.insert(1, osp.join(osp.dirname(__file__), "ext", "gitdb"))
25-
26-
try:
27-
import gitdb
28-
except ImportError as e:
29-
raise ImportError("'gitdb' could not be found in your PYTHONPATH") from e
30-
# END verify import
31-
32-
33-
# } END initialization
34-
35-
36-
#################
37-
_init_externals()
38-
#################
39-
40-
# { Imports
41-
4216
try:
4317
from git.config import GitConfigParser # @NoMove @IgnorePep8
4418
from git.objects import * # @NoMove @IgnorePep8
@@ -59,8 +33,6 @@ def _init_externals() -> None:
5933
except GitError as _exc:
6034
raise ImportError("%s: %s" % (_exc.__class__.__name__, _exc)) from _exc
6135

62-
# } END imports
63-
6436
# __all__ must be statically defined by py.typed support
6537
# __all__ = [name for name, obj in locals().items() if not (name.startswith("_") or inspect.ismodule(obj))]
6638
__all__ = [

0 commit comments

Comments
 (0)