Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer import to __import__ #82

Merged
merged 2 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dist/
*.so
.noseids
*.sublime-workspace
*.egg-info
16 changes: 7 additions & 9 deletions gitdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@

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
Expand Down