diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-11-23 07:36:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-23 07:36:13 +0100 |
commit | 43de98464486566bf1326cf791fd6192c0551c76 (patch) | |
tree | 44a2989f3bf91e9d6acfbac92b70d8e0a400f229 | |
parent | 3415e08bd9590d489f1071815863bfdde3083fb3 (diff) | |
parent | 1edc7d296af635dc31030a09e73fd684eedc1d59 (diff) | |
download | gitdb-43de98464486566bf1326cf791fd6192c0551c76.tar.gz |
Merge pull request #82 from zwimer/prefer-standard-import
Prefer `import` to `__import__`
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | gitdb/__init__.py | 16 |
2 files changed, 8 insertions, 9 deletions
@@ -7,3 +7,4 @@ dist/ *.so .noseids *.sublime-workspace +*.egg-info diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 2460145..94b0831 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -12,15 +12,13 @@ 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 + del smmap # END handle imports #} END initialization |