summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzwimer <zwimer@gmail.com>2022-11-22 18:57:47 -0700
committerzwimer <zwimer@gmail.com>2022-11-22 18:57:47 -0700
commitc3ab5d7b28062848c2a639a60e0acfbaee7e8f90 (patch)
treede3f1372d98853a4f720611c1fe44da48670e20d
parent3415e08bd9590d489f1071815863bfdde3083fb3 (diff)
downloadgitdb-c3ab5d7b28062848c2a639a60e0acfbaee7e8f90.tar.gz
Prefer import to __import__
-rw-r--r--.gitignore1
-rw-r--r--gitdb/__init__.py15
2 files changed, 7 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index e0b4e85..8b7da92 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ dist/
*.so
.noseids
*.sublime-workspace
+*.egg-info
diff --git a/gitdb/__init__.py b/gitdb/__init__.py
index 2460145..c5b5547 100644
--- a/gitdb/__init__.py
+++ b/gitdb/__init__.py
@@ -12,15 +12,12 @@ import os
def _init_externals():
"""Initialize external projects by putting them into the path"""
- for module in ('smmap',):
- if 'PYOXIDIZER' not in os.environ:
- sys.path.append(os.path.join(os.path.dirname(__file__), 'ext', module))
-
- try:
- __import__(module)
- except ImportError as e:
- raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module) from e
- # END verify import
+ if 'PYOXIDIZER' not in os.environ:
+ where = os.path.join(os.path.dirname(__file__), 'ext', 'smmap')
+ if os.path.exists(where):
+ sys.path.append(where)
+
+ import smmap
# END handle imports
#} END initialization