diff options
author | zwimer <zwimer@gmail.com> | 2022-11-22 18:57:47 -0700 |
---|---|---|
committer | zwimer <zwimer@gmail.com> | 2022-11-22 18:57:47 -0700 |
commit | c3ab5d7b28062848c2a639a60e0acfbaee7e8f90 (patch) | |
tree | de3f1372d98853a4f720611c1fe44da48670e20d /gitdb/__init__.py | |
parent | 3415e08bd9590d489f1071815863bfdde3083fb3 (diff) | |
download | gitdb-c3ab5d7b28062848c2a639a60e0acfbaee7e8f90.tar.gz |
Prefer import to __import__
Diffstat (limited to 'gitdb/__init__.py')
-rw-r--r-- | gitdb/__init__.py | 15 |
1 files changed, 6 insertions, 9 deletions
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 |